mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-04-02 15:15:17 +00:00
### Fixed (This should be backported to 0.25.22 if the beta phase is prolonged) - No longer larger files will not create a chunks during preparing `Reset Synchronisation on This Device`. ### Behaviour changes - Setup wizard is now more `goal-oriented`. Brand-new screens are introduced. - `Fetch everything` and `Rebuild everything` is now `Reset Synchronisation on This Device` and `Overwrite Server Data with This Device's Files`. - Remote configuration and E2EE settings are now separated to each modal dialogue. - Peer-to-Peer settings is also separated into its own modal dialogue. - Setup-URI, and Report for the Issue are now not copied to clipboard automatically. Instead, there are copy dialogue and buttons to copy them explicitly. - No longer optional features are introduced during the setup or `Reset Synchronisation on This Device`, `Overwrite Server Data with This Device's Files`. - We cannot preform `Fetch everything` and `Rebuild everything` (Removed, so the old name) without restarting Obsidian now. ### Miscellaneous - Setup QR Code generation is separated into a src/lib/src/API/processSetting.ts file. Please use it as a subrepository if you want to generate QR codes in your own application. - Setup-URI is also separated into a src/lib/src/API/processSetting.ts - Some direct access to web-APIs are now wrapped into the services layer. ### Dependency updates - Many dependencies are updated. Please see `package.json`. - As upgrading TypeScript, Fixed many UInt8Array<ArrayBuffer> and Uint8Array type mismatches.
97 lines
3.6 KiB
Svelte
97 lines
3.6 KiB
Svelte
<script lang="ts">
|
|
import { configURIBase } from "../../../../common/types";
|
|
import type { ObsidianLiveSyncSettings } from "../../../../lib/src/common/types";
|
|
import DialogHeader from "@/lib/src/UI/components/DialogHeader.svelte";
|
|
import Guidance from "@/lib/src/UI/components/Guidance.svelte";
|
|
import Decision from "@/lib/src/UI/components/Decision.svelte";
|
|
import UserDecisions from "@/lib/src/UI/components/UserDecisions.svelte";
|
|
import InfoNote from "@/lib/src/UI/components/InfoNote.svelte";
|
|
import InputRow from "@/lib/src/UI/components/InputRow.svelte";
|
|
import Password from "@/lib/src/UI/components/Password.svelte";
|
|
|
|
import { onMount } from "svelte";
|
|
import { decryptString } from "../../../../lib/src/encryption/stringEncryption.ts";
|
|
import type { GuestDialogProps } from "../../../../lib/src/UI/svelteDialog.ts";
|
|
const TYPE_CANCELLED = "cancelled";
|
|
type ResultType = typeof TYPE_CANCELLED | ObsidianLiveSyncSettings;
|
|
type Props = GuestDialogProps<ResultType, string>;
|
|
const { setResult, getInitialData }: Props = $props();
|
|
|
|
let setupURI = $state("");
|
|
let passphrase = $state("");
|
|
let error = $state("");
|
|
onMount(() => {
|
|
if (getInitialData) {
|
|
const initialURI = getInitialData();
|
|
if (initialURI) {
|
|
setupURI = initialURI;
|
|
}
|
|
}
|
|
});
|
|
|
|
const seemsValid = $derived.by(() => setupURI.startsWith(configURIBase));
|
|
async function processSetupURI() {
|
|
error = "";
|
|
if (!seemsValid) return;
|
|
if (!passphrase) {
|
|
error = "Passphrase is required.";
|
|
return;
|
|
}
|
|
try {
|
|
const settingPieces = setupURI.substring(configURIBase.length);
|
|
const encodedConfig = decodeURIComponent(settingPieces);
|
|
const newConf = (await JSON.parse(
|
|
await decryptString(encodedConfig, passphrase)
|
|
)) as ObsidianLiveSyncSettings;
|
|
setResult(newConf);
|
|
// Logger("Settings imported successfully", LOG_LEVEL_NOTICE);
|
|
return;
|
|
} catch (e) {
|
|
error = "Failed to parse Setup-URI.";
|
|
return;
|
|
}
|
|
}
|
|
async function canProceed() {
|
|
return (await processSetupURI()) ?? false;
|
|
}
|
|
</script>
|
|
|
|
<DialogHeader title="Enter Setup URI" />
|
|
<Guidance
|
|
>Please enter the Setup URI that was generated during server installation or on another device, along with the vault
|
|
passphrase.<br />
|
|
Note that you can generate a new Setup URI by running the "Copy settings as a new Setup URI" command in the command palette.</Guidance
|
|
>
|
|
|
|
<InputRow label="Setup-URI">
|
|
<input
|
|
type="text"
|
|
placeholder="obsidian://setuplivesync?settings=...."
|
|
bind:value={setupURI}
|
|
autocorrect="off"
|
|
autocapitalize="off"
|
|
spellcheck="false"
|
|
required
|
|
/>
|
|
</InputRow>
|
|
<InfoNote visible={seemsValid}>The Setup-URI is valid and ready to use.</InfoNote>
|
|
<InfoNote warning visible={!seemsValid && setupURI.trim() != ""}>
|
|
The Setup-URI does not appear to be valid. Please check that you have copied it correctly.
|
|
</InfoNote>
|
|
<InputRow label="Passphrase">
|
|
<Password placeholder="Enter your passphrase" bind:value={passphrase} required />
|
|
</InputRow>
|
|
<InfoNote error visible={error.trim() != ""}>
|
|
{error}
|
|
</InfoNote>
|
|
|
|
<UserDecisions>
|
|
<Decision
|
|
title="Test Settings and Continue"
|
|
important={true}
|
|
disabled={!canProceed}
|
|
commit={() => processSetupURI()}
|
|
/>
|
|
<Decision title="Cancel" commit={() => setResult(TYPE_CANCELLED)} />
|
|
</UserDecisions>
|