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

Commit

Permalink
Fix links on about page
Browse files Browse the repository at this point in the history
  • Loading branch information
achhabra2 committed Dec 15, 2021
1 parent f757ea9 commit 614ed77
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (b *App) shutdown(ctx context.Context) {

// Greet returns a greeting for the given name
func (b *App) OpenDirectoryDialog() ([]string, error) {
opts := runtime.OpenDialogOptions{Title: "Select Directory", DefaultDirectory: b.GetDownloadsFolder(), AllowDirectories: true}
opts := runtime.OpenDialogOptions{Title: "Select Directory", DefaultDirectory: b.GetDownloadsFolder()}
selection, err := runtime.OpenDirectoryDialog(b.ctx, opts)
if err != nil {
runtime.LogError(b.ctx, "Error opening dialog")
Expand All @@ -89,7 +89,7 @@ func (b *App) OpenDirectoryDialog() ([]string, error) {
}

func (b *App) OpenFilesDialog() ([]string, error) {
opts := runtime.OpenDialogOptions{Title: "Select File", AllowFiles: true, DefaultDirectory: b.GetDownloadsFolder()}
opts := runtime.OpenDialogOptions{Title: "Select File", DefaultDirectory: b.GetDownloadsFolder()}
selection, err := runtime.OpenMultipleFilesDialog(b.ctx, opts)
if err != nil {
runtime.LogError(b.ctx, "Error opening dialog")
Expand Down Expand Up @@ -345,7 +345,7 @@ func (b *App) GetCurrentVersion() string {
}

func (b *App) SetDownloadsFolder() string {
opts := runtime.OpenDialogOptions{Title: "Select Directory", DefaultDirectory: b.GetDownloadsFolder(), AllowDirectories: true}
opts := runtime.OpenDialogOptions{Title: "Select Directory", DefaultDirectory: b.GetDownloadsFolder()}
selection, err := runtime.OpenDirectoryDialog(b.ctx, opts)
if err != nil {
runtime.LogInfo(b.ctx, "Error opening dialog")
Expand Down
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.

8 changes: 5 additions & 3 deletions frontend/src/about.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script>
import go from "../wailsjs/go/bindings";
// import runtime from "../wailsjs/runtime";
import { onMount } from "svelte";
let version = "";
const attributions = {
Expand All @@ -23,8 +25,8 @@
<div class="container p4 text-gray-200">
<div>
Riftshare v{version}
<a class="text-blue-600" target="_blank" href="https://github.com/achhabra2/riftshare"
>Github</a
<button class="text-blue-600" on:click={(event) => window.runtime.BrowserOpenURL("https://github.com/achhabra2/riftshare")}
>Github</button
>
</div>

Expand All @@ -40,7 +42,7 @@
</p>
<ul class="text-xs file-list">
{#each Object.entries(attributions) as [name, url]}
<li><a class="text-blue-500" target="_blank" href={url}>{name}</a></li>
<li><button class="text-blue-500" on:click={(event) => window.runtime.BrowserOpenURL(url)}>{name}</button></li>
{/each}
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/klauspost/compress v1.12.2
github.com/psanford/wormhole-william v1.0.5
github.com/rhysd/go-github-selfupdate v1.2.3
github.com/wailsapp/wails/v2 v2.0.0-beta.22
github.com/wailsapp/wails/v2 v2.0.0-beta.23
gopkg.in/yaml.v2 v2.4.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ github.com/valyala/fasthttp v1.28.0/go.mod h1:cmWIqlu99AO/RKcp1HWaViTqc57FswJOfY
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wailsapp/wails/v2 v2.0.0-beta.22 h1:Nw9JY2RKJY0WCZRprpLgZgvH2msZqcYe2UN/u41xRR8=
github.com/wailsapp/wails/v2 v2.0.0-beta.22/go.mod h1:psE2/BOIiyBlyKXTulol8AZBz+REhdyYR3WSF4Or5bQ=
github.com/wailsapp/wails/v2 v2.0.0-beta.23 h1:D+VzWWkP4PYRbqlmrfX0WMoBKJcIo1gIXPbG0DQG1Xg=
github.com/wailsapp/wails/v2 v2.0.0-beta.23/go.mod h1:psE2/BOIiyBlyKXTulol8AZBz+REhdyYR3WSF4Or5bQ=
github.com/wzshiming/ctc v1.2.3/go.mod h1:2tVAtIY7SUyraSk0JxvwmONNPFL4ARavPuEsg5+KA28=
github.com/wzshiming/winseq v0.0.0-20200112104235-db357dc107ae/go.mod h1:VTAq37rkGeV+WOybvZwjXiJOicICdpLCN8ifpISjK20=
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
Expand Down
9 changes: 7 additions & 2 deletions internal/settings/user_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func GetUserSettings() (UserSettings, error) {
prefs, err := openPrefFile()
if err != nil {
log.Println(err)
return UserSettings{}, err
}
defer prefs.Close()

Expand All @@ -45,6 +46,7 @@ func GetUserSettings() (UserSettings, error) {
err = decoder.Decode(&settings)
if err != nil {
log.Println(err)
return UserSettings{}, err
}

// Check if file is empty
Expand Down Expand Up @@ -74,18 +76,21 @@ func openPrefFile() (*os.File, error) {
dir, err := GetSettingsDirectory()
if err != nil {
log.Println(err)
return &os.File{}, err
}
if _, err := os.Stat(dir); os.IsNotExist(err) {
log.Println("No Pref Directory Found, creating..")
err = os.Mkdir(dir, 0777)
if err != nil {
log.Println(err)
// log.Println(err)
return &os.File{}, err
}
}
settingsPath := filepath.Join(dir, "riftshare_config.yaml")
prefs, err := os.OpenFile(settingsPath, os.O_RDWR|os.O_CREATE, 0666)
if err != nil {
log.Println(err)
return &os.File{}, err
}
return prefs, nil
}
}

0 comments on commit 614ed77

Please sign in to comment.