Compare commits

..
1 Commits
Author SHA1 Message Date
kfj001 c2659dcb1d ci: make release step idempotent + fix Gitea asset upload
CI / test (pull_request) Successful in 5m45s
- resolve-or-create the release by tag to avoid the 409 'Release is has no Tag'
  when a release already exists for the tag (e.g. one made manually in the UI)
- use POST /releases/{id}/assets with multipart field 'attachment'
  (was the obsolete /_attachments route with field 'file')
2026-08-31 00:31:40 -07:00
6 changed files with 16 additions and 99 deletions

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ on:
jobs: jobs:
test: test:
runs-on: ubuntu-24.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
+1 -1
View File
@@ -7,7 +7,7 @@ on:
jobs: jobs:
release: release:
runs-on: ubuntu-24.04 runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
+10 -75
View File
@@ -130,26 +130,16 @@ function installPopupDom() {
}; };
} }
async function mountPopupWithStorage(storageGet = async () => ({}), captureWrite = null) { async function mountPopup() {
const { dom, cleanup } = installPopupDom(); const { dom, cleanup } = installPopupDom();
// Override the chrome.storage.local stub so we can seed a value and capture writes.
const writes = [];
globalThis.chrome.storage.local.get = async (...args) => {
const res = await storageGet(...args);
return res;
};
globalThis.chrome.storage.local.set = async (items) => {
if (captureWrite) captureWrite(items); else writes.push(items);
};
const moduleUrl = new URL('../src/viewer/index.js?test=' + Date.now(), import.meta.url); const moduleUrl = new URL('../src/viewer/index.js?test=' + Date.now(), import.meta.url);
await import(moduleUrl.href); await import(moduleUrl.href);
const flush = () => new Promise((resolve) => setTimeout(resolve, 0)); return { dom, cleanup };
return { dom, cleanup, writes, flush };
} }
describe('Viewer popup instructions', () => { describe('Viewer popup instructions', () => {
it('renders the drafted instructions copy on mount with accessible labeling', async () => { it('renders the drafted instructions copy on mount with accessible labeling', async () => {
const { dom, cleanup } = await mountPopupWithStorage(); const { dom, cleanup } = await mountPopup();
try { try {
const doc = dom.window.document; const doc = dom.window.document;
const region = doc.querySelector('.instructions-panel'); const region = doc.querySelector('.instructions-panel');
@@ -190,7 +180,7 @@ describe('Viewer popup instructions', () => {
}); });
it('toggles the instructions panel open and closed', async () => { it('toggles the instructions panel open and closed', async () => {
const { dom, cleanup } = await mountPopupWithStorage(); const { dom, cleanup } = await mountPopup();
try { try {
const doc = dom.window.document; const doc = dom.window.document;
const toggle = doc.getElementById('instructions-toggle'); const toggle = doc.getElementById('instructions-toggle');
@@ -204,66 +194,11 @@ describe('Viewer popup instructions', () => {
if (toggle.textContent !== 'Show instructions') throw new Error('Collapsed label should switch to Show instructions'); if (toggle.textContent !== 'Show instructions') throw new Error('Collapsed label should switch to Show instructions');
toggle.click(); toggle.click();
if (toggle.getAttribute('aria-expanded') !== 'true') throw new Error('Toggle should expand the instructions'); if (toggle.getAttribute('aria-expanded') !== 'true') throw new Error('Toggle should expand the instructions');
if (body.hidden) throw new Error('Instructions body should be visible after expanding'); if (body.hidden) throw new Error('Instructions body should be visible after expanding');
if (toggle.textContent !== 'Hide instructions') throw new Error('Expanded label should switch back to Hide instructions'); if (toggle.textContent !== 'Hide instructions') throw new Error('Expanded label should switch back to Hide instructions');
} finally { } finally {
cleanup(); cleanup();
} }
}); });
it('honors a stored hidden state on mount', async () => {
const { dom, cleanup } = await mountPopupWithStorage(
async () => ({ goon_instructions_visible: false })
);
try {
const doc = dom.window.document;
const toggle = doc.getElementById('instructions-toggle');
const body = doc.getElementById('instructions-body');
// Wait for the async storage.get() to resolve and apply.
await new Promise((r) => setTimeout(r, 0));
if (toggle.getAttribute('aria-expanded') !== 'false') throw new Error('Stored hidden state should start collapsed');
if (!body.hidden) throw new Error('Stored hidden state should start hidden');
if (toggle.textContent !== 'Show instructions') throw new Error('Stored hidden state should show the "Show instructions" label');
} finally {
cleanup();
}
});
it('persists the new visibility on every user toggle', async () => {
let written = null;
const { dom, cleanup, flush } = await mountPopupWithStorage(
async () => ({}),
(items) => { written = items; }
);
try {
const doc = dom.window.document;
const toggle = doc.getElementById('instructions-toggle');
// Collapse -> must persist false.
toggle.click();
await flush();
if (written === null) throw new Error('Collapsing the panel must write to chrome.storage.local');
if (written.goon_instructions_visible !== false) throw new Error('Collapsing must persist goon_instructions_visible=false');
// Expand -> must persist true.
toggle.click();
await flush();
if (written.goon_instructions_visible !== true) throw new Error('Expanding must persist goon_instructions_visible=true');
} finally {
cleanup();
}
});
it('defaults a first-time user (no stored key) to shown', async () => {
const { dom, cleanup } = await mountPopupWithStorage(async () => ({}));
try {
const doc = dom.window.document;
const toggle = doc.getElementById('instructions-toggle');
const body = doc.getElementById('instructions-body');
await new Promise((r) => setTimeout(r, 0));
if (toggle.getAttribute('aria-expanded') !== 'true') throw new Error('First-time user should start expanded');
if (body.hidden) throw new Error('First-time instructions body should be visible on mount');
} finally {
cleanup();
}
});
}); });
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "VidPlex", "name": "VidPlex",
"version": "0.2.0", "version": "0.1.1",
"description": "Find videos on any page and view them in a grid.", "description": "Find videos on any page and view them in a grid.",
"permissions": [ "permissions": [
"storage", "storage",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "vidplex", "name": "vidplex",
"version": "0.2.0", "version": "0.1.1",
"private": true, "private": true,
"description": "Chrome extension: find videos on a page and view them in a grid.", "description": "Chrome extension: find videos on a page and view them in a grid.",
"type": "module", "type": "module",
+2 -20
View File
@@ -6,11 +6,6 @@
const STORAGE_KEY = 'goon_videos'; const STORAGE_KEY = 'goon_videos';
const TAGGED_KEY = 'goon_tagged'; const TAGGED_KEY = 'goon_tagged';
// Durable "hide instructions" toggle. Absent key === SHOWN (true), matching the
// first-time "expanded on mount" behavior. chrome.storage.local is extension-wide,
// so the viewer window and every popup instance read/write the same value — the
// preference is respected application-wide and survives reloads / SW termination.
const INSTRUCTIONS_VISIBLE_KEY = 'goon_instructions_visible';
// Set to true to enable verbose console output in the popup. // Set to true to enable verbose console output in the popup.
const DEBUG = true; // TEMP: enabled for debugging — revert to false when done const DEBUG = true; // TEMP: enabled for debugging — revert to false when done
@@ -53,22 +48,9 @@ function setInstructionsExpanded(expanded) {
} }
if (instructionsToggle && instructionsBody) { if (instructionsToggle && instructionsBody) {
// On mount, read the stored visibility. An absent key means SHOWN (true), so a setInstructionsExpanded(true);
// first-time user still sees the steps. The viewer window reads the same
// extension-wide key, so the choice is respected across the whole app.
chrome.storage.local.get(INSTRUCTIONS_VISIBLE_KEY).then(stored => {
const visible = stored[INSTRUCTIONS_VISIBLE_KEY];
setInstructionsExpanded(visible === undefined ? true : visible);
}).catch(() => {
// Any read failure falls back to shown.
setInstructionsExpanded(true);
});
// On every user toggle, apply in-DOM and persist. Both directions write, so
// the state survives reloads and SW termination until the user flips it again.
instructionsToggle.addEventListener('click', () => { instructionsToggle.addEventListener('click', () => {
const next = instructionsBody.hidden; setInstructionsExpanded(instructionsBody.hidden);
setInstructionsExpanded(next);
chrome.storage.local.set({ [INSTRUCTIONS_VISIBLE_KEY]: next });
}); });
} }