Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Authentication state
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Jul 16, 2022
1 parent 4e709ca commit 4c5c877
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
5 changes: 4 additions & 1 deletion core/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
},
"tauri": {
"allowlist": {
"all": true
"all": true,
"fs": {
"scope": ["$CONFIG/Levminer/*"]
}
},
"bundle": {
"active": true,
Expand Down
4 changes: 3 additions & 1 deletion interface/components/navigation.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="transparent-900 flex h-full flex-col justify-between overflow-visible shadow-2xl">
<div class="transparent-900 flex h-full flex-col justify-between overflow-visible rounded-tr-xl shadow-2xl">
<div class="flex flex-col">
<a href="/codes" use:active data-active-class="selectedMenuButton" class="menuButton mt-3">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
Expand Down Expand Up @@ -48,6 +48,8 @@
</svg>
About
</button>

<a href="/" class="menuButton mx-3 mt-0"> Landing </a>
</div>
</div>

Expand Down
25 changes: 22 additions & 3 deletions interface/layout/app.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
</svelte:head>

<div class="flex h-screen">
<Navigation />
{#if $state.authenticated}
<Navigation />
{/if}

<div class="w-full overflow-hidden overflow-y-scroll">
<div class="top" />
Expand All @@ -22,10 +24,14 @@
<script lang="ts">
import { Route, router } from "tinro"
import { onMount } from "svelte"
import { getSettings } from "../stores/settings"
import { navigate } from "../../libraries/navigate"
import UpdateAlert from "../components/updateAlert.svelte"
import { state } from "../stores/state"
import Landing from "../windows/landing.svelte"
// import UpdateAlert from "../components/updateAlert.svelte"
import Landing from "../windows/landing/landing.svelte"
import Codes from "../windows/codes/codes.svelte"
import Settings from "../windows/settings.svelte"
import Import from "../windows/import/import.svelte"
Expand All @@ -38,5 +44,18 @@
router.subscribe(() => {
document.querySelector(".top").scrollIntoView()
})
const settings = getSettings()
if (settings.security.requireAuthentication === false) {
// eslint-disable-next-line no-undef
state.update((data: LibState) => {
data.authenticated = true
return data
})
navigate("codes")
}
})
</script>
18 changes: 18 additions & 0 deletions interface/layout/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
import App from "./app.svelte"
import "../styles/index.css"
import { fs, path, window } from "@tauri-apps/api"

const getSettingsPath = async () => {
const folderPath = await path.join(await path.configDir(), "Levminer", "Authme 4")
fs.createDir(folderPath, { recursive: true })

const settingsPath = await path.join(folderPath, "settings")
fs.createDir(settingsPath, { recursive: true })

const codesPath = await path.join(folderPath, "codes")
fs.createDir(codesPath, { recursive: true })
}

getSettingsPath()

const mainWindow = new window.WindowManager("Authme")

console.log(mainWindow)

const app = new App({
target: document.body,
Expand Down

0 comments on commit 4c5c877

Please sign in to comment.