Selaa lähdekoodia

fix: sync with data version 1

Gerald 8 vuotta sitten
vanhempi
sitoutus
7763b7c506
1 muutettua tiedostoa jossa 16 lisäystä ja 6 poistoa
  1. 16 6
      src/background/sync/base.js

+ 16 - 6
src/background/sync/base.js

@@ -391,18 +391,28 @@ export const BaseService = serviceFactory({
           this.log('Upload script:', script.props.uri);
           return getScriptCode(script.props.id)
           .then(code => {
-            const data = JSON.stringify({
-              version: 2,
+            // const data = {
+            //   version: 2,
+            //   code,
+            //   custom: script.custom,
+            //   config: script.config,
+            // };
+            // XXX use version 1 to be compatible with Violentmonkey on other platforms
+            const data = {
+              version: 1,
               code,
-              custom: script.custom,
-              config: script.config,
-            });
+              more: {
+                custom: script.custom,
+                enabled: script.config.enabled,
+                update: script.config.shouldUpdate,
+              },
+            };
             remoteMeta.info[script.props.uri] = {
               modified: script.custom.modified,
               position: script.props.position,
             };
             remoteChanged = true;
-            return this.put(getFilename(script.props.uri), data);
+            return this.put(getFilename(script.props.uri), JSON.stringify(data));
           });
         }),
         ...delRemote.map(item => {