mirror of
https://codeberg.org/valpackett/tiddlypwa.git
synced 2026-03-14 11:50:48 -07:00
Plugin: support uploading to arbitrary sync servers
Not just the ones we're syncing with
This commit is contained in:
parent
3cf6393d0f
commit
bb3eb18942
4 changed files with 27 additions and 3 deletions
|
|
@ -532,9 +532,11 @@ Formatted with `deno fmt`.
|
|||
);
|
||||
const swjs = $tw.wiki.renderTiddler('text/plain', '$:/plugins/valpackett/tiddlypwa-offline/sw.js', {});
|
||||
try {
|
||||
const servers = await adb(
|
||||
this.db.transaction('syncservers').objectStore('syncservers').getAll(),
|
||||
);
|
||||
const servers = (variables.uploadUrl && variables.uploadToken)
|
||||
? [{ url: variables.uploadUrl, token: variables.uploadToken }]
|
||||
: await adb(
|
||||
this.db.transaction('syncservers').objectStore('syncservers').getAll(),
|
||||
);
|
||||
const resps = await Promise.all(servers.map(({ url, token }) =>
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ upload it to sync servers
|
|||
</$button>
|
||||
</$reveal>!
|
||||
|
||||
<details>
|
||||
<summary>Or even upload to a sync server you are not currently syncing with…</summary>
|
||||
{{$:/plugins/valpackett/tiddlypwa/upload-app-form}}
|
||||
</details>
|
||||
|
||||
{{$:/status/TiddlyPWAUploadResult}}
|
||||
|
||||
Note that some basic configuration like the title, subtitle, favicon, theme and palette will be saved unencrypted.
|
||||
|
|
|
|||
10
plugins/tiddlypwa/upload-app-form.tid
Normal file
10
plugins/tiddlypwa/upload-app-form.tid
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
title: $:/plugins/valpackett/tiddlypwa/upload-app-form
|
||||
|
||||
<label>URL: <$edit-text tiddler="$:/temp/TiddlyPWAServerURL" tag="input" default="https://" /></label>
|
||||
<label>Token: <$edit-text tiddler="$:/temp/TiddlyPWAServerToken" tag="input" default="" /></label>
|
||||
<$button>
|
||||
<$action-sendmessage $message="tiddlypwa-upload-app-wiki"
|
||||
publishFilter={{$:/plugins/valpackett/tiddlypwa/app-filter}}
|
||||
uploadUrl={{$:/temp/TiddlyPWAServerURL}} uploadToken={{$:/temp/TiddlyPWAServerToken}} />
|
||||
Upload
|
||||
</$button>
|
||||
|
|
@ -11,6 +11,13 @@ This will reload the page, and you will be asked for a password.
|
|||
If you do not yet have one, make one up!
|
||||
Note that you must to use the same password on all TiddlyPWA instances you'd want to sync between.
|
||||
|
||||
<details>
|
||||
<summary>Upload this version to any sync server…</summary>
|
||||
{{$:/plugins/valpackett/tiddlypwa/upload-app-form}}
|
||||
</details>
|
||||
|
||||
{{$:/status/TiddlyPWAUploadResult}}
|
||||
|
||||
!! Hosting a custom instance
|
||||
|
||||
First, either start with this page or add the following plugins to a fresh TiddlyWiki file:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue