diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5c47fad6..eab57bc1 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -2,7 +2,7 @@ name: Pages – aggregate all branches on: push: - branches: ['**'] + branches: ['main', 'dev'] workflow_dispatch: permissions: @@ -33,6 +33,17 @@ jobs: node-version: '18' cache: 'npm' + - uses: actions/cache@v4 + with: + path: | + node_modules + public/production + key: ${{ runner.os }}-cd-${{ hashFiles('**/package-lock.json') }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-cd-${{ hashFiles('**/package-lock.json') }}-${{ github.ref_name }}- + ${{ runner.os }}-cd-${{ hashFiles('**/package-lock.json') }}- + ${{ runner.os }}-cd- + - name: Install dependencies run: npm ci @@ -88,17 +99,142 @@ jobs: - Branches + WPlace AutoBOT - Branches -

Branches

- +

🚀WPlace AutoBOT

+
Branch File Browser
+
HTML @@ -113,13 +249,13 @@ jobs: echo "" echo "" echo "" - echo "${title}" - echo "" - echo "

${title}

" + echo "WPlace AutoBOT - ${title}" + echo "" + echo "

🚀 ${title}

" if [[ "$DIR" != "$ROOT" ]]; then - echo "

⬆ UpAll branches

" + echo "" else - echo "

All branches

" + echo "" fi echo "" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 448d18c4..c2f9d839 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,10 @@ name: CI on: push: - branches: [main, hotfix/**, feature/**] + branches: [main, dev, '**'] pull_request: - branches: [main, dev] + branches: [main, dev, '**'] + workflow_dispatch: jobs: ci: @@ -17,6 +18,16 @@ jobs: node-version: '18' cache: 'npm' + - uses: actions/cache@v4 + with: + path: | + node_modules + dist + key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}- + ${{ runner.os }}-build- + - run: npm ci - name: Format check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69262f63..7ee9968d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,7 @@ name: Auto Release on: push: branches: [main] + workflow_dispatch: permissions: contents: write @@ -18,6 +19,16 @@ jobs: node-version: '18' cache: 'npm' + - uses: actions/cache@v4 + with: + path: | + node_modules + dist + key: ${{ runner.os }}-release-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-release-${{ hashFiles('**/package-lock.json') }}- + ${{ runner.os }}-release- + - name: Install dependencies run: | echo "📦 Installing dependencies..." diff --git a/package.json b/package.json index b2aed732..68630a34 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "format:check": "prettier --ignore-path .gitignore --ignore-path .prettierignore --ignore-unknown --check .", "clean": "rm -rf dist/*", "docs:generate": "node scripts/generate-docs.js", - "docs:watch": "node scripts/watch-docs.js" + "docs:watch": "node scripts/watch-docs.js", + "ci": "npm run format:check && npm run build:all" }, "devDependencies": { "@eslint/js": "^9.34.0", diff --git a/scripts/esbuild.config.js b/scripts/esbuild.config.js index ee37875a..ec86d779 100644 --- a/scripts/esbuild.config.js +++ b/scripts/esbuild.config.js @@ -147,6 +147,8 @@ const buildInfoPlugin = buildTarget => ({ lastCommitMessage = execSync('git log -1 --pretty=%s', { encoding: 'utf8', }).trim(); + // Escape backticks for template literal safety + lastCommitMessage = lastCommitMessage.replace(/`/g, '\\`'); // Truncate long commit messages if (lastCommitMessage.length > 50) { lastCommitMessage = diff --git a/src/wplace-bot-manager.user.js b/scripts/wplace-bot-manager.user.js similarity index 83% rename from src/wplace-bot-manager.user.js rename to scripts/wplace-bot-manager.user.js index 8a287a14..c887886f 100644 --- a/src/wplace-bot-manager.user.js +++ b/scripts/wplace-bot-manager.user.js @@ -7,8 +7,8 @@ // @match https://wplace.live/* // @grant none // @run-at document-end -// @updateURL https://raw.githubusercontent.com/Wplace-AutoBot/WPlace-AutoBOT/refs/heads/main/wplace-bot-manager.user.js -// @downloadURL https://raw.githubusercontent.com/Wplace-AutoBot/WPlace-AutoBOT/refs/heads/main/wplace-bot-manager.user.js +// @updateURL https://raw.githubusercontent.com/Wplace-AutoBot/WPlace-AutoBOT/refs/heads/main/scripts/wplace-bot-manager.user.js +// @downloadURL https://raw.githubusercontent.com/Wplace-AutoBot/WPlace-AutoBOT/refs/heads/main/scripts/wplace-bot-manager.user.js // ==/UserScript== (function () { @@ -21,6 +21,22 @@ const HOST_ID = 'wplace-bot-launcher-host'; const TARGET_NAME_KEY = 'wplace-target-name'; + // Loader types + const LOADER_DEFAULT = 'inline'; + const LOADERS = ['blob', 'inline', 'eval']; + const loaderLabels = { + blob: 'Blob URL', + inline: 'Inline textContent', + eval: 'Global eval()', + }; + function sanitizeLoader(v) { + v = String(v || '').toLowerCase(); + return LOADERS.includes(v) ? v : LOADER_DEFAULT; + } + function labelForLoader(v) { + return loaderLabels[sanitizeLoader(v)]; + } + // Add hotkey to open manager (Ctrl+Shift+M) document.addEventListener('keydown', function (e) { if (e.ctrlKey && e.shiftKey && e.key === 'M') { @@ -87,6 +103,7 @@ url: String(x.url), title: String(x.title || 'Untitled'), note: String(x.note || ''), + loader: sanitizeLoader(x.loader), createdAt: Number(x.createdAt || Date.now()), lastUsedAt: Number(x.lastUsedAt || 0), })); @@ -170,6 +187,7 @@ url: DEFAULT_URL, title: 'WPlace Auto-Image', note: 'Fetches and runs Auto-Image.js from GitHub (trusted only).', + loader: LOADER_DEFAULT, createdAt: Date.now(), lastUsedAt: 0, }); @@ -328,6 +346,19 @@ +
+ + +
+ Tip: Try "Blob" if inline scripts are blocked by CSP, + "Inline" if blob: URLs are blocked, and "eval" if you + explicitly allow unsafe-eval. +
+
NameSizeModified