Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Commit

Permalink
Updates for wails 2.0beta35
Browse files Browse the repository at this point in the history
  • Loading branch information
achhabra2 committed Apr 30, 2022
1 parent 0b47888 commit cca658b
Show file tree
Hide file tree
Showing 18 changed files with 650 additions and 971 deletions.
2 changes: 1 addition & 1 deletion frontend/dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/dist/bundle.js.map

Large diffs are not rendered by default.

49 changes: 33 additions & 16 deletions frontend/src/about.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import go from "../wailsjs/go/bindings";
import { GetCurrentVersion } from "../wailsjs/go/main/App";
// import runtime from "../wailsjs/runtime";
import { onMount } from "svelte";
Expand All @@ -18,7 +19,7 @@
"go-github-selfupdate": "https://github.com/rhysd/go-github-selfupdate",
};
onMount(() => {
go.main.App.GetCurrentVersion().then((ver) => {
GetCurrentVersion().then((ver) => {
version = ver;
});
});
Expand All @@ -27,35 +28,51 @@
<div class="container p4 text-gray-200">
<div class="flex flex-row justify-between">
<span class="font-bold">
Riftshare v{version}
Riftshare v{version}
</span>
<div>
<button class="text-sm mr-1 about-button" on:click={(event) => window.runtime.BrowserOpenURL("https://riftshare.app")}
>Website</button
>
<button class="text-sm mr-1 about-button" on:click={(event) => window.runtime.BrowserOpenURL("https://riftshare.app/faq.html")}
>FAQ</button>
<button class="text-sm mr-1 about-button" on:click={(event) => window.runtime.BrowserOpenURL(issueUrl)}
>Open an Issue</button>
</div>
<button
class="text-sm mr-1 about-button"
on:click={(event) =>
window.runtime.BrowserOpenURL("https://riftshare.app")}
>Website</button
>
<button
class="text-sm mr-1 about-button"
on:click={(event) =>
window.runtime.BrowserOpenURL("https://riftshare.app/faq.html")}
>FAQ</button
>
<button
class="text-sm mr-1 about-button"
on:click={(event) => window.runtime.BrowserOpenURL(issueUrl)}
>Open an Issue</button
>
</div>
</div>

<p class="text-sm mb-1">
The goal of this project is to enable everyone to securely share files
freely and easily.
</p>
<div class="mb-1">
<p class="text-bold">License</p>
<p class="text-sm">Licensed under the GNU GPL Version 3</p>
<p class="text-bold">License</p>
<p class="text-sm">Licensed under the GNU GPL Version 3</p>
</div>
<div>
<p class="text-bold">Attributions</p>
<p class="text-bold">Attributions</p>
<p class="text-sm">
This project leverages the work of other Open Source Software
This project leverages the work of other Open Source Software
</p>
<ul class="text-xs file-list">
{#each Object.entries(attributions) as [name, url]}
<li><button class="text-blue-500" on:click={(event) => window.runtime.BrowserOpenURL(url)}>{name}</button></li>
<li>
<button
class="text-blue-500"
on:click={(event) => window.runtime.BrowserOpenURL(url)}
>{name}</button
>
</li>
{/each}
</ul>
</div>
Expand Down
15 changes: 8 additions & 7 deletions frontend/src/receiver.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import go from "../wailsjs/go/bindings";
import {ReceiveFile, OpenFile, GetUserPrefs, CancelWormholeRequest, GetReceivedFile} from '../wailsjs/go/main/App'
import Progress from "./progress.svelte";
import {onMount} from "svelte";
Expand All @@ -25,21 +26,21 @@
.trimEllip(24);
function receiveFile() {
go.main.App.ReceiveFile(receiveCode);
ReceiveFile(receiveCode);
}
function openFile() {
go.main.App.OpenFile(receivePath);
OpenFile(receivePath);
}
function openDownloadsFolder() {
go.main.App.GetUserPrefs().then(prefs => {
go.main.App.OpenFile(prefs.downloadsDirectory);
GetUserPrefs().then(prefs => {
OpenFile(prefs.downloadsDirectory);
});
}
function onCancel() {
go.main.App.CancelWormholeRequest().then(() => {
CancelWormholeRequest().then(() => {
isReceiving = false;
receiveCode = "";
status = "waiting";
Expand Down Expand Up @@ -73,7 +74,7 @@
});
onMount(() => {
go.main.App.GetReceivedFile().then(path => {
GetReceivedFile().then(path => {
if (path) {
receivePath = path;
}
Expand Down
43 changes: 26 additions & 17 deletions frontend/src/sender.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<script>
import {onMount} from "svelte";
import { onMount } from "svelte";
import { slide } from "svelte/transition";
import go from "../wailsjs/go/bindings";
import {
OpenDirectoryDialog,
OpenFilesDialog,
ClearSelectedFiles,
SelectedFilesSend,
CancelWormholeRequest,
GetSelectedFiles
} from "../wailsjs/go/main/App";
import Progress from "./progress.svelte";
Expand All @@ -18,7 +25,7 @@
);
function openDirectoryDialog() {
go.main.App.OpenDirectoryDialog()
OpenDirectoryDialog()
.then((selection) => {
if (selection != null) {
selectedFiles = selection;
Expand All @@ -33,7 +40,7 @@
}
function openFilesDialog() {
go.main.App.OpenFilesDialog()
OpenFilesDialog()
.then((selection) => {
if (selection != null) {
selectedFiles = selection;
Expand All @@ -53,11 +60,11 @@
sendPercent = 0;
selectedFiles = [];
isSending = false;
go.main.App.ClearSelectedFiles()
ClearSelectedFiles();
}
function onCancel() {
go.main.App.CancelWormholeRequest()
CancelWormholeRequest()
.then(() => {
isSending = false;
sendCode = "";
Expand All @@ -82,7 +89,7 @@
}
function sendFile() {
go.main.App.SelectedFilesSend();
SelectedFilesSend();
isSending = true;
}
window.runtime.EventsOn("send:started", function (newCode) {
Expand All @@ -108,7 +115,7 @@
});
onMount(() => {
go.main.App.GetSelectedFiles().then(filePaths => {
GetSelectedFiles().then((filePaths) => {
if (filePaths && filePaths.length > 0) {
selectedFiles = filePaths;
}
Expand Down Expand Up @@ -185,15 +192,17 @@
<div class="mx-auto mt-2" transition:slide>
<label for="sendCode" class="send-input-label">Send Code</label>
<div class="flex flex-row">
<input
id="sendCode"
readonly
type="text"
placeholder="Send code will appear"
value={sendCode}
class="send-input mt-1"
/>
<button class="copy-button mt-1 ml-1" on:click={copyCode}><div class="copy-icon"></div></button>
<input
id="sendCode"
readonly
type="text"
placeholder="Send code will appear"
value={sendCode}
class="send-input mt-1"
/>
<button class="copy-button mt-1 ml-1" on:click={copyCode}
><div class="copy-icon" /></button
>
</div>
</div>
{/if}
Expand Down
54 changes: 33 additions & 21 deletions frontend/src/settings.svelte
Original file line number Diff line number Diff line change
@@ -1,54 +1,64 @@
<script>
import go from "../wailsjs/go/bindings";
import {
GetUserPrefs,
GetLogPath,
AppInstalledFromPackageManager,
SetDownloadsFolder,
OpenFile,
SetOverwriteParam,
SetNotificationsParam,
SetSelfUpdateParam,
} from "../wailsjs/go/main/App";
import { onMount } from "svelte";
let downloadsFolder = "";
let logPath = "";
let notifications = false;
let overwrite = false;
let selfUpdate = false;
let selfUpdate = false;
let packageManaged = false;
onMount(() => {
go.main.App.GetUserPrefs().then(prefs => {
GetUserPrefs().then((prefs) => {
downloadsFolder = prefs.downloadsDirectory;
notifications = prefs.notifications;
overwrite = prefs.overwrite;
selfUpdate = prefs.selfUpdate;
});
go.main.App.GetLogPath().then((path) => {
GetLogPath().then((path) => {
logPath = path;
});
go.main.App.AppInstalledFromPackageManager().then(managed => {
AppInstalledFromPackageManager().then((managed) => {
packageManaged = managed;
});
});
function setDownloadsFolder() {
go.main.App.SetDownloadsFolder().then((folder) => {
SetDownloadsFolder().then((folder) => {
downloadsFolder = folder;
});
}
function openDownloadsFolder() {
go.main.App.OpenFile(downloadsFolder);
OpenFile(downloadsFolder);
}
function toggleOverwrite() {
go.main.App.SetOverwriteParam(!overwrite).then(newValue => {
SetOverwriteParam(!overwrite).then((newValue) => {
overwrite = newValue;
});
}
function toggleNotifications() {
go.main.App.SetNotificationsParam(!notifications).then(newValue => {
SetNotificationsParam(!notifications).then((newValue) => {
notifications = newValue;
});
}
function toggleSelfUpdate() {
go.main.App.SetSelfUpdateParam(!selfUpdate).then(newValue => {
SetSelfUpdateParam(!selfUpdate).then((newValue) => {
selfUpdate = newValue;
});
}
Expand Down Expand Up @@ -100,25 +110,27 @@
<div class="text-gray-300 font-bold">Auto Update</div>
<div class="flex flex-row items-center justify-between mb-2">
{#if packageManaged}
<span class="text-sm">Update from Package Manager</span>
<span class="text-sm">Update from Package Manager</span>
{:else}
<label class="text-sm" for="selfUpdate">Auto Update Enabled</label>
<input
class="checkbox"
type="checkbox"
id="selfUpdate"
name="selfUpdate"
checked={selfUpdate}
on:input={toggleSelfUpdate}
/>
<label class="text-sm" for="selfUpdate">Auto Update Enabled</label>
<input
class="checkbox"
type="checkbox"
id="selfUpdate"
name="selfUpdate"
checked={selfUpdate}
on:input={toggleSelfUpdate}
/>
{/if}
</div>
<div class="mb-1">
<div class="text-gray-300 font-bold">Logs</div>
<div class="flex flex-row items-center justify-between">
<div class="text-gray-200 text-xs">{logPathCleaned}</div>
<div>
<button class="settings-button" on:click={(event) => window.runtime.BrowserOpenURL(logPath)}
<button
class="settings-button"
on:click={(event) => window.runtime.BrowserOpenURL(logPath)}
>Open</button
>
</div>
Expand Down
39 changes: 0 additions & 39 deletions frontend/wailsjs/go/bindings.d.ts

This file was deleted.

Loading

0 comments on commit cca658b

Please sign in to comment.