From 16b0bf6a5346c61cfccc30533deed65d9686176c Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 18:46:08 +0300 Subject: [PATCH 01/10] Update sources.json --- plugins/multisrc/lightnovelwp/sources.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/multisrc/lightnovelwp/sources.json b/plugins/multisrc/lightnovelwp/sources.json index 630aee1f3..624b84dbf 100644 --- a/plugins/multisrc/lightnovelwp/sources.json +++ b/plugins/multisrc/lightnovelwp/sources.json @@ -69,7 +69,7 @@ }, { "id": "novelsparadise", - "sourceSite": "https://novelsparadise.site/", + "sourceSite": "https://novelsparadise.site/np-light/" "sourceName": "Novels Paradise", "options": { "lang": "Arabic", From 1fb27185ea9a4ee7c32624f624a2f26c28cee79c Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 19:02:41 +0300 Subject: [PATCH 02/10] Update publish-plugins.yml --- .github/workflows/publish-plugins.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-plugins.yml b/.github/workflows/publish-plugins.yml index 279c89b07..43d6a0119 100644 --- a/.github/workflows/publish-plugins.yml +++ b/.github/workflows/publish-plugins.yml @@ -1,6 +1,7 @@ name: Publish Plugins on: + workflow_dispatch: push: branches: - master From 72adc1eab3b40193461304261e8ebb0c492395fe Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 18:56:46 +0000 Subject: [PATCH 03/10] Update galaxynovels.ts --- plugins/arabic/galaxynovels.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/arabic/galaxynovels.ts b/plugins/arabic/galaxynovels.ts index 155c1dae7..8beaa9103 100644 --- a/plugins/arabic/galaxynovels.ts +++ b/plugins/arabic/galaxynovels.ts @@ -160,12 +160,16 @@ class GalaxyNovels implements Plugin.PluginBase { : `${this.baseUrl}${chaptersIndexUrl}`; const index = await this.fetchJson(indexUrl); - chapters = index.chapters.map(ch => ({ - name: ch.label + (ch.title ? `: ${ch.title}` : ''), - path: `${novelPath}chapter-${ch.id}/`, - chapterNumber: ch.position, - releaseTime: ch.date_iso?.split('T')[0] || '', - })); + chapters = index.chapters.map(ch => { + const chapterUrl = new URL(ch.url, this.baseUrl); + + return { + name: ch.label + (ch.title ? `: ${ch.title}` : ''), + path: chapterUrl.pathname + chapterUrl.search, + chapterNumber: ch.position, + releaseTime: ch.date_iso?.split('T')[0] || '', + }; +}); } catch { // fallback to HTML parsing } @@ -225,8 +229,8 @@ class GalaxyNovels implements Plugin.PluginBase { } } - const url = `${this.baseUrl}${chapterPath}`; - const html = await this.fetchHtml(url); + const url = new URL(chapterPath, this.site).toString(); +const html = await this.fetchHtml(url); const $ = loadCheerio(html); const content = $('article.wor-chapter-content, .wor-chapter-text, .entry-content').html(); From e8baf5550d53d0c20794166a1d0bb8ce2f3e4f21 Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 18:59:26 +0000 Subject: [PATCH 04/10] Update galaxynovels.ts --- plugins/arabic/galaxynovels.ts | 142 +++++++++++++++++++++------------ 1 file changed, 91 insertions(+), 51 deletions(-) diff --git a/plugins/arabic/galaxynovels.ts b/plugins/arabic/galaxynovels.ts index 8beaa9103..2bd224b77 100644 --- a/plugins/arabic/galaxynovels.ts +++ b/plugins/arabic/galaxynovels.ts @@ -1,3 +1,4 @@ + import { load as loadCheerio } from 'cheerio'; import { fetchApi } from '@libs/fetch'; import { Plugin } from '@/types/plugin'; @@ -22,18 +23,21 @@ type ChaptersIndex = { }; type ChapterContentResponse = { - schema: number; - data: { - content_html: string; - display_title: string; - navigation: { next_url: string; previous_url: string }; + schema?: number; + data?: { + content_html?: string; + display_title?: string; + navigation?: { + next_url: string; + previous_url: string; + }; }; }; class GalaxyNovels implements Plugin.PluginBase { id = 'galaxynovels'; name = 'Galaxy Novels'; - version = '1.1.0'; + version = '1.1.1'; icon = 'src/ar/galaxynovels/icon.png'; site = 'https://galaxynovels.com/'; @@ -89,6 +93,7 @@ class GalaxyNovels implements Plugin.PluginBase { const period = filters.period.value; let url: string; + if (sort === 'new') { url = `${this.baseUrl}/novels/?sort=new&page=${pageNo}`; } else if (sort === 'recent') { @@ -99,12 +104,11 @@ class GalaxyNovels implements Plugin.PluginBase { const html = await this.fetchHtml(url); const $ = loadCheerio(html); - const novels: Plugin.NovelItem[] = []; + $('article.wor-novel-card').each((_, el) => { const $el = $(el); - const coverLink = $el.find('a.wor-novel-card__cover'); - const href = coverLink.attr('href'); + const href = $el.find('a.wor-novel-card__cover').attr('href'); const img = $el.find('img.wor-cover-img'); const cover = img.attr('data-src') || img.attr('src') || undefined; @@ -125,7 +129,7 @@ class GalaxyNovels implements Plugin.PluginBase { } async parseNovel(novelPath: string): Promise { - const url = `${this.baseUrl}${novelPath}`; + const url = new URL(novelPath, this.site).toString(); const html = await this.fetchHtml(url); const $ = loadCheerio(html); @@ -136,18 +140,20 @@ class GalaxyNovels implements Plugin.PluginBase { const summary = $('.wor-single-summary__text').text().trim(); const genres: string[] = []; + $('a.wor-tag-pill').each((_, el) => { genres.push($(el).text().trim()); }); const statusText = $('span.wor-cover-status').text().trim(); + const statusMap: Record = { 'مستمرة': NovelStatus.Ongoing, 'مكتملة': NovelStatus.Completed, 'متوقفة': NovelStatus.OnHiatus, }; - const status = statusMap[statusText] || NovelStatus.Unknown; + const status = statusMap[statusText] || NovelStatus.Unknown; const chaptersContainer = $('[data-wor-chapters-container]'); const chaptersIndexUrl = chaptersContainer.attr('data-index-url'); @@ -155,46 +161,67 @@ class GalaxyNovels implements Plugin.PluginBase { if (chaptersIndexUrl) { try { - const indexUrl = chaptersIndexUrl.startsWith('http') - ? chaptersIndexUrl - : `${this.baseUrl}${chaptersIndexUrl}`; - const index = await this.fetchJson(indexUrl); + const indexUrl = new URL( + chaptersIndexUrl, + this.site, + ).toString(); - chapters = index.chapters.map(ch => { - const chapterUrl = new URL(ch.url, this.baseUrl); + const index = await this.fetchJson(indexUrl); - return { - name: ch.label + (ch.title ? `: ${ch.title}` : ''), - path: chapterUrl.pathname + chapterUrl.search, - chapterNumber: ch.position, - releaseTime: ch.date_iso?.split('T')[0] || '', - }; -}); + if (Array.isArray(index.chapters)) { + chapters = index.chapters + .filter(ch => ch.url || ch.content_api || ch.id) + .map(ch => { + const chapterUrl = new URL( + ch.url || `chapter-${ch.id}/`, + url, + ); + + return { + name: + ch.label + + (ch.title ? `: ${ch.title}` : ''), + path: chapterUrl.pathname + chapterUrl.search, + chapterNumber: ch.position, + releaseTime: ch.date_iso?.split('T')[0] || '', + }; + }); + } } catch { - // fallback to HTML parsing + // Fall back to chapter links in the HTML. } } if (chapters.length === 0) { $('article.wor-novel-chapter-item').each((_, el) => { const $el = $(el); - const chapterLink = $el.find('h3 a').attr('href') || $el.find('a.wor-novel-chapter-item__num').attr('href'); - const chapterName = $el.find('h3 a').text().trim() || $el.find('a.wor-novel-chapter-item__num').text().trim(); + + const chapterLink = + $el.find('h3 a').attr('href') || + $el.find('a.wor-novel-chapter-item__num').attr('href'); + + const chapterName = + $el.find('h3 a').text().trim() || + $el.find('a.wor-novel-chapter-item__num').text().trim(); + const chapterId = $el.attr('data-chapter-id'); - const timeEl = $el.find('time'); - const releaseTime = timeEl.attr('datetime')?.split('T')[0] || ''; + const releaseTime = + $el.find('time').attr('datetime')?.split('T')[0] || ''; if (!chapterLink) return; - const path = chapterId - ? `${novelPath}chapter-${chapterId}/` - : new URL(chapterLink, this.site).pathname; + const path = new URL(chapterLink, url).pathname; const numMatch = path.match(/chapter-(\d+)/); - const chapterNumber = numMatch ? parseInt(numMatch[1]) : 0; + const chapterNumber = numMatch + ? Number(numMatch[1]) + : 0; chapters.push({ name: chapterName, - path, + path: + chapterId && !numMatch + ? `${path.replace(/\/?$/, '/') }chapter-${chapterId}/` + : path, chapterNumber, releaseTime, }); @@ -214,27 +241,38 @@ class GalaxyNovels implements Plugin.PluginBase { } async parseChapter(chapterPath: string): Promise { - const idMatch = chapterPath.match(/chapter-(\d+)/); + const chapterUrl = new URL(chapterPath, this.site); + const idMatch = chapterUrl.pathname.match(/chapter-(\d+)/); const chapterId = idMatch?.[1]; if (chapterId) { - const apiUrl = `${this.baseUrl}/wp-json/wor-reader-app/v1/chapters/${chapterId}`; + const apiUrl = + `${this.baseUrl}/wp-json/wor-reader-app/v1/chapters/${chapterId}`; + try { - const response = await this.fetchJson(apiUrl); + const response = + await this.fetchJson(apiUrl); + if (response.data?.content_html) { return response.data.content_html; } } catch { - // fallback to HTML + // Fall back to the regular chapter page. } } - const url = new URL(chapterPath, this.site).toString(); -const html = await this.fetchHtml(url); + const html = await this.fetchHtml(chapterUrl.toString()); const $ = loadCheerio(html); - const content = - $('article.wor-chapter-content, .wor-chapter-text, .entry-content').html(); - return content || '

Content not available.

'; + + const content = $( + 'article.wor-chapter-content, .wor-chapter-text, .entry-content', + ).html(); + + if (content) { + return content; + } + + throw new Error('Chapter content was not found on the page.'); } async searchNovels( @@ -242,10 +280,13 @@ const html = await this.fetchHtml(url); pageNo: number, ): Promise { const manifestUrl = - 'https://galaxynovels.com/wp-content/uploads/wor-reader-cache/search/manifest.json'; - const manifest = await this.fetchJson<{ - index: string; - }>(manifestUrl); + `${this.baseUrl}/wp-content/uploads/wor-reader-cache/search/manifest.json`; + + const manifest = await this.fetchJson<{ index: string }>( + manifestUrl, + ); + + const indexUrl = new URL(manifest.index, this.site).toString(); const searchIndex = await this.fetchJson<{ items: { @@ -254,9 +295,10 @@ const html = await this.fetchHtml(url); c: string; s: string; }[]; - }>(manifest.index); + }>(indexUrl); const term = searchTerm.toLowerCase(); + const filtered = searchIndex.items.filter( n => n.t.toLowerCase().includes(term) || @@ -269,9 +311,7 @@ const html = await this.fetchHtml(url); return filtered.slice(offset, offset + limit).map(novel => ({ name: novel.t, path: novel.u, - cover: novel.c.startsWith('http') - ? novel.c - : `${this.baseUrl}${novel.c}`, + cover: new URL(novel.c, this.site).toString(), })); } } From eb8d9074d3e5c4ebd24a6a9d7b1fc217e6088c03 Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 22:12:33 +0300 Subject: [PATCH 05/10] Update galaxynovels.ts --- plugins/arabic/galaxynovels.ts | 150 ++++++++++++++++++--------------- 1 file changed, 83 insertions(+), 67 deletions(-) diff --git a/plugins/arabic/galaxynovels.ts b/plugins/arabic/galaxynovels.ts index 2bd224b77..7e3fa4f9b 100644 --- a/plugins/arabic/galaxynovels.ts +++ b/plugins/arabic/galaxynovels.ts @@ -22,22 +22,10 @@ type ChaptersIndex = { chapters: ChapterJSON[]; }; -type ChapterContentResponse = { - schema?: number; - data?: { - content_html?: string; - display_title?: string; - navigation?: { - next_url: string; - previous_url: string; - }; - }; -}; - class GalaxyNovels implements Plugin.PluginBase { id = 'galaxynovels'; name = 'Galaxy Novels'; - version = '1.1.1'; + version = '1.1.2'; icon = 'src/ar/galaxynovels/icon.png'; site = 'https://galaxynovels.com/'; @@ -110,17 +98,14 @@ class GalaxyNovels implements Plugin.PluginBase { const $el = $(el); const href = $el.find('a.wor-novel-card__cover').attr('href'); const img = $el.find('img.wor-cover-img'); - const cover = - img.attr('data-src') || img.attr('src') || undefined; + const cover = img.attr('data-src') || img.attr('src') || undefined; const title = $el.find('h3 a').text().trim(); if (!href || !title) return; - const path = new URL(href, this.site).pathname; - novels.push({ name: title, - path, + path: new URL(href, this.site).pathname, cover, }); }); @@ -140,17 +125,15 @@ class GalaxyNovels implements Plugin.PluginBase { const summary = $('.wor-single-summary__text').text().trim(); const genres: string[] = []; - $('a.wor-tag-pill').each((_, el) => { genres.push($(el).text().trim()); }); const statusText = $('span.wor-cover-status').text().trim(); - const statusMap: Record = { - 'مستمرة': NovelStatus.Ongoing, - 'مكتملة': NovelStatus.Completed, - 'متوقفة': NovelStatus.OnHiatus, + مستمرة: NovelStatus.Ongoing, + مكتملة: NovelStatus.Completed, + متوقفة: NovelStatus.OnHiatus, }; const status = statusMap[statusText] || NovelStatus.Unknown; @@ -161,11 +144,7 @@ class GalaxyNovels implements Plugin.PluginBase { if (chaptersIndexUrl) { try { - const indexUrl = new URL( - chaptersIndexUrl, - this.site, - ).toString(); - + const indexUrl = new URL(chaptersIndexUrl, this.site).toString(); const index = await this.fetchJson(indexUrl); if (Array.isArray(index.chapters)) { @@ -178,9 +157,7 @@ class GalaxyNovels implements Plugin.PluginBase { ); return { - name: - ch.label + - (ch.title ? `: ${ch.title}` : ''), + name: ch.label + (ch.title ? `: ${ch.title}` : ''), path: chapterUrl.pathname + chapterUrl.search, chapterNumber: ch.position, releaseTime: ch.date_iso?.split('T')[0] || '', @@ -188,41 +165,33 @@ class GalaxyNovels implements Plugin.PluginBase { }); } } catch { - // Fall back to chapter links in the HTML. + // Use the chapter links available in the page. } } if (chapters.length === 0) { $('article.wor-novel-chapter-item').each((_, el) => { const $el = $(el); - - const chapterLink = + const href = $el.find('h3 a').attr('href') || $el.find('a.wor-novel-chapter-item__num').attr('href'); - const chapterName = + const name = $el.find('h3 a').text().trim() || $el.find('a.wor-novel-chapter-item__num').text().trim(); - const chapterId = $el.attr('data-chapter-id'); const releaseTime = $el.find('time').attr('datetime')?.split('T')[0] || ''; - if (!chapterLink) return; + if (!href) return; - const path = new URL(chapterLink, url).pathname; - const numMatch = path.match(/chapter-(\d+)/); - const chapterNumber = numMatch - ? Number(numMatch[1]) - : 0; + const chapterUrl = new URL(href, url); + const match = chapterUrl.pathname.match(/chapter-(\d+)/i); chapters.push({ - name: chapterName, - path: - chapterId && !numMatch - ? `${path.replace(/\/?$/, '/') }chapter-${chapterId}/` - : path, - chapterNumber, + name, + path: chapterUrl.pathname + chapterUrl.search, + chapterNumber: match ? Number(match[1]) : 0, releaseTime, }); }); @@ -242,25 +211,78 @@ class GalaxyNovels implements Plugin.PluginBase { async parseChapter(chapterPath: string): Promise { const chapterUrl = new URL(chapterPath, this.site); - const idMatch = chapterUrl.pathname.match(/chapter-(\d+)/); - const chapterId = idMatch?.[1]; + const chapterMatch = chapterUrl.pathname.match(/chapter-(\d+)/i); + const chapterId = chapterMatch?.[1]; - if (chapterId) { - const apiUrl = - `${this.baseUrl}/wp-json/wor-reader-app/v1/chapters/${chapterId}`; + // Find the chapter's actual content_api in the novel's chapter index. + const novelPath = chapterUrl.pathname.replace( + /\/chapter-\d+\/.*$/i, + '/', + ); + if (chapterId && novelPath !== chapterUrl.pathname) { try { - const response = - await this.fetchJson(apiUrl); - - if (response.data?.content_html) { - return response.data.content_html; + const novelHtml = await this.fetchHtml( + new URL(novelPath, this.site).toString(), + ); + const $novel = loadCheerio(novelHtml); + const indexPath = $novel + .find('[data-wor-chapters-container]') + .attr('data-index-url'); + + if (indexPath) { + const indexUrl = new URL(indexPath, this.site).toString(); + const index = await this.fetchJson(indexUrl); + + const current = index.chapters?.find(ch => { + if (String(ch.id) === chapterId) return true; + if (!ch.url) return false; + + const indexedUrl = new URL(ch.url, this.site); + return indexedUrl.pathname === chapterUrl.pathname; + }); + + if (current?.content_api) { + const contentUrl = new URL( + current.content_api, + this.site, + ).toString(); + + const response = await fetchApi(contentUrl); + + if (response.ok) { + const raw = await response.text(); + + try { + const data = JSON.parse(raw); + const content = + data?.data?.content_html ?? + data?.content_html ?? + data?.data?.content ?? + data?.content; + + if (typeof content === 'string' && content.trim()) { + return content; + } + } catch { + if (raw.trim()) { + const $content = loadCheerio(raw); + const extracted = $content( + 'article.wor-chapter-content, .wor-chapter-text, .entry-content', + ).html(); + + return extracted || raw; + } + } + } + } } } catch { - // Fall back to the regular chapter page. + // Fall back to the public chapter page. } } + // Fallback: load the chapter page using its complete URL. const html = await this.fetchHtml(chapterUrl.toString()); const $ = loadCheerio(html); @@ -268,9 +290,7 @@ class GalaxyNovels implements Plugin.PluginBase { 'article.wor-chapter-content, .wor-chapter-text, .entry-content', ).html(); - if (content) { - return content; - } + if (content) return content; throw new Error('Chapter content was not found on the page.'); } @@ -282,10 +302,7 @@ class GalaxyNovels implements Plugin.PluginBase { const manifestUrl = `${this.baseUrl}/wp-content/uploads/wor-reader-cache/search/manifest.json`; - const manifest = await this.fetchJson<{ index: string }>( - manifestUrl, - ); - + const manifest = await this.fetchJson<{ index: string }>(manifestUrl); const indexUrl = new URL(manifest.index, this.site).toString(); const searchIndex = await this.fetchJson<{ @@ -298,7 +315,6 @@ class GalaxyNovels implements Plugin.PluginBase { }>(indexUrl); const term = searchTerm.toLowerCase(); - const filtered = searchIndex.items.filter( n => n.t.toLowerCase().includes(term) || From 788eb9bb9a23a41f7de3cde71f88cf73cd31ca71 Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 22:37:06 +0300 Subject: [PATCH 06/10] Update publish-plugins.yml --- .github/workflows/publish-plugins.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-plugins.yml b/.github/workflows/publish-plugins.yml index 43d6a0119..de3dcfeb6 100644 --- a/.github/workflows/publish-plugins.yml +++ b/.github/workflows/publish-plugins.yml @@ -1,10 +1,11 @@ + name: Publish Plugins on: workflow_dispatch: push: branches: - - master + - patch-1 paths: - 'plugins/**' - 'public/**' From 74ee3110d75a0e28f53bf76839f1d61fe9e6f47a Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 23:13:10 +0300 Subject: [PATCH 07/10] Update publish-plugins.sh --- scripts/publish-plugins.sh | 145 +++++++++++++++++++++++++------------ 1 file changed, 100 insertions(+), 45 deletions(-) diff --git a/scripts/publish-plugins.sh b/scripts/publish-plugins.sh index fba363c69..ca5045d5f 100755 --- a/scripts/publish-plugins.sh +++ b/scripts/publish-plugins.sh @@ -1,11 +1,14 @@ + #!/bin/bash +set -o pipefail + if [ -z "$GITHUB_STEP_SUMMARY" ]; then GITHUB_STEP_SUMMARY="/dev/stdout" fi -current=`git rev-parse --abbrev-ref HEAD` -version=`node -e "console.log(require('./package.json').version);"` +current=$(git rev-parse --abbrev-ref HEAD) +version=$(node -e "console.log(require('./package.json').version);") dist="plugins/v$version" echo "Publishing plugins: $current -> $dist (v$version)" @@ -13,91 +16,143 @@ echo "Publishing plugins: $current -> $dist (v$version)" if [[ "$1" == "--all-branches" ]]; then rm -rf .dist .js git fetch --all - branches=$(git branch -r | grep -v '\->') - for branch in $branches; do - # Skip branches with different publish-plugins.sh version - if ! diff scripts/publish-plugins.sh <(git show "$branch:scripts/publish-plugins.sh") >/dev/null; then - echo "⚠️ Skipping $branch (script version mismatch)" + + # Process patch-1 last so its plugin builds take precedence + # when the same plugin exists on multiple branches. + mapfile -t branches < <( + git branch -r | + sed 's/^[* ]*//' | + grep -v '\->' | + grep -v '/patch-1$' | + sort + ) + + if git show-ref --verify --quiet refs/remotes/origin/patch-1; then + branches+=("origin/patch-1") + fi + + for branch in "${branches[@]}"; do + # The published branch contains build artifacts, not the + # publishing script, so it is intentionally skipped. + if ! git cat-file -e "$branch:scripts/publish-plugins.sh" 2>/dev/null; then + echo "⚠️ Skipping $branch (publish script not present)" continue fi + + if ! diff -q scripts/publish-plugins.sh \ + <(git show "$branch:scripts/publish-plugins.sh") >/dev/null; then + echo "⚠️ Skipping $branch (script version mismatch)" + continue + fi + echo "::group::Branch $branch" echo "Processing: $branch" - git stash push -a -- .dist .js - git checkout -f $branch - exists=`git show-ref refs/heads/$dist` + + git stash push -a -- .dist .js || exit 1 + git checkout -f "$branch" || exit 1 + + exists=$(git show-ref "refs/heads/$dist") if [ -n "$exists" ]; then - git branch -D $dist + git branch -D "$dist" fi - git stash pop - npm run clean:multisrc - npm run build:multisrc + + git stash pop || { + echo "❌ ERROR: Failed to restore generated files" + exit 1 + } + + npm run clean:multisrc || exit 1 + npm run build:multisrc || exit 1 + echo "Compiling TypeScript..." - npx tsc --project tsconfig.production.json - echo "# $branch" >> $GITHUB_STEP_SUMMARY - BRANCH=$dist npm run build:manifest -- --only-new 2>> $GITHUB_STEP_SUMMARY + npx tsc --project tsconfig.production.json || exit 1 + + echo "# $branch" >> "$GITHUB_STEP_SUMMARY" + + BRANCH="$dist" npm run build:manifest -- --only-new \ + 2>> "$GITHUB_STEP_SUMMARY" || exit 1 + if [ ! -d ".dist" ] || [ -z "$(ls -A .dist)" ]; then echo "❌ ERROR: Manifest generation failed - .dist is missing or empty" exit 1 fi + echo "✅ Done: $branch" echo "::endgroup::" done + echo echo "::group::Publish All Branches" echo "Publishing combined plugins..." - git checkout --orphan $dist - if [ $? -eq 1 ]; then + + git checkout --orphan "$dist" || { echo "❌ ERROR: Failed to create branch $dist" - echo "::endgroup::" exit 1 - fi + } + git reset - # Copy plugins to legacy path (.js/src/plugins) for backward compatibility + echo "Copying .js/plugins -> .js/src/plugins" mkdir -p .js/src - cp -r .js/plugins .js/src/plugins - git add -f public/static .dist .js/src/plugins total.svg - git commit -m "chore: Publish Plugins From All Branches" - git push -f origin $dist - git checkout -f $branch + + if [ -d ".js/plugins" ]; then + cp -r .js/plugins .js/src/plugins + else + echo "❌ ERROR: .js/plugins is missing" + exit 1 + fi + + git add -f public/static .dist .js/src/plugins total.svg || exit 1 + + git commit -m "chore: Publish Plugins From All Branches" || exit 1 + git push -f origin "$dist" || exit 1 + + git checkout -f "$current" || exit 1 + echo "✅ Published all branches to $dist" echo "::endgroup::" exit 0 fi -exists=`git show-ref refs/heads/$dist` - +exists=$(git show-ref "refs/heads/$dist") if [ -n "$exists" ]; then - git branch -D $dist + git branch -D "$dist" fi -git checkout --orphan $dist 2>&1 - -if [ $? -eq 1 ]; then +git checkout --orphan "$dist" || { echo "❌ ERROR: Failed to create branch $dist" exit 1 -fi +} git reset rm -rf .js -npm run clean:multisrc -npm run build:multisrc + +npm run clean:multisrc || exit 1 +npm run build:multisrc || exit 1 + echo "Compiling TypeScript..." -npx tsc --project tsconfig.production.json -npm run build:manifest +npx tsc --project tsconfig.production.json || exit 1 + +npm run build:manifest || exit 1 if [ ! -d ".dist" ] || [ -z "$(ls -A .dist)" ]; then echo "❌ ERROR: Manifest generation failed - .dist is missing or empty" exit 1 fi -# Copy plugins to legacy path (.js/src/plugins) for backward compatibility echo "Copying .js/plugins -> .js/src/plugins" mkdir -p .js/src -cp -r .js/plugins .js/src/plugins -git add -f public/static .dist .js/src/plugins total.svg -git commit -m "chore: Publish Plugins" -git push -f origin $dist 2>&1 -git checkout -f $current 2>&1 -echo "✅ Published to $dist" +if [ -d ".js/plugins" ]; then + cp -r .js/plugins .js/src/plugins +else + echo "❌ ERROR: .js/plugins is missing" + exit 1 +fi + +git add -f public/static .dist .js/src/plugins total.svg || exit 1 +git commit -m "chore: Publish Plugins" || exit 1 +git push -f origin "$dist" || exit 1 + +git checkout -f "$current" || exit 1 +echo "✅ Published to $dist" From 1d7ab1742d96713cefbe27953c618b05565dc63c Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 23:16:42 +0300 Subject: [PATCH 08/10] Update publish-plugins.sh --- scripts/publish-plugins.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/publish-plugins.sh b/scripts/publish-plugins.sh index ca5045d5f..2b415f5ff 100755 --- a/scripts/publish-plugins.sh +++ b/scripts/publish-plugins.sh @@ -1,7 +1,7 @@ #!/bin/bash -set -o pipefail + if [ -z "$GITHUB_STEP_SUMMARY" ]; then GITHUB_STEP_SUMMARY="/dev/stdout" From 1e6bf376e903c4a4a7af1b443f2ebad7c0109bba Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 23:21:21 +0300 Subject: [PATCH 09/10] Update publish-plugins.sh --- scripts/publish-plugins.sh | 114 ++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 59 deletions(-) diff --git a/scripts/publish-plugins.sh b/scripts/publish-plugins.sh index 2b415f5ff..6dd060572 100755 --- a/scripts/publish-plugins.sh +++ b/scripts/publish-plugins.sh @@ -1,12 +1,12 @@ #!/bin/bash - - if [ -z "$GITHUB_STEP_SUMMARY" ]; then GITHUB_STEP_SUMMARY="/dev/stdout" fi +set -e + current=$(git rev-parse --abbrev-ref HEAD) version=$(node -e "console.log(require('./package.json').version);") dist="plugins/v$version" @@ -17,8 +17,7 @@ if [[ "$1" == "--all-branches" ]]; then rm -rf .dist .js git fetch --all - # Process patch-1 last so its plugin builds take precedence - # when the same plugin exists on multiple branches. + # Process compatible source branches, with patch-1 last. mapfile -t branches < <( git branch -r | sed 's/^[* ]*//' | @@ -32,127 +31,124 @@ if [[ "$1" == "--all-branches" ]]; then fi for branch in "${branches[@]}"; do - # The published branch contains build artifacts, not the - # publishing script, so it is intentionally skipped. + # Published branches contain build artifacts, not source scripts. if ! git cat-file -e "$branch:scripts/publish-plugins.sh" 2>/dev/null; then - echo "⚠️ Skipping $branch (publish script not present)" + echo "Skipping $branch (publish script not present)" continue fi if ! diff -q scripts/publish-plugins.sh \ <(git show "$branch:scripts/publish-plugins.sh") >/dev/null; then - echo "⚠️ Skipping $branch (script version mismatch)" + echo "Skipping $branch (script version mismatch)" continue fi echo "::group::Branch $branch" echo "Processing: $branch" - git stash push -a -- .dist .js || exit 1 - git checkout -f "$branch" || exit 1 - - exists=$(git show-ref "refs/heads/$dist") - if [ -n "$exists" ]; then - git branch -D "$dist" - fi - - git stash pop || { - echo "❌ ERROR: Failed to restore generated files" + # Preserve generated files between source branches. + git stash push -a -- .dist .js || { + echo "ERROR: Failed to stash generated files" exit 1 } - npm run clean:multisrc || exit 1 - npm run build:multisrc || exit 1 + git checkout -f "$branch" + + if git stash list -1 | grep -q .; then + git stash pop || { + echo "ERROR: Failed to restore generated files" + exit 1 + } + fi + + npm run clean:multisrc + npm run build:multisrc echo "Compiling TypeScript..." - npx tsc --project tsconfig.production.json || exit 1 + npx tsc --project tsconfig.production.json echo "# $branch" >> "$GITHUB_STEP_SUMMARY" BRANCH="$dist" npm run build:manifest -- --only-new \ - 2>> "$GITHUB_STEP_SUMMARY" || exit 1 + 2>> "$GITHUB_STEP_SUMMARY" if [ ! -d ".dist" ] || [ -z "$(ls -A .dist)" ]; then - echo "❌ ERROR: Manifest generation failed - .dist is missing or empty" + echo "ERROR: Manifest generation failed" exit 1 fi - echo "✅ Done: $branch" + echo "Done: $branch" echo "::endgroup::" done - echo echo "::group::Publish All Branches" echo "Publishing combined plugins..." - git checkout --orphan "$dist" || { - echo "❌ ERROR: Failed to create branch $dist" - exit 1 - } + # Ensure the destination branch can be recreated. + git checkout -f "$current" + + if git show-ref --verify --quiet "refs/heads/$dist"; then + git branch -D "$dist" + fi + git checkout --orphan "$dist" git reset echo "Copying .js/plugins -> .js/src/plugins" mkdir -p .js/src - if [ -d ".js/plugins" ]; then - cp -r .js/plugins .js/src/plugins - else - echo "❌ ERROR: .js/plugins is missing" + if [ ! -d ".js/plugins" ]; then + echo "ERROR: .js/plugins is missing" exit 1 fi - git add -f public/static .dist .js/src/plugins total.svg || exit 1 + cp -r .js/plugins .js/src/plugins - git commit -m "chore: Publish Plugins From All Branches" || exit 1 - git push -f origin "$dist" || exit 1 + git add -f public/static .dist .js/src/plugins total.svg + git commit -m "chore: Publish Plugins From All Branches" + git push -f origin "$dist" - git checkout -f "$current" || exit 1 + git checkout -f "$current" - echo "✅ Published all branches to $dist" + echo "Published all branches to $dist" echo "::endgroup::" exit 0 fi -exists=$(git show-ref "refs/heads/$dist") -if [ -n "$exists" ]; then +if git show-ref --verify --quiet "refs/heads/$dist"; then git branch -D "$dist" fi -git checkout --orphan "$dist" || { - echo "❌ ERROR: Failed to create branch $dist" - exit 1 -} - +git checkout --orphan "$dist" git reset rm -rf .js -npm run clean:multisrc || exit 1 -npm run build:multisrc || exit 1 +npm run clean:multisrc +npm run build:multisrc echo "Compiling TypeScript..." -npx tsc --project tsconfig.production.json || exit 1 +npx tsc --project tsconfig.production.json -npm run build:manifest || exit 1 +npm run build:manifest if [ ! -d ".dist" ] || [ -z "$(ls -A .dist)" ]; then - echo "❌ ERROR: Manifest generation failed - .dist is missing or empty" + echo "ERROR: Manifest generation failed" exit 1 fi echo "Copying .js/plugins -> .js/src/plugins" mkdir -p .js/src -if [ -d ".js/plugins" ]; then - cp -r .js/plugins .js/src/plugins -else - echo "❌ ERROR: .js/plugins is missing" +if [ ! -d ".js/plugins" ]; then + echo "ERROR: .js/plugins is missing" exit 1 fi -git add -f public/static .dist .js/src/plugins total.svg || exit 1 -git commit -m "chore: Publish Plugins" || exit 1 -git push -f origin "$dist" || exit 1 +cp -r .js/plugins .js/src/plugins + +git add -f public/static .dist .js/src/plugins total.svg +git commit -m "chore: Publish Plugins" +git push -f origin "$dist" -git checkout -f "$current" || exit 1 -echo "✅ Published to $dist" +git checkout -f "$current" +echo "Published to $dist" From f5632e4ba1853eab9fd655751d8879cb3b13cc47 Mon Sep 17 00:00:00 2001 From: ibrahimsif6-netizen Date: Sat, 17 Oct 2026 23:24:52 +0300 Subject: [PATCH 10/10] Update publish-plugins.sh --- scripts/publish-plugins.sh | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/scripts/publish-plugins.sh b/scripts/publish-plugins.sh index 6dd060572..910257a66 100755 --- a/scripts/publish-plugins.sh +++ b/scripts/publish-plugins.sh @@ -1,5 +1,5 @@ -#!/bin/bash +#!/bin/sh if [ -z "$GITHUB_STEP_SUMMARY" ]; then GITHUB_STEP_SUMMARY="/dev/stdout" @@ -13,52 +13,50 @@ dist="plugins/v$version" echo "Publishing plugins: $current -> $dist (v$version)" -if [[ "$1" == "--all-branches" ]]; then +if [ "$1" = "--all-branches" ]; then rm -rf .dist .js git fetch --all - # Process compatible source branches, with patch-1 last. - mapfile -t branches < <( + # Process patch-1 last so its plugin builds take precedence. + branches=$( git branch -r | sed 's/^[* ]*//' | grep -v '\->' | grep -v '/patch-1$' | - sort + sort || true ) if git show-ref --verify --quiet refs/remotes/origin/patch-1; then - branches+=("origin/patch-1") + branches="${branches} +origin/patch-1" fi - for branch in "${branches[@]}"; do - # Published branches contain build artifacts, not source scripts. + for branch in $branches; do + # Skip branches without the publishing script. if ! git cat-file -e "$branch:scripts/publish-plugins.sh" 2>/dev/null; then echo "Skipping $branch (publish script not present)" continue fi - if ! diff -q scripts/publish-plugins.sh \ - <(git show "$branch:scripts/publish-plugins.sh") >/dev/null; then + tmp_script=$(mktemp) + git show "$branch:scripts/publish-plugins.sh" > "$tmp_script" + + if ! diff -q scripts/publish-plugins.sh "$tmp_script" >/dev/null 2>&1; then + rm -f "$tmp_script" echo "Skipping $branch (script version mismatch)" continue fi + rm -f "$tmp_script" echo "::group::Branch $branch" echo "Processing: $branch" - # Preserve generated files between source branches. - git stash push -a -- .dist .js || { - echo "ERROR: Failed to stash generated files" - exit 1 - } + git stash push -a -- .dist .js git checkout -f "$branch" if git stash list -1 | grep -q .; then - git stash pop || { - echo "ERROR: Failed to restore generated files" - exit 1 - } + git stash pop fi npm run clean:multisrc @@ -84,7 +82,6 @@ if [[ "$1" == "--all-branches" ]]; then echo "::group::Publish All Branches" echo "Publishing combined plugins..." - # Ensure the destination branch can be recreated. git checkout -f "$current" if git show-ref --verify --quiet "refs/heads/$dist"; then