Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
Philipp Dormann | 7f7b743f41 | |
Philipp Dormann | ee6af3e069 | |
Philipp Dormann | ea08127927 | |
Philipp Dormann | e0f400a800 | |
Philipp Dormann | c485898b7d |
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -2,8 +2,18 @@
|
|||
|
||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
||||
|
||||
#### [0.1.4](https://git.odit.services/lfk/beamershow/compare/0.1.3...0.1.4)
|
||||
|
||||
- cleanup invalid track stuff (leftovers from scanclient) [`c485898`](https://git.odit.services/lfk/beamershow/commit/c485898b7db7ae09f6e405e12aa6d458833f2dcf)
|
||||
- bullet-proof login ux [`ea08127`](https://git.odit.services/lfk/beamershow/commit/ea08127927e2b1ebcbcd7907fbf51a66a43da421)
|
||||
- add rst command [`ee6af3e`](https://git.odit.services/lfk/beamershow/commit/ee6af3e06921ef33651076b8767149c2df3a1f2d)
|
||||
- Settings: reload on lang change [`e0f400a`](https://git.odit.services/lfk/beamershow/commit/e0f400a800f2652cf3edf2ac0a5f802b65d0c460)
|
||||
|
||||
#### [0.1.3](https://git.odit.services/lfk/beamershow/compare/0.1.2...0.1.3)
|
||||
|
||||
> 8 April 2021
|
||||
|
||||
- 🚀Bumped version to 0.1.3 [`80f5c38`](https://git.odit.services/lfk/beamershow/commit/80f5c38c364c02d70a99f0e06ea9153e10438bfb)
|
||||
- Fixed image name [`205e09e`](https://git.odit.services/lfk/beamershow/commit/205e09e2fc6a2a49251278a8ead31e1718ac7e44)
|
||||
|
||||
#### [0.1.2](https://git.odit.services/lfk/beamershow/compare/0.1.1...0.1.2)
|
||||
|
|
5995
licenses.md
5995
licenses.md
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lfk/beamershow",
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.4",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
|
|
|
@ -12,12 +12,10 @@
|
|||
import Login from "./Login.svelte";
|
||||
import Settings from "./Settings.svelte";
|
||||
export let settings_open = false;
|
||||
$: is_configured =
|
||||
$apikey &&
|
||||
$apikey !== "null" &&
|
||||
$apikey !== "" &&
|
||||
$laptime_track != 0 &&
|
||||
$laptime_track != null;
|
||||
$: is_configured = $apikey?.length === 44 && $api_endpoint?.includes("://");
|
||||
// &&
|
||||
// $laptime_track != 0 &&
|
||||
// $laptime_track != null;
|
||||
init({
|
||||
fallbackLocale: "en-US",
|
||||
initialLocale: $lang,
|
||||
|
@ -29,12 +27,12 @@
|
|||
if (e.key === "Escape") {
|
||||
modal_open = false;
|
||||
}
|
||||
if (e.keyCode === 13) {
|
||||
if (createbtnenabled === true) {
|
||||
createbtnenabled = false;
|
||||
submit();
|
||||
}
|
||||
}
|
||||
// if (e.keyCode === 13) {
|
||||
// if (createbtnenabled === true) {
|
||||
// createbtnenabled = false;
|
||||
// submit();
|
||||
// }
|
||||
// }
|
||||
if (command === "" && e.key === "c") {
|
||||
command = "c";
|
||||
} else if (command === "c" && e.key === "n") {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script>
|
||||
import { apikey, lang, api_endpoint, laptime_track } from "./store.js";
|
||||
import { apikey, lang, api_endpoint, laptime_track, clear } from "./store.js";
|
||||
import isURL from "validator/lib/isURL";
|
||||
import isUUID from "validator/lib/isUUID";
|
||||
import axios from "axios";
|
||||
|
@ -10,10 +10,12 @@
|
|||
$: error = false;
|
||||
$: errormessage = "";
|
||||
$: isTokenValid =
|
||||
token?.length === 44 &&
|
||||
token.split(".")[0].length === 7 &&
|
||||
isUUID(token.split(".")[1]);
|
||||
$: isEndpointValid = isURL(api_endpoint_input);
|
||||
token === "rst" ||
|
||||
(token?.length === 44 &&
|
||||
token.split(".")[0].length === 7 &&
|
||||
isUUID(token.split(".")[1]));
|
||||
$: isEndpointValid =
|
||||
api_endpoint_input === "rst" || isURL(api_endpoint_input);
|
||||
</script>
|
||||
|
||||
<div class="w-full flex flex-wrap">
|
||||
|
@ -62,11 +64,15 @@
|
|||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if $api_endpoint && !$apikey}
|
||||
{#if $api_endpoint?.includes("://") && (!$apikey || $apikey == null)}
|
||||
<form
|
||||
class="flex flex-col pt-3 md:pt-8"
|
||||
onsubmit="event.preventDefault();"
|
||||
on:submit={() => {
|
||||
if (token === "rst") {
|
||||
clear();
|
||||
return;
|
||||
}
|
||||
axios
|
||||
.request({
|
||||
method: "GET",
|
||||
|
@ -112,42 +118,19 @@
|
|||
>{$_("configure")}</button
|
||||
>
|
||||
</form>
|
||||
{:else if $api_endpoint && $apikey}
|
||||
<form
|
||||
class="flex flex-col pt-3 md:pt-8"
|
||||
onsubmit="event.preventDefault();"
|
||||
on:submit={() => {
|
||||
laptime_track.set(track);
|
||||
}}
|
||||
>
|
||||
<div class="flex flex-col pt-4">
|
||||
<label for="track" class="text-lg">{$_("track_id")}</label>
|
||||
<input
|
||||
type="number"
|
||||
id="track"
|
||||
placeholder="Track"
|
||||
bind:value={track}
|
||||
class:border-red-500={!isTokenValid}
|
||||
class:border-solid={!isTokenValid}
|
||||
class:border-3={!isTokenValid}
|
||||
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mt-1 leading-tight focus:outline-none focus:shadow-outline"
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
disabled={!track}
|
||||
class:cursor-pointer={track}
|
||||
class:opacity-50={!track}
|
||||
id="configure"
|
||||
type="submit"
|
||||
class="bg-black text-white font-bold text-lg hover:bg-gray-700 p-2 mt-8 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-black"
|
||||
>{$_("configure")}</button
|
||||
>
|
||||
</form>
|
||||
{:else}
|
||||
<form
|
||||
class="flex flex-col pt-3 md:pt-8"
|
||||
onsubmit="event.preventDefault();"
|
||||
on:submit={() => {
|
||||
if (api_endpoint_input === "rst") {
|
||||
clear();
|
||||
api_endpoint_input = "";
|
||||
return;
|
||||
}
|
||||
if (api_endpoint_input.includes("api/")) {
|
||||
api_endpoint_input = api_endpoint_input.replace("api/", "");
|
||||
}
|
||||
if (api_endpoint_input.substr(-1) !== "/") {
|
||||
api_endpoint_input = api_endpoint_input + "/";
|
||||
}
|
||||
|
|
|
@ -13,14 +13,13 @@
|
|||
<p class="block text-sm text-gray-700">{$api_endpoint}</p>
|
||||
<p class="block text-sm font-bold text-gray-700 mt-2">{$_("api_key")}</p>
|
||||
<p class="block text-sm text-gray-700">{$apikey}</p>
|
||||
<p class="block text-sm font-bold text-gray-700 mt-2">{$_("track_id")}</p>
|
||||
<p class="block text-sm text-gray-700">{$laptime_track}</p>
|
||||
<p class="block text-sm font-bold text-gray-700 mt-2">{$_("language")}</p>
|
||||
<div class="w-full">
|
||||
<div class="inline-block mr-2 mt-2">
|
||||
<button
|
||||
on:click={() => {
|
||||
lang.set("de-DE");
|
||||
location.reload();
|
||||
}}
|
||||
type="button"
|
||||
class:bg-blue-700={$lang === "de-DE"}
|
||||
|
@ -46,6 +45,7 @@
|
|||
<button
|
||||
on:click={() => {
|
||||
lang.set("en-EN");
|
||||
location.reload();
|
||||
}}
|
||||
type="button"
|
||||
class:bg-blue-700={$lang === "en-EN"}
|
||||
|
|
22
src/store.js
22
src/store.js
|
@ -1,29 +1,39 @@
|
|||
import { writable } from 'svelte/store';
|
||||
|
||||
const stored_api_endpoint = localStorage.getItem('api_endpoint')||"";
|
||||
const stored_api_endpoint = localStorage.getItem('api_endpoint');
|
||||
export const api_endpoint = writable(stored_api_endpoint);
|
||||
api_endpoint.subscribe((value) => {
|
||||
localStorage.setItem('api_endpoint', value);
|
||||
if (value != null) {
|
||||
localStorage.setItem('api_endpoint', value);
|
||||
}
|
||||
});
|
||||
const stored_apikey = localStorage.getItem('apikey');
|
||||
export const apikey = writable(stored_apikey);
|
||||
apikey.subscribe((value) => {
|
||||
localStorage.setItem('apikey', value);
|
||||
if (value != null) {
|
||||
localStorage.setItem('apikey', value);
|
||||
}
|
||||
});
|
||||
const stored_laptime_track = localStorage.getItem('laptime_track');
|
||||
export const laptime_track = writable(stored_laptime_track);
|
||||
laptime_track.subscribe((value) => {
|
||||
localStorage.setItem('laptime_track', value);
|
||||
if (value != null) {
|
||||
localStorage.setItem('laptime_track', value);
|
||||
}
|
||||
});
|
||||
const stored_lang = localStorage.getItem('lang') === 'null' ? navigator.language : localStorage.getItem('lang');
|
||||
export const lang = writable(stored_lang);
|
||||
lang.subscribe((value) => {
|
||||
localStorage.setItem('lang', value);
|
||||
if (value != null) {
|
||||
localStorage.setItem('lang', value);
|
||||
}
|
||||
});
|
||||
|
||||
export function clear(){
|
||||
export function clear() {
|
||||
api_endpoint.set(null)
|
||||
api_endpoint.set("")
|
||||
apikey.set(null);
|
||||
apikey.set("");
|
||||
laptime_track.set(null)
|
||||
localStorage.clear();
|
||||
}
|
Loading…
Reference in New Issue