mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-05-11 12:37:34 +02:00
The Android and iOS support introduced on #1011 is not really supported - the Tauri path API correctly resolves the cache directory on mobile, and we can access those directly using Rust code. This is a breaking change because we no longer uses the same directory to store the files - app_cache_dir returns a different location
This commit is contained in:
committed by
GitHub
parent
0d5e7e2892
commit
0c040bcc9a
@@ -23,6 +23,7 @@
|
||||
"@tauri-apps/plugin-os": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-process": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-shell": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-store": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-updater": "2.0.0-rc.0",
|
||||
"@zerodevx/svelte-json-view": "1.0.9"
|
||||
},
|
||||
|
||||
@@ -34,6 +34,7 @@ tauri-plugin-notification = { path = "../../../plugins/notification", version =
|
||||
tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.0-rc.0" }
|
||||
tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.0-rc.0" }
|
||||
tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-rc.2" }
|
||||
tauri-plugin-store = { path = "../../../plugins/store", version = "2.0.0-rc.2" }
|
||||
|
||||
[dependencies.tauri]
|
||||
workspace = true
|
||||
|
||||
@@ -78,6 +78,11 @@
|
||||
}
|
||||
],
|
||||
"deny": ["$APPDATA/db/*.stronghold"]
|
||||
}
|
||||
},
|
||||
"store:allow-entries",
|
||||
"store:allow-get",
|
||||
"store:allow-set",
|
||||
"store:allow-save",
|
||||
"store:allow-load"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -7265,6 +7265,181 @@
|
||||
"shell:deny-stdin-write"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:default -> This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-clear -> Enables the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-delete -> Enables the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-entries -> Enables the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-entries"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-get -> Enables the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-has -> Enables the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-has"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-keys -> Enables the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-keys"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-length -> Enables the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-length"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-load -> Enables the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-load"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-reset -> Enables the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-reset"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-save -> Enables the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-save"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-set -> Enables the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-set"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-values -> Enables the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-values"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-clear -> Denies the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-delete -> Denies the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-entries -> Denies the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-entries"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-get -> Denies the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-has -> Denies the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-has"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-keys -> Denies the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-keys"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-length -> Denies the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-length"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-load -> Denies the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-load"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-reset -> Denies the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-reset"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-save -> Denies the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-save"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-set -> Denies the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-set"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-values -> Denies the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-values"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "updater:default -> This permission set configures which kind of\nupdater functions are exposed to the frontend.\n\n#### Granted Permissions\n\nThe full workflow from checking for updates to installing them\nis enabled.\n\n",
|
||||
"type": "string",
|
||||
|
||||
@@ -7341,6 +7341,181 @@
|
||||
"enum": [
|
||||
"shell:deny-stdin-write"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:default -> This permission set configures what kind of\noperations are available from the store plugin.\n\n#### Granted Permissions\n\nAll operations are enabled by default.\n\n",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:default"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-clear -> Enables the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-delete -> Enables the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-entries -> Enables the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-entries"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-get -> Enables the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-has -> Enables the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-has"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-keys -> Enables the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-keys"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-length -> Enables the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-length"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-load -> Enables the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-load"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-reset -> Enables the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-reset"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-save -> Enables the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-save"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-set -> Enables the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-set"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:allow-values -> Enables the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:allow-values"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-clear -> Denies the clear command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-clear"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-delete -> Denies the delete command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-delete"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-entries -> Denies the entries command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-entries"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-get -> Denies the get command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-get"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-has -> Denies the has command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-has"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-keys -> Denies the keys command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-keys"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-length -> Denies the length command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-length"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-load -> Denies the load command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-load"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-reset -> Denies the reset command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-reset"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-save -> Denies the save command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-save"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-set -> Denies the set command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-set"
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "store:deny-values -> Denies the values command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"store:deny-values"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -37,6 +37,7 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.setup(move |app| {
|
||||
#[cfg(desktop)]
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
import Notifications from "./views/Notifications.svelte";
|
||||
import Shortcuts from "./views/Shortcuts.svelte";
|
||||
import Shell from "./views/Shell.svelte";
|
||||
import Store from "./views/Store.svelte";
|
||||
import Updater from "./views/Updater.svelte";
|
||||
import Clipboard from "./views/Clipboard.svelte";
|
||||
import WebRTC from "./views/WebRTC.svelte";
|
||||
@@ -90,6 +91,11 @@
|
||||
component: Shell,
|
||||
icon: "i-codicon-terminal-bash",
|
||||
},
|
||||
{
|
||||
label: "Store",
|
||||
component: Store,
|
||||
icon: "i-codicon-file-code",
|
||||
},
|
||||
!isMobile && {
|
||||
label: "Updater",
|
||||
component: Updater,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
}
|
||||
|
||||
function writeToStdin() {
|
||||
child.write(stdin).catch(onMessage);
|
||||
child.write(`${stdin}\n`).catch(onMessage);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<script>
|
||||
import { Store } from "@tauri-apps/plugin-store";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
export let onMessage;
|
||||
|
||||
let key;
|
||||
let value;
|
||||
|
||||
const store = new Store("cache.json");
|
||||
let cache = {};
|
||||
|
||||
onMount(async () => {
|
||||
await store.load();
|
||||
const values = await store.entries();
|
||||
for (const [key, value] of values) {
|
||||
cache[key] = value;
|
||||
}
|
||||
cache = cache;
|
||||
});
|
||||
|
||||
function write(key, value) {
|
||||
store
|
||||
.set(key, value)
|
||||
.then(() => store.get(key))
|
||||
.then((v) => {
|
||||
cache[key] = v;
|
||||
cache = cache;
|
||||
})
|
||||
.then(() => store.save())
|
||||
.catch(onMessage);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col childre:grow gap-1">
|
||||
<div class="flex flex-col flex-row-md gap-4">
|
||||
<div class="flex items-center gap-1">
|
||||
Key:
|
||||
<input class="grow input" bind:value={key} />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-1">
|
||||
Value:
|
||||
<input class="grow input" bind:value />
|
||||
</div>
|
||||
|
||||
<button class="btn" on:click={() => write(key, value)}> Write </button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{#each Object.entries(cache) as [k, v]}
|
||||
<div>{k} = {v}</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user