Files
fnx_web/svelte/src/user_home/ConnectApp.svelte

207 lines
5.2 KiB
Svelte
Raw Normal View History

<script>
import { onMount } from "svelte";
import CopyButton from "layout/CopyButton.svelte";
2025-10-09 15:48:23 +02:00
import { loading_finish, loading_start } from "lib/Loading";
2025-10-13 16:05:50 +02:00
let app_name = $state("")
let api_key = $state("")
const create_key = async () => {
2025-10-09 15:48:23 +02:00
loading_start()
try {
let form = new FormData()
form.append("app_name", app_name)
const resp = await fetch(
window.api_endpoint+"/user/session",
{
method: "POST",
body: form,
}
);
if(resp.status >= 400) {
throw new Error(await resp.text());
}
api_key = (await resp.json()).auth_key
} catch (err) {
alert("Failed to create new API key! "+err)
} finally {
2025-10-09 15:48:23 +02:00
loading_finish()
}
}
2025-10-13 16:05:50 +02:00
let show_key = $state("")
const toggle_show_key = () => {
if (show_key === "") {
show_key = api_key
} else {
show_key = ""
}
}
onMount(() => {
let app = new URL(window.location.href).searchParams.get("app")
if (app) {
app_name = app
}
})
</script>
2022-01-11 13:28:22 +01:00
<section>
2022-02-22 19:53:31 +01:00
<!-- Show a back button if an app is selected -->
{#if app_name}
<a href="/user/connect_app" class="button">
<i class="icon">arrow_back</i>
Back to apps
</a>
{/if}
2022-01-11 13:28:22 +01:00
{#if app_name === "jdownloader"}
<h2>
Connect
<img src="/res/img/jdownloader.png" alt="JDownloader logo" class="app_icon_small"/>
2026-06-10 23:53:03 +02:00
JDownloader to your Nova account
2022-01-11 13:28:22 +01:00
</h2>
2022-02-22 19:53:31 +01:00
<p>
JDownloader is a software program which makes it easier to download
2026-06-10 23:53:03 +02:00
things from the web. You can connect JDownloader to your Nova
account to benefit from faster download speed and other Nova Pro
features.
2022-02-22 19:53:31 +01:00
</p>
<h3>Step 1: Install JDownloader</h3>
<p>
Download JDownloader from its website:
2022-12-24 11:37:31 +01:00
<a href="https://jdownloader.org/download/index" target="_blank"
rel="noreferrer">jdownloader.org</a>. Open JDownloader from your
2022-02-22 19:53:31 +01:00
start menu after the installation is complete.
</p>
<h3>Step 2: Open the account manager</h3>
<div class="center">
<img src="/res/img/jdownloader_account_manager.webp" alt="Go to settings, then Account Manager, click Add account"/>
</div>
<h3>Step 3: Generate an app key</h3>
2022-01-11 13:28:22 +01:00
<p>
2026-06-10 23:53:03 +02:00
To connect JDownloader to Nova you need to generate an API
2022-01-11 13:28:22 +01:00
key and enter it in JDownloader's Account Manager.
<br/>
<strong>Do not show the generated key to anyone</strong>, it can
2026-06-10 23:53:03 +02:00
be used to gain access to your Nova account!
2022-01-11 13:28:22 +01:00
</p>
{#if !api_key}
<div class="center">
2025-10-13 16:05:50 +02:00
<button class="button_highlight" onclick={create_key}>
2022-01-11 13:28:22 +01:00
<i class="icon">add</i>
Generate key
</button>
</div>
{:else}
2022-02-22 19:53:31 +01:00
<h4>Key created</h4>
2022-01-11 13:28:22 +01:00
<div class="copy_container">
<CopyButton text={api_key}>Copy key to clipboard</CopyButton>
2025-10-13 16:05:50 +02:00
<button onclick={toggle_show_key} class="copy_button" class:button_highlight={show_key !== ""}>
2022-01-11 13:28:22 +01:00
<i class="icon">visibility</i>
{#if show_key === ""}
Show key
2022-02-22 19:53:31 +01:00
{:else}
Hide key
2022-01-11 13:28:22 +01:00
{/if}
</button>
<input bind:value={show_key} class="copy_textarea" type="text" placeholder="Your key will show up here" disabled={show_key === ""}/>
</div>
{/if}
2022-01-11 13:28:22 +01:00
2022-02-22 19:53:31 +01:00
<h3>Step 4: Add the key to JDownloader</h3>
2022-01-11 13:28:22 +01:00
<p>
Paste the key in JDownloader to authenticate the app.
</p>
2022-02-22 19:53:31 +01:00
<div class="center">
<img src="/res/img/jdownloader_add_key.webp" alt="Go to settings, then Account Manager, click Add account"/>
</div>
<p>
Click Save and you're done! You can now download files from
2026-06-10 23:53:03 +02:00
Nova with JDownloader.
2022-02-22 19:53:31 +01:00
</p>
2022-01-11 13:28:22 +01:00
{:else if app_name === "sharex"}
<h2>
Connect
<img src="/res/img/sharex.png" alt="ShareX logo" class="app_icon_small"/>
2026-06-10 23:53:03 +02:00
ShareX to your Nova account
2022-01-11 13:28:22 +01:00
</h2>
<p>
ShareX is a Screen capture, file sharing and productivity tool.
2026-06-10 23:53:03 +02:00
Nova is supported as a custom uploader. You can <a
2022-12-24 11:37:31 +01:00
href="https://getsharex.com/" target="_blank" rel="noreferrer">get
ShareX here</a>.
2022-01-11 13:28:22 +01:00
</p>
<p>
Here you can download our custom ShareX uploader which uses
2026-06-10 23:53:03 +02:00
Nova to upload your files. This uploader is configured to
upload files to your personal Nova account. <strong>Do not
2022-01-11 13:28:22 +01:00
share the configuration file with anyone</strong>, it contains
your account credentials.
</p>
<div class="center">
2026-06-10 23:53:03 +02:00
<a href="/misc/sharex/nova.storage.sxcu" class="button button_highlight">
2022-01-11 13:28:22 +01:00
<i class="icon small">save</i>
Download ShareX Uploader
</a>
</div>
2026-06-10 23:53:03 +02:00
<h3>Setting Nova as default uploader</h3>
2022-01-11 13:28:22 +01:00
<p>
Download the uploader config and choose 'Open file'
<br/>
<img src="/res/img/sharex_download.png" style="max-width: 100%;" alt=""/><br/>
2026-06-10 23:53:03 +02:00
Set nova.storage as active uploader. Choose Yes
2022-01-11 13:28:22 +01:00
<br/>
<img src="/res/img/sharex_default.png" style="max-width: 100%;" alt=""/><br/>
</p>
{:else}
2026-06-10 23:53:03 +02:00
<h2>Connect an app to your Nova account</h2>
2022-01-11 13:28:22 +01:00
<ul>
<li>
2022-02-22 19:53:31 +01:00
<a href="?app=jdownloader" class="button">
2022-01-11 13:28:22 +01:00
<img src="/res/img/jdownloader.png" alt="JDownloader logo" class="app_icon"/>
Connect JDownloader
2022-02-22 19:53:31 +01:00
</a>
2022-01-11 13:28:22 +01:00
</li>
<li>
2022-02-22 19:53:31 +01:00
<a href="?app=sharex" class="button">
2022-01-11 13:28:22 +01:00
<img src="/res/img/sharex.png" alt="ShareX logo" class="app_icon"/>
Connect ShareX
2022-02-22 19:53:31 +01:00
</a>
2022-01-11 13:28:22 +01:00
</li>
</ul>
{/if}
</section>
<style>
.app_icon {
height: 1.6em;
vertical-align: middle;
}
.app_icon_small {
height: 1em;
vertical-align: middle;
}
.center {
text-align: center;
}
2022-02-22 19:53:31 +01:00
.center > img {
max-width: 100%;
}
.copy_container {
display: flex;
}
.copy_textarea {
flex: 1 1 auto;
}
.copy_button {
flex: 0 0 auto;
}
</style>