Stickers
Co-authored-by: scott@signal.org Co-authored-by: ken@signal.org
This commit is contained in:
parent
8c8856785b
commit
29de50c12a
100 changed files with 7572 additions and 693 deletions
|
@ -11,6 +11,7 @@ module.exports = {
|
|||
let initialized = false;
|
||||
|
||||
const ERASE_ATTACHMENTS_KEY = 'erase-attachments';
|
||||
const ERASE_STICKERS_KEY = 'erase-stickers';
|
||||
const CLEANUP_ORPHANED_ATTACHMENTS_KEY = 'cleanup-orphaned-attachments';
|
||||
|
||||
async function initialize({ configDir, cleanupOrphanedAttachments }) {
|
||||
|
@ -19,12 +20,10 @@ async function initialize({ configDir, cleanupOrphanedAttachments }) {
|
|||
}
|
||||
initialized = true;
|
||||
|
||||
console.log('Ensure attachments directory exists');
|
||||
await Attachments.ensureDirectory(configDir);
|
||||
|
||||
const attachmentsDir = Attachments.getPath(configDir);
|
||||
const stickersDir = Attachments.getStickersPath(configDir);
|
||||
|
||||
ipcMain.on(ERASE_ATTACHMENTS_KEY, async event => {
|
||||
ipcMain.on(ERASE_ATTACHMENTS_KEY, event => {
|
||||
try {
|
||||
rimraf.sync(attachmentsDir);
|
||||
event.sender.send(`${ERASE_ATTACHMENTS_KEY}-done`);
|
||||
|
@ -35,6 +34,17 @@ async function initialize({ configDir, cleanupOrphanedAttachments }) {
|
|||
}
|
||||
});
|
||||
|
||||
ipcMain.on(ERASE_STICKERS_KEY, event => {
|
||||
try {
|
||||
rimraf.sync(stickersDir);
|
||||
event.sender.send(`${ERASE_STICKERS_KEY}-done`);
|
||||
} catch (error) {
|
||||
const errorForDisplay = error && error.stack ? error.stack : error;
|
||||
console.log(`erase stickers error: ${errorForDisplay}`);
|
||||
event.sender.send(`${ERASE_STICKERS_KEY}-done`, error);
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on(CLEANUP_ORPHANED_ATTACHMENTS_KEY, async event => {
|
||||
try {
|
||||
await cleanupOrphanedAttachments();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue