···11-<!doctype html>
22-<html lang="en">
33- <head>
44- <meta charset="UTF-8" />
55- <title>Position Share – Signup</title>
66- <script type="module" src="/src/main.ts"></script>
77- <link rel="stylesheet" href="/src/styles.css" />
88- </head>
99-1010- <body>
1111- <div class="card">
1212- <div class="header">
1313- <div class="icon-circle">
1414- <img src="./src/assets/pin.svg" alt="Pin Icon" />
1515- </div>
1616- <h1>Position Share</h1>
1717- <p>Connect with your server to start sharing</p>
1818- </div>
1919-2020- <!-- x-data connects this element to the signupState Alpine component, enabling its data (serverAddress and signupKey) and functions (signup and scanQR) to work within it :) -->
2121- <div class="actions" x-data="signupState">
2222- <div>
2323- <label for="server">Server Address</label>
2424- <input id="server" type="url" placeholder="https://your-server.com" x-model="serverAddress" required />
2525- </div>
2626-2727- <div>
2828- <label for="key">Signup Key</label>
2929- <input id="key" type="password" placeholder="Enter your signup key" x-model="signupKey" required />
3030- </div>
3131-3232- <p class="hint">Scan a QR code to automatically fill both server address and signup key</p>
3333- <button type="button" class="btn-qr" @click="scanQR">
3434- <img src="./src/assets/qr.svg" alt="QR Icon" />
3535- Scan QR Code
3636- </button>
3737-3838- <button class="btn-primary" @click="signup">Connect</button>
3939- </div>
4040- </div>
4141-4242- <script>
4343- function signupState() {
4444- return {
4545- serverAddress: "",
4646- signupKey: "",
4747- // we have the functions within a bigger function because this is how we can access the variables we define (by using this.variableWeWant)
4848- signup() {
4949- alert(this.serverAddress);
5050- },
5151- scanQR() {
5252- alert(this.signupKey);
5353- },
5454- };
5555- }
5656- </script>
5757- </body>
5858-</html>
+11-59
app/index.html
···11-<!doctype html>
22-<html lang="en">
33- <head>
44- <meta charset="UTF-8" />
55- <script type="module">
66- import Alpine from "alpinejs";
77- window.Alpine = Alpine;
88- Alpine.start();
99- </script>
1010- <link rel="stylesheet" href="/src/styles.css" />
1111- </head>
1212-1313- <body>
1414- <div class="card">
1515- <div class="header">
1616- <div class="icon-circle">
1717- <img src="./src/assets/pin.svg" alt="Pin Icon" />
1818- </div>
1919- <h1>Position Share</h1>
2020- <p>Connect with your server to start sharing</p>
2121- </div>
2222-2323- <!-- x-data connects this element to the signupState Alpine component, enabling its data (serverAddress and signupKey) and functions (signup and scanQR) to work within it :) -->
2424- <div class="actions" x-data="signupState">
2525- <div>
2626- <label for="server">Server Address</label>
2727- <input id="server" type="url" placeholder="https://your-server.com" x-model="serverAddress" required />
2828- </div>
2929-3030- <div>
3131- <label for="key">Signup Key</label>
3232- <input id="key" type="password" placeholder="Enter your signup key" x-model="signupKey" required />
3333- </div>
3434-3535- <p class="hint">Scan a QR code to automatically fill both server address and signup key</p>
3636- <button type="button" class="btn-qr" @click="scanQR">
3737- <img src="./src/assets/qr.svg" alt="QR Icon" />
3838- Scan QR Code
3939- </button>
11+<script type="module">
22+ import { Store } from "/src/utils/store.ts";
4034141- <button class="btn-primary" @click="signup">Connect</button>
4242- </div>
4343- </div>
44+ // For testing (to easily go to home or signup page). You only need to uncomment the right line, run it once, and comment it out again right after
55+ // await Store.reset();
66+ // await Store.set("user_id", "adummyuserid");
4474545- <script>
4646- function signupState() {
4747- return {
4848- serverAddress: "",
4949- signupKey: "",
5050- // we have the functions within a bigger function because this is how we can access the variables we define (by using this.variableWeWant)
5151- signup() {
5252- alert(this.serverAddress);
5353- },
5454- scanQR() {
5555- alert(this.signupKey);
5656- },
5757- };
5858- }
5959- </script>
6060- </body>
6161-</html>
88+ if (await Store.isLoggedIn()) {
99+ window.location.href = "/src/home-page/home.html";
1010+ } else {
1111+ window.location.href = "/src/signup-page/signup.html";
1212+ }
1313+</script>
+5-8
app/src-tauri/capabilities/default.json
···11{
22- "$schema": "../gen/schemas/desktop-schema.json",
33- "identifier": "default",
44- "description": "Capability for the main window",
55- "windows": ["main"],
66- "permissions": [
77- "core:default",
88- "opener:default"
99- ]
22+ "$schema": "../gen/schemas/desktop-schema.json",
33+ "identifier": "default",
44+ "description": "Capability for the main window",
55+ "windows": ["main"],
66+ "permissions": ["core:default", "opener:default", "store:default"]
107}