Compare commits
No commits in common. "main" and "agent/github-firefox-updates" have entirely different histories.
main
...
agent/gith
26
README.md
26
README.md
|
|
@ -55,29 +55,21 @@ Firefox signing uses `web-ext` and AMO credentials from an env file. The script
|
||||||
requires `WEB_EXT_API_PROXY`; AMO upload and approval polling run through that
|
requires `WEB_EXT_API_PROXY`; AMO upload and approval polling run through that
|
||||||
proxy.
|
proxy.
|
||||||
|
|
||||||
Create the signed XPI locally, without publishing it:
|
Create the signed XPI and publish it, together with `updates.json`, as the
|
||||||
|
current GitHub Release:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
VERSTAK_BROWSER_ENV=/path/to/.env npm run release:firefox
|
VERSTAK_BROWSER_ENV=/path/to/.env npm run publish:firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
Publish the signed XPI and `updates.json` as the current GitHub Release:
|
The first invocation publishes tag `v2.0.2` and bootstraps the
|
||||||
|
`releases/latest/download/updates.json` endpoint. Re-running the command
|
||||||
|
replaces those two release assets for the same tag.
|
||||||
|
|
||||||
|
To sign and prepare release files locally without changing GitHub:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
VERSTAK_BROWSER_ENV=/path/to/.env npm run publish:github
|
VERSTAK_BROWSER_ENV=/home/mirivlad/git/verstak/.env npm run release:firefox
|
||||||
```
|
|
||||||
|
|
||||||
The publisher reads the version from `package.json` and requires an
|
|
||||||
authenticated GitHub CLI plus a clean local `main` equal to `origin/main`. It
|
|
||||||
creates and pushes the version tag if needed, then creates or updates the
|
|
||||||
GitHub Release. Re-running it for the same tag replaces the XPI and
|
|
||||||
`updates.json` assets. `npm run publish:firefox` remains as a compatible alias
|
|
||||||
for the same Firefox publishing flow.
|
|
||||||
|
|
||||||
For an explicit version check, pass the current tag after `--`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
VERSTAK_BROWSER_ENV=/path/to/.env npm run publish:github -- v2.0.4
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Release output:
|
Release output:
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "Verstak Bridge",
|
"name": "Verstak Bridge",
|
||||||
"version": "2.0.4",
|
"version": "2.0.2",
|
||||||
"description": "Send pages, selections, links, and files to the local Verstak browser inbox.",
|
"description": "Send pages, selections, links, and files to the local Verstak browser inbox.",
|
||||||
"author": "Verstak",
|
"author": "Verstak",
|
||||||
"homepage_url": "https://github.com/mirivlad/verstak-browser-extension",
|
"homepage_url": "https://git.mirv.top/verstak/verstak-browser-extension",
|
||||||
"permissions": ["alarms", "contextMenus", "idle", "storage", "tabs", "windows"],
|
"permissions": ["alarms", "contextMenus", "idle", "storage", "tabs", "windows"],
|
||||||
"host_permissions": ["http://127.0.0.1/*", "http://localhost/*"],
|
"host_permissions": ["http://127.0.0.1/*", "http://localhost/*"],
|
||||||
"background": {
|
"background": {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
- Publish repository: `mirivlad/verstak-browser-extension`.
|
- Publish repository: `mirivlad/verstak-browser-extension`.
|
||||||
- Firefox addon ID: `verstak-bridge@verstak.app`.
|
- Firefox addon ID: `verstak-bridge@verstak.app`.
|
||||||
- Initial GitHub release: `v2.0.3`; package and both browser manifests are version `2.0.3`.
|
- Initial GitHub release: `v2.0.2`; package and both browser manifests are version `2.0.2`.
|
||||||
- Every alpha GitHub release is ordinary/latest, not a prerelease.
|
- Every alpha GitHub release is ordinary/latest, not a prerelease.
|
||||||
- XPI remains Mozilla-signed as an unlisted/self-distributed addon before upload.
|
- XPI remains Mozilla-signed as an unlisted/self-distributed addon before upload.
|
||||||
- `npm run release:firefox` remains a local sign-and-package action.
|
- `npm run release:firefox` remains a local sign-and-package action.
|
||||||
|
|
@ -41,19 +41,19 @@ Create `scripts/test-firefox-github-release.js` with:
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const release = require('./firefox-github-release');
|
const release = require('./firefox-github-release');
|
||||||
|
|
||||||
const version = '2.0.3';
|
const version = '2.0.2';
|
||||||
const asset = 'verstak-firefox-2.0.3.xpi';
|
const asset = 'verstak-firefox-2.0.2.xpi';
|
||||||
assert.equal(release.releaseTag(version), 'v2.0.3');
|
assert.equal(release.releaseTag(version), 'v2.0.2');
|
||||||
assert.equal(
|
assert.equal(
|
||||||
release.releaseAssetURL(version, asset),
|
release.releaseAssetURL(version, asset),
|
||||||
'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.3/verstak-firefox-2.0.3.xpi',
|
'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.2/verstak-firefox-2.0.2.xpi',
|
||||||
);
|
);
|
||||||
assert.deepEqual(release.updateManifest('verstak-bridge@verstak.app', version, asset), {
|
assert.deepEqual(release.updateManifest('verstak-bridge@verstak.app', version, asset), {
|
||||||
addons: {
|
addons: {
|
||||||
'verstak-bridge@verstak.app': {
|
'verstak-bridge@verstak.app': {
|
||||||
updates: [{
|
updates: [{
|
||||||
version: '2.0.3',
|
version: '2.0.2',
|
||||||
update_link: 'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.3/verstak-firefox-2.0.3.xpi',
|
update_link: 'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.2/verstak-firefox-2.0.2.xpi',
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -246,7 +246,7 @@ Rewrite the Firefox Release README section so it documents:
|
||||||
- `VERSTAK_BROWSER_ENV=/path/to/.env npm run publish:firefox`;
|
- `VERSTAK_BROWSER_ENV=/path/to/.env npm run publish:firefox`;
|
||||||
- that signing remains unlisted with Mozilla but distribution and automatic
|
- that signing remains unlisted with Mozilla but distribution and automatic
|
||||||
updates use GitHub Release assets;
|
updates use GitHub Release assets;
|
||||||
- that the first `v2.0.3` publish bootstraps the `latest/download/updates.json`
|
- that the first `v2.0.2` publish bootstraps the `latest/download/updates.json`
|
||||||
endpoint.
|
endpoint.
|
||||||
|
|
||||||
- [ ] **Step 4: Run checks without publishing**
|
- [ ] **Step 4: Run checks without publishing**
|
||||||
|
|
@ -275,12 +275,12 @@ git push origin main
|
||||||
### Task 4: Bootstrap and verify the first public update release
|
### Task 4: Bootstrap and verify the first public update release
|
||||||
|
|
||||||
**Files:**
|
**Files:**
|
||||||
- Generated: `release/firefox/verstak-firefox-2.0.3.xpi` (untracked)
|
- Generated: `release/firefox/verstak-firefox-2.0.2.xpi` (untracked)
|
||||||
- Generated: `release/firefox/updates.json` (untracked)
|
- Generated: `release/firefox/updates.json` (untracked)
|
||||||
|
|
||||||
**Interfaces:**
|
**Interfaces:**
|
||||||
- Consumes the Task 3 `npm run publish:firefox` command and valid AMO signing credentials.
|
- Consumes the Task 3 `npm run publish:firefox` command and valid AMO signing credentials.
|
||||||
- Produces GitHub Release tag `v2.0.3` and public XPI/update-manifest assets.
|
- Produces GitHub Release tag `v2.0.2` and public XPI/update-manifest assets.
|
||||||
|
|
||||||
- [ ] **Step 1: Verify release credentials before write operations**
|
- [ ] **Step 1: Verify release credentials before write operations**
|
||||||
|
|
||||||
|
|
@ -302,20 +302,20 @@ Run:
|
||||||
npm run publish:firefox
|
npm run publish:firefox
|
||||||
```
|
```
|
||||||
|
|
||||||
Expected: Mozilla signing succeeds, GitHub Release `v2.0.3` is latest, and it
|
Expected: Mozilla signing succeeds, GitHub Release `v2.0.2` is latest, and it
|
||||||
contains `verstak-firefox-2.0.3.xpi` plus `updates.json`.
|
contains `verstak-firefox-2.0.2.xpi` plus `updates.json`.
|
||||||
|
|
||||||
- [ ] **Step 3: Verify public delivery**
|
- [ ] **Step 3: Verify public delivery**
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gh release view v2.0.3 --repo mirivlad/verstak-browser-extension --json isLatest,url,assets
|
gh release view v2.0.2 --repo mirivlad/verstak-browser-extension --json isLatest,url,assets
|
||||||
curl -fsSL https://github.com/mirivlad/verstak-browser-extension/releases/latest/download/updates.json
|
curl -fsSL https://github.com/mirivlad/verstak-browser-extension/releases/latest/download/updates.json
|
||||||
```
|
```
|
||||||
|
|
||||||
Expected: the release is latest and the JSON contains addon ID
|
Expected: the release is latest and the JSON contains addon ID
|
||||||
`verstak-bridge@verstak.app`, version `2.0.3`, and the versioned GitHub XPI
|
`verstak-bridge@verstak.app`, version `2.0.2`, and the versioned GitHub XPI
|
||||||
asset URL.
|
asset URL.
|
||||||
|
|
||||||
- [ ] **Step 4: Record release verification without committing assets**
|
- [ ] **Step 4: Record release verification without committing assets**
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ Each release uploads two assets:
|
||||||
- `updates.json`, whose `update_link` points to that same release tag's XPI
|
- `updates.json`, whose `update_link` points to that same release tag's XPI
|
||||||
asset.
|
asset.
|
||||||
|
|
||||||
For version `2.0.3`, the versioned link is:
|
For version `2.0.2`, the versioned link is:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.3/verstak-firefox-2.0.3.xpi
|
https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.2/verstak-firefox-2.0.2.xpi
|
||||||
```
|
```
|
||||||
|
|
||||||
The stable `latest/download` endpoint lets already installed extensions discover
|
The stable `latest/download` endpoint lets already installed extensions discover
|
||||||
|
|
@ -46,10 +46,10 @@ endpoint.
|
||||||
## Bootstrap
|
## Bootstrap
|
||||||
|
|
||||||
There is currently no GitHub Release in this repository. After the code change,
|
There is currently no GitHub Release in this repository. After the code change,
|
||||||
the first `v2.0.3` signed release must be published before shipping a manifest
|
the first `v2.0.2` signed release must be published before shipping a manifest
|
||||||
that points to `latest/download/updates.json`; until then that URL is a 404.
|
that points to `latest/download/updates.json`; until then that URL is a 404.
|
||||||
The current package, Chromium manifest and Firefox manifest all use version
|
The current package, Chromium manifest and Firefox manifest all use version
|
||||||
`2.0.3`, so the initial tag and XPI asset name are unambiguous.
|
`2.0.2`, so the initial tag and XPI asset name are unambiguous.
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Verstak Bridge",
|
"name": "Verstak Bridge",
|
||||||
"version": "2.0.4",
|
"version": "2.0.2",
|
||||||
"description": "Send pages, selections, links, and files to the local Verstak browser inbox.",
|
"description": "Send pages, selections, links, and files to the local Verstak browser inbox.",
|
||||||
"author": "Verstak",
|
"author": "Verstak",
|
||||||
"homepage_url": "https://github.com/mirivlad/verstak-browser-extension",
|
"homepage_url": "https://github.com/mirivlad/verstak-browser-extension",
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "verstak-browser-extension",
|
"name": "verstak-browser-extension",
|
||||||
"version": "2.0.4",
|
"version": "2.0.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "verstak-browser-extension",
|
"name": "verstak-browser-extension",
|
||||||
"version": "2.0.4",
|
"version": "2.0.2",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"web-ext": "^8.3.0"
|
"web-ext": "^8.3.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,15 @@
|
||||||
{
|
{
|
||||||
"name": "verstak-browser-extension",
|
"name": "verstak-browser-extension",
|
||||||
"version": "2.0.4",
|
"version": "2.0.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Verstak browser capture extension for Chromium and Firefox",
|
"description": "Verstak browser capture extension for Chromium and Firefox",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node scripts/build-extension.js",
|
"build": "node scripts/build-extension.js",
|
||||||
"test": "node scripts/test-hostname.js && node scripts/test-activity-tracker.js && node scripts/test-protocol.js && node scripts/test-i18n.js && node scripts/test-popup-settings.js && node scripts/test-popup-select-style.js && node scripts/test-popup-catalog-fallback.js && node scripts/test-background-i18n.js && node scripts/test-firefox-github-release.js",
|
"test": "node scripts/test-hostname.js && node scripts/test-activity-tracker.js && node scripts/test-protocol.js && node scripts/test-i18n.js && node scripts/test-popup-settings.js && node scripts/test-popup-catalog-fallback.js && node scripts/test-background-i18n.js && node scripts/test-firefox-github-release.js",
|
||||||
"sign:firefox": "./scripts/sign-firefox-xpi.sh",
|
"sign:firefox": "./scripts/sign-firefox-xpi.sh",
|
||||||
"release:firefox": "./scripts/release-firefox-xpi.sh",
|
"release:firefox": "./scripts/release-firefox-xpi.sh",
|
||||||
"publish:firefox": "./scripts/publish-firefox-github-release.sh",
|
"publish:firefox": "./scripts/publish-firefox-github-release.sh",
|
||||||
"publish:github": "./scripts/publish-github-release.sh",
|
|
||||||
"release:package": "./scripts/package-release.sh"
|
"release:package": "./scripts/package-release.sh"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -7,29 +7,13 @@ cd "$ROOT_DIR"
|
||||||
REPOSITORY="mirivlad/verstak-browser-extension"
|
REPOSITORY="mirivlad/verstak-browser-extension"
|
||||||
SOURCE_DIR="${VERSTAK_FIREFOX_SOURCE_DIR:-dist/firefox}"
|
SOURCE_DIR="${VERSTAK_FIREFOX_SOURCE_DIR:-dist/firefox}"
|
||||||
RELEASE_DIR="${VERSTAK_FIREFOX_RELEASE_DIR:-release/firefox}"
|
RELEASE_DIR="${VERSTAK_FIREFOX_RELEASE_DIR:-release/firefox}"
|
||||||
GIT_BIN="${GIT_BIN:-git}"
|
|
||||||
GH_BIN="${GH_BIN:-gh}"
|
|
||||||
|
|
||||||
if ! command -v "$GH_BIN" >/dev/null; then
|
if ! command -v gh >/dev/null; then
|
||||||
echo "ERROR: gh CLI is required to publish a GitHub Release" >&2
|
echo "ERROR: gh CLI is required to publish a GitHub Release" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "$("$GIT_BIN" branch --show-current)" != "main" ]]; then
|
|
||||||
echo "ERROR: GitHub releases must be published from main" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -n "$("$GIT_BIN" status --porcelain)" ]]; then
|
|
||||||
echo "ERROR: working tree must be clean before publishing a release" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
"$GH_BIN" auth status
|
gh auth status
|
||||||
"$GIT_BIN" fetch origin main --tags
|
|
||||||
HEAD="$("$GIT_BIN" rev-parse HEAD)"
|
|
||||||
if [[ "$HEAD" != "$("$GIT_BIN" rev-parse origin/main)" ]]; then
|
|
||||||
echo "ERROR: local main must match origin/main before publishing a release" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
./scripts/release-firefox-xpi.sh
|
./scripts/release-firefox-xpi.sh
|
||||||
|
|
||||||
VERSION="$(node -e "console.log(require('./${SOURCE_DIR}/manifest.json').version)")"
|
VERSION="$(node -e "console.log(require('./${SOURCE_DIR}/manifest.json').version)")"
|
||||||
|
|
@ -44,26 +28,16 @@ for artifact in "$XPI" "$UPDATES"; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if "$GIT_BIN" rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
|
if gh release view "$TAG" --repo "$REPOSITORY" >/dev/null 2>&1; then
|
||||||
if [[ "$("$GIT_BIN" rev-parse "${TAG}^{commit}")" != "$HEAD" ]]; then
|
gh release upload "$TAG" "$XPI" "$UPDATES" --repo "$REPOSITORY" --clobber
|
||||||
echo "ERROR: existing tag $TAG does not point at HEAD" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
"$GIT_BIN" tag -a "$TAG" -m "Release $TAG"
|
gh release create "$TAG" "$XPI" "$UPDATES" \
|
||||||
"$GIT_BIN" push origin "refs/tags/$TAG"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if "$GH_BIN" release view "$TAG" --repo "$REPOSITORY" >/dev/null 2>&1; then
|
|
||||||
"$GH_BIN" release upload "$TAG" "$XPI" "$UPDATES" --repo "$REPOSITORY" --clobber
|
|
||||||
else
|
|
||||||
"$GH_BIN" release create "$TAG" "$XPI" "$UPDATES" \
|
|
||||||
--repo "$REPOSITORY" \
|
--repo "$REPOSITORY" \
|
||||||
--title "Verstak Browser Extension $VERSION" \
|
--title "Verstak Browser Extension $VERSION" \
|
||||||
--generate-notes \
|
--generate-notes \
|
||||||
--latest \
|
--latest \
|
||||||
--verify-tag
|
--target "$(git rev-parse HEAD)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "GitHub release:"
|
echo "GitHub release:"
|
||||||
"$GH_BIN" release view "$TAG" --repo "$REPOSITORY" --json url --jq .url
|
gh release view "$TAG" --repo "$REPOSITORY" --json url --jq .url
|
||||||
|
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
||||||
VERSION="$(node -p "require('$ROOT/package.json').version")"
|
|
||||||
|
|
||||||
if [[ $# -gt 1 || ( $# -eq 1 && "$1" != "v$VERSION" && "$1" != "$VERSION" ) ]]; then
|
|
||||||
echo "usage: $0 [v$VERSION]" >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec "$ROOT/scripts/publish-firefox-github-release.sh"
|
|
||||||
|
|
@ -2,32 +2,27 @@
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const release = require('./firefox-github-release');
|
const release = require('./firefox-github-release');
|
||||||
const packageManifest = require('../package.json');
|
|
||||||
const chromiumManifest = require('../chromium/manifest.json');
|
|
||||||
const firefoxManifest = require('../firefox/manifest.json');
|
|
||||||
|
|
||||||
const version = '2.0.4';
|
const version = '2.0.2';
|
||||||
const asset = 'verstak-firefox-2.0.4.xpi';
|
const asset = 'verstak-firefox-2.0.2.xpi';
|
||||||
|
|
||||||
assert.equal(packageManifest.version, version);
|
assert.equal(release.releaseTag(version), 'v2.0.2');
|
||||||
assert.equal(chromiumManifest.version, version);
|
|
||||||
assert.equal(firefoxManifest.version, version);
|
|
||||||
assert.equal(release.releaseTag(version), 'v2.0.4');
|
|
||||||
assert.equal(
|
assert.equal(
|
||||||
release.releaseAssetURL(version, asset),
|
release.releaseAssetURL(version, asset),
|
||||||
'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.4/verstak-firefox-2.0.4.xpi',
|
'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.2/verstak-firefox-2.0.2.xpi',
|
||||||
);
|
);
|
||||||
assert.deepEqual(release.updateManifest('verstak-bridge@verstak.app', version, asset), {
|
assert.deepEqual(release.updateManifest('verstak-bridge@verstak.app', version, asset), {
|
||||||
addons: {
|
addons: {
|
||||||
'verstak-bridge@verstak.app': {
|
'verstak-bridge@verstak.app': {
|
||||||
updates: [{
|
updates: [{
|
||||||
version: '2.0.4',
|
version: '2.0.2',
|
||||||
update_link: 'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.4/verstak-firefox-2.0.4.xpi',
|
update_link: 'https://github.com/mirivlad/verstak-browser-extension/releases/download/v2.0.2/verstak-firefox-2.0.2.xpi',
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const firefoxManifest = require('../firefox/manifest.json');
|
||||||
assert.equal(firefoxManifest.homepage_url, 'https://github.com/mirivlad/verstak-browser-extension');
|
assert.equal(firefoxManifest.homepage_url, 'https://github.com/mirivlad/verstak-browser-extension');
|
||||||
assert.equal(
|
assert.equal(
|
||||||
firefoxManifest.browser_specific_settings.gecko.update_url,
|
firefoxManifest.browser_specific_settings.gecko.update_url,
|
||||||
|
|
@ -35,16 +30,10 @@ assert.equal(
|
||||||
);
|
);
|
||||||
|
|
||||||
const publisher = fs.readFileSync('scripts/publish-firefox-github-release.sh', 'utf8');
|
const publisher = fs.readFileSync('scripts/publish-firefox-github-release.sh', 'utf8');
|
||||||
assert.match(publisher, /auth status/);
|
assert.match(publisher, /gh auth status/);
|
||||||
assert.match(publisher, /branch --show-current/);
|
assert.match(publisher, /gh release create/);
|
||||||
assert.match(publisher, /tag -a/);
|
assert.match(publisher, /gh release upload/);
|
||||||
assert.match(publisher, /push origin/);
|
|
||||||
assert.match(publisher, /release create/);
|
|
||||||
assert.match(publisher, /release upload/);
|
|
||||||
assert.match(publisher, /--clobber/);
|
assert.match(publisher, /--clobber/);
|
||||||
assert.match(publisher, /--latest/);
|
assert.match(publisher, /--latest/);
|
||||||
|
|
||||||
const genericPublisher = fs.readFileSync('scripts/publish-github-release.sh', 'utf8');
|
|
||||||
assert.match(genericPublisher, /publish-firefox-github-release\.sh/);
|
|
||||||
|
|
||||||
console.log('Firefox GitHub release metadata tests passed');
|
console.log('Firefox GitHub release metadata tests passed');
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ assert.ok(Object.values(ru).every((value) => typeof value === 'string'));
|
||||||
const tEn = i18n.createTranslator({ en, ru }, 'en');
|
const tEn = i18n.createTranslator({ en, ru }, 'en');
|
||||||
const tRu = i18n.createTranslator({ en, ru }, 'ru');
|
const tRu = i18n.createTranslator({ en, ru }, 'ru');
|
||||||
assert.strictEqual(tRu('status.queued'), 'В очереди до запуска Верстака');
|
assert.strictEqual(tRu('status.queued'), 'В очереди до запуска Верстака');
|
||||||
assert.strictEqual(tEn('error.sendCapture'), 'Could not send the capture. Please try again.');
|
assert.strictEqual(tEn('error.value', { error: 'offline' }), 'Error: offline');
|
||||||
assert.strictEqual(tRu('missing', null, 'Fallback'), 'Fallback');
|
assert.strictEqual(tRu('missing', null, 'Fallback'), 'Fallback');
|
||||||
assert.strictEqual(tRu('missing.key'), 'missing.key');
|
assert.strictEqual(tRu('missing.key'), 'missing.key');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
const assert = require('assert');
|
|
||||||
const fs = require('fs');
|
|
||||||
const path = require('path');
|
|
||||||
|
|
||||||
const css = fs.readFileSync(path.join(__dirname, '..', 'shared', 'popup', 'popup.css'), 'utf8');
|
|
||||||
|
|
||||||
assert.match(css, /select\s*\{[^}]*appearance:\s*none/, 'popup select must hide the native arrow');
|
|
||||||
assert.match(css, /select option\s*\{[^}]*background/, 'popup options must use the extension surface');
|
|
||||||
|
|
||||||
console.log('browser extension popup select style test passed');
|
|
||||||
|
|
@ -65,8 +65,6 @@ const elements = {};
|
||||||
});
|
});
|
||||||
|
|
||||||
let savedSettings = null;
|
let savedSettings = null;
|
||||||
let nextRequestError = null;
|
|
||||||
const technicalWarnings = [];
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
settings: {
|
settings: {
|
||||||
receiverUrl: 'http://127.0.0.1:47731/api/browser-inbox/v1/captures',
|
receiverUrl: 'http://127.0.0.1:47731/api/browser-inbox/v1/captures',
|
||||||
|
|
@ -82,11 +80,6 @@ const browser = {
|
||||||
runtime: {
|
runtime: {
|
||||||
getURL(relativePath) { return `extension://${relativePath}`; },
|
getURL(relativePath) { return `extension://${relativePath}`; },
|
||||||
sendMessage(message) {
|
sendMessage(message) {
|
||||||
if (nextRequestError) {
|
|
||||||
const error = nextRequestError;
|
|
||||||
nextRequestError = null;
|
|
||||||
return Promise.reject(new Error(error));
|
|
||||||
}
|
|
||||||
if (message.action === 'getState') return Promise.resolve(initialState);
|
if (message.action === 'getState') return Promise.resolve(initialState);
|
||||||
if (message.action === 'saveSettings') {
|
if (message.action === 'saveSettings') {
|
||||||
savedSettings = message.settings;
|
savedSettings = message.settings;
|
||||||
|
|
@ -114,24 +107,10 @@ function fetchCatalog(url) {
|
||||||
}
|
}
|
||||||
const i18nPath = path.join(__dirname, '..', 'shared', 'i18n.js');
|
const i18nPath = path.join(__dirname, '..', 'shared', 'i18n.js');
|
||||||
const popupPath = path.join(__dirname, '..', 'shared', 'popup', 'popup.js');
|
const popupPath = path.join(__dirname, '..', 'shared', 'popup', 'popup.js');
|
||||||
const popupSource = fs.readFileSync(popupPath, 'utf8');
|
const context = vm.createContext({ browser, console, document, Promise, btoa, fetch: fetchCatalog, navigator: { language: 'en-US' } });
|
||||||
assert.equal(/setStatus\(\s*(?:error\b|err\b|String\()/.test(popupSource), false);
|
|
||||||
const context = vm.createContext({
|
|
||||||
browser,
|
|
||||||
console: {
|
|
||||||
error: console.error,
|
|
||||||
log: console.log,
|
|
||||||
warn(...args) { technicalWarnings.push(args.map(String).join(' ')); },
|
|
||||||
},
|
|
||||||
document,
|
|
||||||
Promise,
|
|
||||||
btoa,
|
|
||||||
fetch: fetchCatalog,
|
|
||||||
navigator: { language: 'en-US' },
|
|
||||||
});
|
|
||||||
context.globalThis = context;
|
context.globalThis = context;
|
||||||
vm.runInContext(fs.readFileSync(i18nPath, 'utf8'), context, { filename: i18nPath });
|
vm.runInContext(fs.readFileSync(i18nPath, 'utf8'), context, { filename: i18nPath });
|
||||||
vm.runInContext(popupSource, context, { filename: popupPath });
|
vm.runInContext(fs.readFileSync(popupPath, 'utf8'), context, { filename: popupPath });
|
||||||
|
|
||||||
async function flush() {
|
async function flush() {
|
||||||
for (let i = 0; i < 16; i += 1) await Promise.resolve();
|
for (let i = 0; i < 16; i += 1) await Promise.resolve();
|
||||||
|
|
@ -177,14 +156,6 @@ async function flush() {
|
||||||
assert.strictEqual(savedSettings.language, 'en');
|
assert.strictEqual(savedSettings.language, 'en');
|
||||||
assert.strictEqual(savedSettings.passiveActivityEnabled, true);
|
assert.strictEqual(savedSettings.passiveActivityEnabled, true);
|
||||||
assert.deepStrictEqual(Array.from(savedSettings.passiveActivityExcludedDomains), ['youtube.com', 'x.com']);
|
assert.deepStrictEqual(Array.from(savedSettings.passiveActivityExcludedDomains), ['youtube.com', 'x.com']);
|
||||||
|
|
||||||
nextRequestError = '[plugin:verstak.browser-inbox] captures.create failed: receiver unavailable';
|
|
||||||
elements['capture-page'].click();
|
|
||||||
await flush();
|
|
||||||
assert.strictEqual(elements.status.textContent, 'Could not send the capture. Please try again.');
|
|
||||||
assert.equal(elements.status.textContent.includes('[plugin:'), false);
|
|
||||||
assert.ok(technicalWarnings.some((message) => message.includes('captures.create failed')));
|
|
||||||
|
|
||||||
console.log('browser extension popup localization/settings tests passed');
|
console.log('browser extension popup localization/settings tests passed');
|
||||||
})().catch((error) => {
|
})().catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
"$id": "https://raw.githubusercontent.com/mirivlad/verstak-sdk/main/schemas/hostname-normalization-v1.json",
|
"$id": "https://git.mirv.top/verstak/verstak-sdk/schemas/hostname-normalization-v1.json",
|
||||||
"title": "Verstak canonical hostname normalization v1 test vectors",
|
"title": "Verstak canonical hostname normalization v1 test vectors",
|
||||||
"description": "Canonical hostnames are lowercase ASCII A-labels without a port or trailing DNS dot. Bare hostnames accept DNS names, IPv4, bracketed IPv6, localhost, and internal single-label names. URL inputs accept only HTTP(S). Invalid or excessively long input normalizes to an empty string.",
|
"description": "Canonical hostnames are lowercase ASCII A-labels without a port or trailing DNS dot. Bare hostnames accept DNS names, IPv4, bracketed IPv6, localhost, and internal single-label names. URL inputs accept only HTTP(S). Invalid or excessively long input normalizes to an empty string.",
|
||||||
"version": 1,
|
"version": 1,
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,7 @@
|
||||||
"error.chooseFile": "Choose a file first",
|
"error.chooseFile": "Choose a file first",
|
||||||
"error.fileTooLarge": "File is too large for browser capture",
|
"error.fileTooLarge": "File is too large for browser capture",
|
||||||
"error.invalidReceiverUrl": "Receiver URL must start with http:// or https://",
|
"error.invalidReceiverUrl": "Receiver URL must start with http:// or https://",
|
||||||
"error.loadState": "Could not load the extension state. Please try again.",
|
"error.value": "Error: {error}",
|
||||||
"error.saveSettings": "Could not save settings. Please try again.",
|
|
||||||
"error.sendCapture": "Could not send the capture. Please try again.",
|
|
||||||
"error.readFile": "Could not read the file. Choose it again.",
|
|
||||||
"context.sendPage": "Send page to Verstak",
|
"context.sendPage": "Send page to Verstak",
|
||||||
"context.sendSelection": "Send selection to Verstak",
|
"context.sendSelection": "Send selection to Verstak",
|
||||||
"context.sendLink": "Send link to Verstak"
|
"context.sendLink": "Send link to Verstak"
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,7 @@
|
||||||
"error.chooseFile": "Сначала выберите файл",
|
"error.chooseFile": "Сначала выберите файл",
|
||||||
"error.fileTooLarge": "Файл слишком велик для отправки из браузера",
|
"error.fileTooLarge": "Файл слишком велик для отправки из браузера",
|
||||||
"error.invalidReceiverUrl": "URL приёмника должен начинаться с http:// или https://",
|
"error.invalidReceiverUrl": "URL приёмника должен начинаться с http:// или https://",
|
||||||
"error.loadState": "Не удалось загрузить данные расширения. Повторите попытку.",
|
"error.value": "Ошибка: {error}",
|
||||||
"error.saveSettings": "Не удалось сохранить настройки. Повторите попытку.",
|
|
||||||
"error.sendCapture": "Не удалось отправить материал. Повторите попытку.",
|
|
||||||
"error.readFile": "Не удалось прочитать файл. Выберите его ещё раз.",
|
|
||||||
"context.sendPage": "Отправить страницу в Верстак",
|
"context.sendPage": "Отправить страницу в Верстак",
|
||||||
"context.sendSelection": "Отправить выделение в Верстак",
|
"context.sendSelection": "Отправить выделение в Верстак",
|
||||||
"context.sendLink": "Отправить ссылку в Верстак"
|
"context.sendLink": "Отправить ссылку в Верстак"
|
||||||
|
|
|
||||||
|
|
@ -145,17 +145,7 @@ select {
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
border: 1px solid #374151;
|
border: 1px solid #374151;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 7px 30px 7px 8px;
|
padding: 7px 8px;
|
||||||
appearance: none;
|
|
||||||
background-color: #0f172a;
|
|
||||||
background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
|
|
||||||
background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
|
|
||||||
background-size: 5px 5px, 5px 5px;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
color: #e5e7eb;
|
|
||||||
}
|
|
||||||
|
|
||||||
select option {
|
|
||||||
background: #0f172a;
|
background: #0f172a;
|
||||||
color: #e5e7eb;
|
color: #e5e7eb;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,11 +118,6 @@
|
||||||
statusEl.textContent = text;
|
statusEl.textContent = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reportError(key, fallback, error) {
|
|
||||||
console.warn('[verstak.popup] request failed:', error);
|
|
||||||
setStatus(t(key, null, fallback));
|
|
||||||
}
|
|
||||||
|
|
||||||
function request(message) {
|
function request(message) {
|
||||||
return Promise.resolve(ext.runtime.sendMessage(message)).then(function (result) {
|
return Promise.resolve(ext.runtime.sendMessage(message)).then(function (result) {
|
||||||
if (result && result.error) throw new Error(result.error);
|
if (result && result.error) throw new Error(result.error);
|
||||||
|
|
@ -153,7 +148,7 @@
|
||||||
applyLocale(state.settings && state.settings.language || 'system');
|
applyLocale(state.settings && state.settings.language || 'system');
|
||||||
return state;
|
return state;
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
reportError('error.loadState', 'Could not load the extension state. Please try again.', error);
|
setStatus(error && error.message ? error.message : String(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -179,7 +174,7 @@
|
||||||
if (successMessage) setStatus(t('status.saved', null, 'Saved'));
|
if (successMessage) setStatus(t('status.saved', null, 'Saved'));
|
||||||
return state;
|
return state;
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
reportError('error.saveSettings', 'Could not save settings. Please try again.', error);
|
setStatus(error && error.message ? error.message : String(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,7 +188,7 @@
|
||||||
setStatus(t('status.done', null, 'Done'));
|
setStatus(t('status.done', null, 'Done'));
|
||||||
}
|
}
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
reportError('error.sendCapture', 'Could not send the capture. Please try again.', error);
|
setStatus(error && error.message ? error.message : String(error));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,7 +218,7 @@
|
||||||
fileDataBase64: arrayBufferToBase64(results[0])
|
fileDataBase64: arrayBufferToBase64(results[0])
|
||||||
});
|
});
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
reportError('error.readFile', 'Could not read the file. Choose it again.', error);
|
setStatus(error && error.message ? error.message : String(error));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue