diff --git a/.forgejo/workflows/check.yaml b/.forgejo/workflows/check.yaml new file mode 100644 index 0000000..7cf9883 --- /dev/null +++ b/.forgejo/workflows/check.yaml @@ -0,0 +1,22 @@ +--- +on: + push: + branches: [trunk] + pull_request: + types: [opened, synchronize, reopened] +jobs: + test: + runs-on: val-arm64 + steps: + - name: Checkout + uses: https://code.forgejo.org/actions/checkout@v4 + - name: Get Deno + run: curl -fsSL https://deno.land/install.sh | sh + - name: Run server tests + run: /root/.deno/bin/deno test server + - name: Try hash-admin-password + run: echo uwu | /root/.deno/bin/deno run server/hash-admin-password.ts + - name: Check client build + run: /root/.deno/bin/deno run --allow-env --allow-read --allow-write=output npm:tiddlywiki@5.3.5 --build + - name: Check formatting + run: /root/.deno/bin/deno fmt --check --ignore="**/*.css" plugins server diff --git a/.forgejo/workflows/upload.yaml b/.forgejo/workflows/upload.yaml new file mode 100644 index 0000000..680fcbb --- /dev/null +++ b/.forgejo/workflows/upload.yaml @@ -0,0 +1,22 @@ +--- +on: + push: + branches: [release] +jobs: + test: + runs-on: val-arm64 + steps: + - name: Checkout + uses: https://code.forgejo.org/actions/checkout@v4 + - name: Fetch theme + run: mkdir notebook && curl -L https://github.com/valpackett/Notebook/archive/e2c61ccd6e9db5cfcbc77e54eccc8b5961da5831.tar.gz | tar -xvzf - -C notebook --strip-components=1 + - name: Build client + run: npx tiddlywiki@5.3.5 --build + env: + TIDDLYWIKI_THEME_PATH: notebook/themes + TIDDLYWIKI_PLUGIN_PATH: notebook/plugins + - name: Upload result + run: sh bunny.sh + env: + BUNNY_BUCKET: ${{ secrets.BUNNY_BUCKET }} + BUNNY_KEY: ${{ secrets.BUNNY_KEY }} diff --git a/.woodpecker.yml b/.woodpecker.yml deleted file mode 100644 index ec4bd57..0000000 --- a/.woodpecker.yml +++ /dev/null @@ -1,9 +0,0 @@ -steps: - test: - image: denoland/deno:alpine-1.45.4 - commands: - - deno test - - DENO_FUTURE=1 deno test - - echo uwu | DENO_FUTURE=1 deno run server/hash-admin-password.ts - - deno fmt --check - - DENO_FUTURE=1 deno run --allow-env --allow-read --allow-write=output npm:tiddlywiki@5.3.5 --build diff --git a/README.md b/README.md index 3f6c6f9..cb3d3eb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![CI status](https://ci.codeberg.org/api/badges/valpackett/tiddlypwa/status.svg)](https://ci.codeberg.org/valpackett/tiddlypwa) -[![Netlify Status](https://api.netlify.com/api/v1/badges/2c2cbd41-1ced-4f78-acc7-83889f95bcc2/deploy-status)](https://app.netlify.com/sites/tiddly-packett-cool/deploys) [![Support me on Patreon](https://img.shields.io/badge/dynamic/json?logo=patreon&color=%23e85b46&label=support%20me%20on%20patreon&query=data.attributes.patron_count&suffix=%20patrons&url=https%3A%2F%2Fwww.patreon.com%2Fapi%2Fcampaigns%2F9395291)](https://www.patreon.com/valpackett) # TiddlyPWA diff --git a/bunny.sh b/bunny.sh new file mode 100755 index 0000000..f5df6e0 --- /dev/null +++ b/bunny.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +cd output +find * -type f -exec curl --fail --request PUT \ + --url https://storage.bunnycdn.com/$BUNNY_BUCKET/{} \ + --header "AccessKey: $BUNNY_KEY" \ + --header "Content-Type: application/octet-stream" \ + --data-binary @{} \; diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index bed23b7..0000000 --- a/netlify.toml +++ /dev/null @@ -1,18 +0,0 @@ -[build] -publish = "output" -command = """ - mkdir notebook; curl -L https://github.com/valpackett/Notebook/archive/e2c61ccd6e9db5cfcbc77e54eccc8b5961da5831.tar.gz | tar -xvzf - -C notebook --strip-components=1 && - TIDDLYWIKI_THEME_PATH=notebook/themes TIDDLYWIKI_PLUGIN_PATH=notebook/plugins npx tiddlywiki@5.3.5 --build -""" - -[[headers]] -for = "/*" -[headers.values] -x-content-type-options = "nosniff" -x-frame-options = "SAMEORIGIN" -referrer-policy = "no-referrer-when-downgrade" - -[[redirects]] -from = "/w/:name/:file" -to = "/app/:file" -status = 200 diff --git a/plugins/tiddlypwa/bootstrap.js b/plugins/tiddlypwa/bootstrap.js index 0bc9df8..2d1bccd 100644 --- a/plugins/tiddlypwa/bootstrap.js +++ b/plugins/tiddlypwa/bootstrap.js @@ -15,7 +15,7 @@ Formatted with `deno fmt`. const dm = $tw.utils.domMaker; module.exports.BootstrapModal = class { - wrapper = dm('div', { class: 'tc-modal-wrapper', style: { 'z-index': 1500 } }); // below alerts, above hide-sidebar-btn + wrapper = dm('div', { class: 'tc-modal-wrapper', style: { 'z-index': 4000 } }); // below alerts, above hide-sidebar-btn and others (e.g. side panel in Notebook theme has z-index=3000) constructor() { $tw.utils.addClass(document.body, 'tc-modal-prevent-scroll'); this.wrapper.appendChild(dm('div', { class: 'tc-modal-backdrop' })); diff --git a/plugins/tiddlypwa/filters.js b/plugins/tiddlypwa/filters.js new file mode 100644 index 0000000..e8384f4 --- /dev/null +++ b/plugins/tiddlypwa/filters.js @@ -0,0 +1,36 @@ +/*\ +title: $:/plugins/valpackett/tiddlypwa/filters.js +type: application/javascript +module-type: isfilteroperator + +Filter function for TiddlyPWA-managed tiddler identification + +Licensed under 0BSD, see license.tid. +Formatted with `deno fmt`. +\*/ + +'use strict'; + +exports.tiddlypwa = function (source, prefix, options) { + const results = []; + + const pwaStorage = $tw.syncer.syncadaptor; + if (!pwaStorage || !pwaStorage.tiddlersInFile) { + return ['Error: TiddlyPWA not available']; + } + + if (prefix === '!') { + source(function (tiddler, title) { + if (pwaStorage.tiddlersInFile.has(title)) { + results.push(title); + } + }); + } else { + source(function (tiddler, title) { + if (!pwaStorage.tiddlersInFile.has(title)) { + results.push(title); + } + }); + } + return results; +}; diff --git a/plugins/tiddlypwa/filters.tid b/plugins/tiddlypwa/filters.tid new file mode 100644 index 0000000..824f315 --- /dev/null +++ b/plugins/tiddlypwa/filters.tid @@ -0,0 +1,11 @@ +title: $:/plugins/valpackett/tiddlypwa/filters + +!!! Filter Operators + +TiddlyPWA provides filter operator to identify tiddlers it manages: + +* `[is[tiddlypwa]]` - tiddlers created/loaded by TiddlyPWA (from local DB or server) +* `[!is[tiddlypwa]]` - inversion of the above, i.e. tiddlers loaded from app wiki html file + +This may be useful to find system tiddlers created by you, or to check shadow tiddler origins +(app file vs DB/server) or when exporting (to e.g. backup everything stored on server including system tiddlers). \ No newline at end of file diff --git a/plugins/tiddlypwa/notif-refresh.tid b/plugins/tiddlypwa/notif-refresh.tid index b129b9f..de6d0e5 100644 --- a/plugins/tiddlypwa/notif-refresh.tid +++ b/plugins/tiddlypwa/notif-refresh.tid @@ -3,7 +3,7 @@ tags: $:/tags/PageTemplate <$reveal type="nomatch" state="$:/temp/HideUpdate" text="yes"> <$reveal type="match" state="$:/status/TiddlyPWAUpdateAvailable" text="yes"> -