Quellcode durchsuchen

fix: more exim dialog stuff

Sv443 vor 10 Monaten
Ursprung
Commit
2bbad1d01a
3 geänderte Dateien mit 8 neuen und 4 gelöschten Zeilen
  1. 1 1
      src/components/ExportImportDialog.ts
  2. 1 0
      src/dialogs/autoLike.ts
  3. 6 3
      src/menu/menu_old.ts

+ 1 - 1
src/components/ExportImportDialog.ts

@@ -38,7 +38,7 @@ export class ExImDialog extends BytmDialog {
       closeOnBgClick: true,
       closeOnBgClick: true,
       closeOnEscPress: true,
       closeOnEscPress: true,
       closeBtnEnabled: true,
       closeBtnEnabled: true,
-      destroyOnClose: true,
+      unmountOnClose: true,
       small: true,
       small: true,
       ...options,
       ...options,
     });
     });

+ 1 - 0
src/dialogs/autoLike.ts

@@ -65,6 +65,7 @@ export async function getAutoLikeDialog() {
           siteEvents.emit("autoLikeChannelsUpdated");
           siteEvents.emit("autoLikeChannelsUpdated");
 
 
           showToast({ message: t("import_success") });
           showToast({ message: t("import_success") });
+          autoLikeImExDialog?.unmount();
         }
         }
         catch(err) {
         catch(err) {
           error("Couldn't import auto-like channels data:", err);
           error("Couldn't import auto-like channels data:", err);

+ 6 - 3
src/menu/menu_old.ts

@@ -179,13 +179,16 @@ async function mountCfgMenu() {
     height: 600,
     height: 600,
     // try to compress the data if possible
     // try to compress the data if possible
     exportData: async () => await compressionSupported()
     exportData: async () => await compressionSupported()
-      ? await compress(JSON.stringify(getFeatures()), compressionFormat, "string")
-      : JSON.stringify(getFeatures()),
+      ? await compress(JSON.stringify({ formatVersion, data: getFeatures() }), compressionFormat, "string")
+      : JSON.stringify({ formatVersion, data: getFeatures() }),
     // copy plain when shift-clicking the copy button
     // copy plain when shift-clicking the copy button
     exportDataSpecial: () => JSON.stringify(getFeatures()),
     exportDataSpecial: () => JSON.stringify(getFeatures()),
     onImport: async (data) => {
     onImport: async (data) => {
       try {
       try {
         const parsed = await tryToDecompressAndParse<{ data: FeatureConfig, formatVersion: number }>(data.trim());
         const parsed = await tryToDecompressAndParse<{ data: FeatureConfig, formatVersion: number }>(data.trim());
+
+        console.log(">> parsed", parsed);
+
         if(!parsed || typeof parsed !== "object")
         if(!parsed || typeof parsed !== "object")
           return alert(t("import_error_invalid"));
           return alert(t("import_error_invalid"));
         if(typeof parsed.formatVersion !== "number")
         if(typeof parsed.formatVersion !== "number")
@@ -225,8 +228,8 @@ async function mountCfgMenu() {
           return location.reload();
           return location.reload();
         }
         }
 
 
-        emitSiteEvent("rebuildCfgMenu", parsed.data);
         exImDlg.unmount();
         exImDlg.unmount();
+        emitSiteEvent("rebuildCfgMenu", parsed.data);
       }
       }
       catch(err) {
       catch(err) {
         warn("Couldn't import configuration:", err);
         warn("Couldn't import configuration:", err);