diff options
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/build.js | 12 | ||||
| -rw-r--r-- | dev/data/manifest-variants.json | 20 | 
2 files changed, 25 insertions, 7 deletions
diff --git a/dev/build.js b/dev/build.js index 5222c4c8..24b1e2d0 100644 --- a/dev/build.js +++ b/dev/build.js @@ -108,7 +108,7 @@ function getIndexOfFilePath(array, item) {      return -1;  } -async function build(buildDir, extDir, manifestUtil, variantNames, manifestPath, dryRun, dryRunBuildZip) { +async function build(buildDir, extDir, manifestUtil, variantNames, manifestPath, dryRun, dryRunBuildZip, yomitanVersion) {      const sevenZipExes = ['7za', '7z'];      // Create build directory @@ -130,6 +130,8 @@ async function build(buildDir, extDir, manifestUtil, variantNames, manifestPath,          process.stdout.write(message);      }; +    process.stdout.write(`Version: ${yomitanVersion}...\n`); +      for (const variantName of variantNames) {          const variant = manifestUtil.getVariant(variantName);          if (typeof variant === 'undefined' || variant.buildable === false) { continue; } @@ -148,7 +150,7 @@ async function build(buildDir, extDir, manifestUtil, variantNames, manifestPath,              const fileNameSafe = path.basename(fileName);              const fullFileName = path.join(buildDir, fileNameSafe);              if (!dryRun) { -                fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(modifiedManifest)); +                fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(modifiedManifest).replace('$YOMITAN_VERSION', yomitanVersion));              }              if (!dryRun || dryRunBuildZip) { @@ -183,11 +185,13 @@ async function main(argv) {          ['manifest', null],          ['dry-run', false],          ['dry-run-build-zip', false], +        ['yomitan-version', '0.0.0.0'],          [null, []]      ]));      const dryRun = args.get('dry-run');      const dryRunBuildZip = args.get('dry-run-build-zip'); +    const yomitanVersion = args.get('yomitan-version');      const manifestUtil = new ManifestUtil(); @@ -202,14 +206,14 @@ async function main(argv) {              manifestUtil.getVariants().filter(({buildable}) => buildable !== false).map(({name}) => name) :              args.get(null)          ); -        await build(buildDir, extDir, manifestUtil, variantNames, manifestPath, dryRun, dryRunBuildZip); +        await build(buildDir, extDir, manifestUtil, variantNames, manifestPath, dryRun, dryRunBuildZip, yomitanVersion);      } finally {          // Restore manifest          const manifestName = (!args.get('default') && args.get('manifest') !== null) ? args.get('manifest') : null;          const restoreManifest = manifestUtil.getManifest(manifestName);          process.stdout.write('Restoring manifest...\n');          if (!dryRun) { -            fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(restoreManifest)); +            fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(restoreManifest).replace('$YOMITAN_VERSION', yomitanVersion));          }      }  } diff --git a/dev/data/manifest-variants.json b/dev/data/manifest-variants.json index 3179734f..26d91d26 100644 --- a/dev/data/manifest-variants.json +++ b/dev/data/manifest-variants.json @@ -2,7 +2,7 @@      "manifest": {          "manifest_version": 3,          "name": "Yomitan", -        "version": "23.4.7.0", +        "version": "$YOMITAN_VERSION",          "description": "Japanese dictionary with Anki integration",          "author": "TheMoeWay",          "icons": { @@ -206,12 +206,19 @@                      ]                  },                  { +                    "action": "delete", +                    "path": [ +                        "content_security_policy", +                        "sandbox" +                    ] +                }, +                {                      "action": "set",                      "path": [                          "content_security_policy",                          "extension_pages"                      ], -                    "value": "default-src 'self'; script-src 'self' 'unsafe-eval'; img-src blob: 'self'; style-src 'self' 'unsafe-inline'; media-src *; connect-src *" +                    "value": "default-src 'self'; script-src 'self'; img-src blob: 'self'; style-src 'self' 'unsafe-inline'; media-src *; connect-src *"                  },                  {                      "action": "set", @@ -221,7 +228,7 @@                      "value": {                          "gecko": {                              "id": "{cb7c0bec-7085-4f84-8422-7b55a7c4467c}", -                            "strict_min_version": "101.0" +                            "strict_min_version": "102.0"                          }                      }                  }, @@ -240,6 +247,13 @@                      "items": [                          "nativeMessaging"                      ] +                }, +                { +                    "action": "remove", +                    "path": [ +                        "permissions" +                    ], +                    "item": "declarativeNetRequest"                  }              ],              "excludeFiles": [  |