diff --git a/plugins/tiddlypwa/main.js b/plugins/tiddlypwa/main.js index c0a0f06..bd9cec5 100644 --- a/plugins/tiddlypwa/main.js +++ b/plugins/tiddlypwa/main.js @@ -70,6 +70,14 @@ Formatted with `deno fmt`. return url === `${location.origin}${location.pathname}${location.search}`; } + function saveToApp(title) { + return title.startsWith('$:/themes/') || + title.startsWith('$:/plugins/') || + title.startsWith('$:/languages/'); + } + + $tw.wiki.doesPluginInfoRequireReload = (x) => x && x.tiddlers && Object.keys(x.tiddlers).find(saveToApp); + class PWAStorage { constructor(options) { this.wiki = options.wiki; @@ -699,12 +707,7 @@ Formatted with `deno fmt`. // For some reason this is not in the default $:/config/SyncFilter but no one would want this actually stored. return cb(null, '', 1); } - if ( - tiddler.fields.title.startsWith('$:/themes/') || - tiddler.fields.title.startsWith('$:/plugins/') || - tiddler.fields.title.startsWith('$:/languages/') - ) { - // Those should go into the saved wiki file. + if (saveToApp(tiddler.fields.title)) { // Attempting to only direct the `doesPluginRequireReload` ones into the file does not seem worth it. // By ignoring the callback we make TW think there's something unsaved now, which there is! return; diff --git a/plugins/tiddlypwa/save-dialog-app.tid b/plugins/tiddlypwa/save-dialog-app.tid new file mode 100644 index 0000000..82c0139 --- /dev/null +++ b/plugins/tiddlypwa/save-dialog-app.tid @@ -0,0 +1,43 @@ +title: $:/plugins/valpackett/tiddlypwa/save-dialog-app +tags: $:/tags/TiddlyPWA/SaveDialog +caption: Advanced App Management + +\define tv-wikilinks() no + +<$reveal type="match" state="$:/isEncrypted" text="yes"> +TiddlyWiki single-file password must not be used when doing this, please disable it: {{$:/core/ui/Buttons/encryption}} + +<$reveal type="nomatch" state="$:/isEncrypted" text="yes"> + +To update the wiki file that is used as the TiddlyPWA application (''this is the kind of save you want to install plugins/themes''), you can +<$button> +<$action-sendmessage $message="tm-download-file" publishFilter={{$:/plugins/valpackett/tiddlypwa/app-filter}} /> +save this wiki without content + +<$reveal type="nomatch" state="$:/status/TiddlyPWAUploading" text="yes"> +or directly +<$button> +<$action-sendmessage $message="tiddlypwa-upload-app-wiki" publishFilter={{$:/plugins/valpackett/tiddlypwa/app-filter}} /> +upload it to sync servers + +! + +
+Or even upload to a sync server you are not currently syncing with… +{{$:/plugins/valpackett/tiddlypwa/upload-app-form}} +
+ +{{$:/status/TiddlyPWAUploadResult}} + +Note that some basic configuration like the title, subtitle, favicon, theme and palette will be saved unencrypted. + +
+Specifically, these tiddlers will be saved… + +
+ + \ No newline at end of file diff --git a/plugins/tiddlypwa/save-dialog-export.tid b/plugins/tiddlypwa/save-dialog-export.tid new file mode 100644 index 0000000..5365bea --- /dev/null +++ b/plugins/tiddlypwa/save-dialog-export.tid @@ -0,0 +1,14 @@ +title: $:/plugins/valpackett/tiddlypwa/save-dialog-export +tags: $:/tags/TiddlyPWA/SaveDialog +caption: Export Single-File + +\define tv-wikilinks() no + +To make a single-file export/backup of the wiki, you can {{$:/core/ui/Buttons/encryption}} if you want and +<$button> +<$action-sendmessage $message="tm-download-file" publishFilter="-[[$:/HistoryList]] -[[$:/StoryList]] -[[$:/isEncrypted]] -[[$:/UploadName]] -[prefix[$:/state/]] -[prefix[$:/status/]] -[prefix[$:/temp/]] -[prefix[$:/plugins/valpackett/tiddlypwa]]"/> +save this wiki without TiddlyPWA +. + +Note that the password configured via the button above will ''only'' apply to wiki files exported via this save button. +It is completely independent of the TiddlyPWA storage password. diff --git a/plugins/tiddlypwa/save-dialog-sync.tid b/plugins/tiddlypwa/save-dialog-sync.tid new file mode 100644 index 0000000..215563c --- /dev/null +++ b/plugins/tiddlypwa/save-dialog-sync.tid @@ -0,0 +1,22 @@ +title: $:/plugins/valpackett/tiddlypwa/save-dialog-sync +tags: $:/tags/TiddlyPWA/SaveDialog +caption: Sync Status + +\define tv-wikilinks() no + + + + + + + + +<$list filter="[tag[$:/temp/TiddlyPWAServer]]"> + + + + + +
ServerLast synced change
{{!!url}}{{!!lastSync}}
+ +{{$:/plugins/valpackett/tiddlypwa/sync-status}} diff --git a/plugins/tiddlypwa/save-dialog.tid b/plugins/tiddlypwa/save-dialog.tid index bfcaaa4..a188535 100644 --- a/plugins/tiddlypwa/save-dialog.tid +++ b/plugins/tiddlypwa/save-dialog.tid @@ -1,75 +1,38 @@ title: $:/plugins/valpackett/tiddlypwa/save-dialog +subtitle: Saving and Exporting -!! Sync status - - - - - - - - -<$list filter="[tag[$:/temp/TiddlyPWAServer]]"> - - - - - -
ServerLast synced change
{{!!url}}{{!!lastSync}}
- -{{$:/plugins/valpackett/tiddlypwa/sync-status}} - -!! Export as ordinary single-file ~TiddlyWiki +\define tv-wikilinks() no <$set name="tv-config-toolbar-icons" value="yes"> <$set name="tv-config-toolbar-text" value="yes"> <$set name="tv-config-toolbar-class" value=""> -To make a single-file backup of the wiki, you can {{$:/core/ui/Buttons/encryption}} & -<$button> -<$action-sendmessage $message="tm-download-file" publishFilter="-[[$:/HistoryList]] -[[$:/StoryList]] -[[$:/isEncrypted]] -[[$:/UploadName]] -[prefix[$:/state/]] -[prefix[$:/status/]] -[prefix[$:/temp/]] -[prefix[$:/plugins/valpackett/tiddlypwa]]"/> -save this wiki without ~TiddlyPWA -. +<$reveal type="match" state="$:/status/RequireReloadDueToPluginChange" text="yes"> -Note that the native ~TiddlyWiki password that is configured via the button above will ''only'' -apply to files saved via this save button — it is completely independent of the ~TiddlyPWA storage password. - -!! Export as ~TiddlyPWA app wiki +To finish the installation of plugins/themes/languages, you need to save and reload the app: <$reveal type="match" state="$:/isEncrypted" text="yes"> -~TiddlyWiki single-file password must not be used when doing this, please unset it using the "clear password" button above. +But first, disable single-file encryption: {{$:/core/ui/Buttons/encryption}}! <$reveal type="nomatch" state="$:/isEncrypted" text="yes"> - -To update the wiki file that is used as the ~TiddlyPWA application (''this is the kind of save you want to install plugins/themes''), you can -<$button> -<$action-sendmessage $message="tm-download-file" publishFilter={{$:/plugins/valpackett/tiddlypwa/app-filter}} /> -save this wiki without content - <$reveal type="nomatch" state="$:/status/TiddlyPWAUploading" text="yes"> -or directly <$button> <$action-sendmessage $message="tiddlypwa-upload-app-wiki" publishFilter={{$:/plugins/valpackett/tiddlypwa/app-filter}} /> -upload it to sync servers - -! - -
-Or even upload to a sync server you are not currently syncing with… -{{$:/plugins/valpackett/tiddlypwa/upload-app-form}} -
+Upload it to sync servers +! + + {{$:/status/TiddlyPWAUploadResult}} -Note that some basic configuration like the title, subtitle, favicon, theme and palette will be saved unencrypted. - -
-Specifically, these tiddlers will be saved… - -
+You can also use the "Advanced App Management" tab below to upload the app with these modifications to any other server or save it locally. + +<$reveal type="nomatch" state="$:/status/RequireReloadDueToPluginChange" text="yes"> +TiddlyPWA saves and syncs your content automatically! However, here you can find options to export your content +and manually manage the app files. + + +<$macrocall $name="tabs" tabsList="[all[tiddlers+shadows]tag[$:/tags/TiddlyPWA/SaveDialog]!has[draft.of]]" +default="$:/plugins/valpackett/tiddlypwa/save-dialog-sync" explicitState="$:/state/tab--28743853"/>