Compare commits
	
		
			13 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 5be665b65f | |||
| 324612b5dd | |||
| ca1c96b252 | |||
| d284e8184c | |||
| 701aae9ed4 | |||
| 7f7b743f41 | |||
| ee6af3e069 | |||
| ea08127927 | |||
| e0f400a800 | |||
| c485898b7d | |||
| 80f5c38c36 | |||
| 205e09e2fc | |||
| 9125dec45b | 
							
								
								
									
										45
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								.drone.yml
									
									
									
									
									
								
							| @@ -12,6 +12,13 @@ get: | |||||||
|   path: odit-registry-builder |   path: odit-registry-builder | ||||||
|   name: password |   name: password | ||||||
|  |  | ||||||
|  | --- | ||||||
|  | kind: secret | ||||||
|  | name: npm_url | ||||||
|  | get: | ||||||
|  |   path: odit-npm-cache | ||||||
|  |   name: url | ||||||
|  |  | ||||||
| --- | --- | ||||||
| kind: pipeline | kind: pipeline | ||||||
| type: kubernetes | type: kubernetes | ||||||
| @@ -26,7 +33,10 @@ steps: | |||||||
|         from_secret: docker_username |         from_secret: docker_username | ||||||
|       password: |       password: | ||||||
|         from_secret: docker_password |         from_secret: docker_password | ||||||
|       repo: registry.odit.services/lfk/selfservice |       build_args: | ||||||
|  |         - NPM_REGISTRY_URL: | ||||||
|  |           from_secret: npm_url | ||||||
|  |       repo: registry.odit.services/lfk/beamershow | ||||||
|       tags: |       tags: | ||||||
|         - dev |         - dev | ||||||
|       registry: registry.odit.services |       registry: registry.odit.services | ||||||
| @@ -37,6 +47,34 @@ trigger: | |||||||
|   event: |   event: | ||||||
|     - push |     - push | ||||||
|  |  | ||||||
|  | --- | ||||||
|  | kind: pipeline | ||||||
|  | type: kubernetes | ||||||
|  | name: build:latest | ||||||
|  |  | ||||||
|  | steps: | ||||||
|  |   - name: build latest | ||||||
|  |     image: plugins/docker | ||||||
|  |     depends_on: [clone] | ||||||
|  |     settings: | ||||||
|  |       username: | ||||||
|  |         from_secret: docker_username | ||||||
|  |       password: | ||||||
|  |         from_secret: docker_password | ||||||
|  |       build_args: | ||||||
|  |         - NPM_REGISTRY_URL: | ||||||
|  |           from_secret: npm_url | ||||||
|  |       repo: registry.odit.services/lfk/beamershow | ||||||
|  |       tags: | ||||||
|  |         - latest | ||||||
|  |       registry: registry.odit.services | ||||||
|  |       mtu: 1000 | ||||||
|  | trigger: | ||||||
|  |   branch: | ||||||
|  |     - main | ||||||
|  |   event: | ||||||
|  |     - push | ||||||
|  |  | ||||||
| --- | --- | ||||||
| kind: pipeline | kind: pipeline | ||||||
| type: kubernetes | type: kubernetes | ||||||
| @@ -50,7 +88,10 @@ steps: | |||||||
|         from_secret: docker_username |         from_secret: docker_username | ||||||
|       password: |       password: | ||||||
|         from_secret: docker_password |         from_secret: docker_password | ||||||
|       repo: registry.odit.services/lfk/selfservice |       build_args: | ||||||
|  |         - NPM_REGISTRY_URL: | ||||||
|  |           from_secret: npm_url | ||||||
|  |       repo: registry.odit.services/lfk/beamershow | ||||||
|       tags: |       tags: | ||||||
|         - '${DRONE_TAG}' |         - '${DRONE_TAG}' | ||||||
|       registry: registry.odit.services |       registry: registry.odit.services | ||||||
|   | |||||||
							
								
								
									
										66
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										66
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -2,4 +2,70 @@ | |||||||
|  |  | ||||||
| All notable changes to this project will be documented in this file. Dates are displayed in UTC. | All notable changes to this project will be documented in this file. Dates are displayed in UTC. | ||||||
|  |  | ||||||
|  | #### [0.1.5](https://git.odit.services/lfk/beamershow/compare/0.1.4...0.1.5) | ||||||
|  |  | ||||||
|  | - Switched dockerfile over to pnpm + cache [`701aae9`](https://git.odit.services/lfk/beamershow/commit/701aae9ed4af66b973e88fec384e46752fcb9ca2) | ||||||
|  | - Switched ci over to pnpm cache [`324612b`](https://git.odit.services/lfk/beamershow/commit/324612b5ddc1cf148a7750a02cdce557bef54d38) | ||||||
|  | - pinned dependencies [`d284e81`](https://git.odit.services/lfk/beamershow/commit/d284e8184c5a3c357398e3ab5a24a2e611001640) | ||||||
|  | - Docker copy all [`ca1c96b`](https://git.odit.services/lfk/beamershow/commit/ca1c96b252c9665b94dd9ef37c700afbb0039d46) | ||||||
|  |  | ||||||
|  | #### [0.1.4](https://git.odit.services/lfk/beamershow/compare/0.1.3...0.1.4) | ||||||
|  |  | ||||||
|  | > 5 February 2023 | ||||||
|  |  | ||||||
|  | - 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) | ||||||
|  | - 🚀Bumped version to 0.1.4 [`7f7b743`](https://git.odit.services/lfk/beamershow/commit/7f7b743f414b77902a358b6bd813412096d195b3) | ||||||
|  | - 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) | ||||||
|  |  | ||||||
|  | > 8 April 2021 | ||||||
|  |  | ||||||
|  | - 🚀Bumped version to 0.1.2 [`9125dec`](https://git.odit.services/lfk/beamershow/commit/9125dec45b41f80445cd6cc75436f5a63de2fd98) | ||||||
|  |  | ||||||
| #### 0.1.1 | #### 0.1.1 | ||||||
|  |  | ||||||
|  | > 7 April 2021 | ||||||
|  |  | ||||||
|  | - Sorted translations 🌍 [`#1`](https://git.odit.services/lfk/beamershow/issues/1) | ||||||
|  | - 🎉 initial commit [`b902b08`](https://git.odit.services/lfk/beamershow/commit/b902b081d7e2e80fdf167657f3c2fda79b888985) | ||||||
|  | - formatting... [`866436f`](https://git.odit.services/lfk/beamershow/commit/866436fa82882dffe6f2f45bd303effc67d92a37) | ||||||
|  | - Added/updated settings translations [`b367648`](https://git.odit.services/lfk/beamershow/commit/b36764869bf1e302713d457b3ba3ec804c5d38f7) | ||||||
|  | - 🚀Bumped version to 0.1.1 [`94ceca9`](https://git.odit.services/lfk/beamershow/commit/94ceca9454da77d29f975cf894d2304dcc60c481) | ||||||
|  | - i18n run [`c5e4fac`](https://git.odit.services/lfk/beamershow/commit/c5e4facffa19578db95315d53bd0befc936016e4) | ||||||
|  | - Added drone file for dev and tag build [`d809dcb`](https://git.odit.services/lfk/beamershow/commit/d809dcba799a94c6ed5a6cfac551d14c1a2cbadd) | ||||||
|  | - You can now go back to config by typeing cnf [`9135090`](https://git.odit.services/lfk/beamershow/commit/9135090e73ff6fc021b4f7f80b3780b3ff73ad02) | ||||||
|  | - Added top teams by distance page [`d78e896`](https://git.odit.services/lfk/beamershow/commit/d78e896fecf5f7975267f3a1c3faf8b5c8728c25) | ||||||
|  | - Added nginx conf for dockerfile [`b3b06bc`](https://git.odit.services/lfk/beamershow/commit/b3b06bc30e4043d3f7b874e939a090f85841a516) | ||||||
|  | - Implemented fix for url crashing [`7f6134d`](https://git.odit.services/lfk/beamershow/commit/7f6134d0efd1a6a1161acc2c8bc8c4496c529ffe) | ||||||
|  | - Added html/template for the top runenry by laptime [`3275ae2`](https://git.odit.services/lfk/beamershow/commit/3275ae2609ef966183ca66a0234ff7f570eaef81) | ||||||
|  | - Added release comand and config [`ca48959`](https://git.odit.services/lfk/beamershow/commit/ca489595812da8756629a498d673e3206cb66a2f) | ||||||
|  | - Added track to config [`abdc510`](https://git.odit.services/lfk/beamershow/commit/abdc5103055844da73438e8dfbb0eea2b41105d1) | ||||||
|  | - removed unused stuff from the store [`cb559da`](https://git.odit.services/lfk/beamershow/commit/cb559da57c58a1998f54beb83bee837e0a8b71e7) | ||||||
|  | - Implemented settings dialog [`de7e96c`](https://git.odit.services/lfk/beamershow/commit/de7e96cd01f70bfff80f42e7c709e67d44681920) | ||||||
|  | - Added js part of runners by laptime [`10b862d`](https://git.odit.services/lfk/beamershow/commit/10b862d43ac35122c1cc4eaed30e7ac8228d294f) | ||||||
|  | - User quickstart docs README [`19cc7d0`](https://git.odit.services/lfk/beamershow/commit/19cc7d0c28ff56481fc37cc98b341259566a39ed) | ||||||
|  | - Removed license export from drone pipelines [`e5c51b9`](https://git.odit.services/lfk/beamershow/commit/e5c51b956e210f3f4652f020edefb0de5bb789d9) | ||||||
|  | - Formatting [`fca7a99`](https://git.odit.services/lfk/beamershow/commit/fca7a99689469f8a8b281f643346b3281036ee40) | ||||||
|  | - added svelte transitions [`1f95b8b`](https://git.odit.services/lfk/beamershow/commit/1f95b8ba53e3152517d730ad6b3b39dc472bb386) | ||||||
|  | - Added 2-staged dockerfile [`c83ff39`](https://git.odit.services/lfk/beamershow/commit/c83ff39677c4575346a0b7eced95796de90d6fee) | ||||||
|  | - Precommit hooks doing their best to not die [`85b40c1`](https://git.odit.services/lfk/beamershow/commit/85b40c10bffa15ad381e51fee348bb014780d5d8) | ||||||
|  | - Renamed Firma -> Organsiation [`3e7b120`](https://git.odit.services/lfk/beamershow/commit/3e7b1201e25da7dcc2f6be2b4b826b90d616dd67) | ||||||
|  | - Added beamershow docker-compose [`b42684f`](https://git.odit.services/lfk/beamershow/commit/b42684f7fc8e40740a6511d895af03f7f110e2a4) | ||||||
|  | - Updated release-it config [`cfd64c2`](https://git.odit.services/lfk/beamershow/commit/cfd64c2f19dabd8aa758aefd02342935c54e20de) | ||||||
|  | - Renamed Firma -Y Organsiation [`662e31b`](https://git.odit.services/lfk/beamershow/commit/662e31b36674f66696a4a4bc3ca4abae3efd93bb) | ||||||
|  | - CNF now opens settings [`d5ce648`](https://git.odit.services/lfk/beamershow/commit/d5ce648a53bb70a1c4ad7f2b12c334e328e36448) | ||||||
|  | - Added missing let [`70e5f17`](https://git.odit.services/lfk/beamershow/commit/70e5f172a66dcad64353f8469ebb845a1b4895bb) | ||||||
|  | - Added missing let [`fa35ac8`](https://git.odit.services/lfk/beamershow/commit/fa35ac8254028570bd3e425276a008fe83887f09) | ||||||
|  | - Updated release-it config [`a7e84c7`](https://git.odit.services/lfk/beamershow/commit/a7e84c7d426525a5041f0ec260cd57dcfd107afb) | ||||||
|  | - Added url validation fix [`64ce42d`](https://git.odit.services/lfk/beamershow/commit/64ce42d8a04cc4b149db7f75be5ff0d9fbfb3a75) | ||||||
|  | - removed useless console log [`fe0cba9`](https://git.odit.services/lfk/beamershow/commit/fe0cba9058a1874058618ef3b697093fcfc78a99) | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								Dockerfile
									
									
									
									
									
								
							| @@ -1,12 +1,12 @@ | |||||||
| FROM node:15.11.0-alpine3.13 | FROM registry.odit.services/hub/library/node:19.8.1-alpine3.16 as build | ||||||
|  | ARG NPM_REGISTRY_URL=https://registry.npmjs.org | ||||||
| WORKDIR /app | WORKDIR /app | ||||||
| COPY . . |  | ||||||
| RUN yarn | COPY . ./ | ||||||
| RUN yarn build | RUN npm config set registry $NPM_REGISTRY_URL && npm i -g pnpm@8 && pnpm i | ||||||
|  | RUN pnpm build | ||||||
|  |  | ||||||
| # final image | # final image | ||||||
| FROM alpine | FROM registry.odit.services/library/nginx-brotli:3.15 as final | ||||||
| COPY --from=0 /app/dist /app | COPY --from=build /app/dist /usr/share/nginx/html | ||||||
| FROM fholzer/nginx-brotli:v1.19.1 |  | ||||||
| COPY --from=1 /app /usr/share/nginx/html |  | ||||||
| COPY ./nginx.conf /etc/nginx/nginx.conf | COPY ./nginx.conf /etc/nginx/nginx.conf | ||||||
							
								
								
									
										22
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
| 	"name": "@lfk/beamershow", | 	"name": "@lfk/beamershow", | ||||||
| 	"version": "0.1.1", | 	"version": "0.1.5", | ||||||
| 	"scripts": { | 	"scripts": { | ||||||
| 		"dev": "vite", | 		"dev": "vite", | ||||||
| 		"build": "vite build", | 		"build": "vite build", | ||||||
| @@ -10,20 +10,20 @@ | |||||||
| 		"release": "release-it --only-version" | 		"release": "release-it --only-version" | ||||||
| 	}, | 	}, | ||||||
| 	"devDependencies": { | 	"devDependencies": { | ||||||
| 		"@odit/license-exporter": "^0.0.11", | 		"@odit/license-exporter": "0.0.11", | ||||||
| 		"@svitejs/vite-plugin-svelte": "^0.11.1", | 		"@svitejs/vite-plugin-svelte": "0.11.1", | ||||||
| 		"@tsconfig/svelte": "^1.0.10", | 		"@tsconfig/svelte": "1.0.10", | ||||||
| 		"@types/html-minifier": "^4.0.0", | 		"@types/html-minifier": "4.0.0", | ||||||
| 		"axios": "^0.21.1", | 		"axios": "0.21.1", | ||||||
| 		"html-minifier": "^4.0.0", | 		"html-minifier": "4.0.0", | ||||||
| 		"husky": "^5.1.3", | 		"husky": "5.1.3", | ||||||
| 		"prettier": "^2.2.1", | 		"prettier": "2.2.1", | ||||||
| 		"prettier-plugin-svelte": "^2.2.0", | 		"prettier-plugin-svelte": "2.2.0", | ||||||
| 		"release-it": "14.5.0", | 		"release-it": "14.5.0", | ||||||
| 		"svelte": "3.36.0", | 		"svelte": "3.36.0", | ||||||
| 		"svelte-i18n": "3.3.9", | 		"svelte-i18n": "3.3.9", | ||||||
| 		"svelte-preprocess": "4.7.0", | 		"svelte-preprocess": "4.7.0", | ||||||
| 		"validator": "^13.5.2", | 		"validator": "13.5.2", | ||||||
| 		"vite": "2.1.4", | 		"vite": "2.1.4", | ||||||
| 		"vite-plugin-windicss": "0.11.2" | 		"vite-plugin-windicss": "0.11.2" | ||||||
| 	}, | 	}, | ||||||
|   | |||||||
							
								
								
									
										2644
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										2644
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -12,12 +12,10 @@ | |||||||
|   import Login from "./Login.svelte"; |   import Login from "./Login.svelte"; | ||||||
|   import Settings from "./Settings.svelte"; |   import Settings from "./Settings.svelte"; | ||||||
|   export let settings_open = false; |   export let settings_open = false; | ||||||
|   $: is_configured = |   $: is_configured = $apikey?.length === 44 && $api_endpoint?.includes("://"); | ||||||
|     $apikey && |   // && | ||||||
|     $apikey !== "null" && |   // $laptime_track != 0 && | ||||||
|     $apikey !== "" && |   // $laptime_track != null; | ||||||
|     $laptime_track != 0 && |  | ||||||
|     $laptime_track != null; |  | ||||||
|   init({ |   init({ | ||||||
|     fallbackLocale: "en-US", |     fallbackLocale: "en-US", | ||||||
|     initialLocale: $lang, |     initialLocale: $lang, | ||||||
| @@ -29,12 +27,12 @@ | |||||||
|       if (e.key === "Escape") { |       if (e.key === "Escape") { | ||||||
|         modal_open = false; |         modal_open = false; | ||||||
|       } |       } | ||||||
|       if (e.keyCode === 13) { |       // if (e.keyCode === 13) { | ||||||
|         if (createbtnenabled === true) { |       //   if (createbtnenabled === true) { | ||||||
|           createbtnenabled = false; |       //     createbtnenabled = false; | ||||||
|           submit(); |       //     submit(); | ||||||
|         } |       //   } | ||||||
|       } |       // } | ||||||
|       if (command === "" && e.key === "c") { |       if (command === "" && e.key === "c") { | ||||||
|         command = "c"; |         command = "c"; | ||||||
|       } else if (command === "c" && e.key === "n") { |       } else if (command === "c" && e.key === "n") { | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| <script> | <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 isURL from "validator/lib/isURL"; | ||||||
|   import isUUID from "validator/lib/isUUID"; |   import isUUID from "validator/lib/isUUID"; | ||||||
|   import axios from "axios"; |   import axios from "axios"; | ||||||
| @@ -10,10 +10,12 @@ | |||||||
|   $: error = false; |   $: error = false; | ||||||
|   $: errormessage = ""; |   $: errormessage = ""; | ||||||
|   $: isTokenValid = |   $: isTokenValid = | ||||||
|     token?.length === 44 && |     token === "rst" || | ||||||
|  |     (token?.length === 44 && | ||||||
|       token.split(".")[0].length === 7 && |       token.split(".")[0].length === 7 && | ||||||
|     isUUID(token.split(".")[1]); |       isUUID(token.split(".")[1])); | ||||||
|   $: isEndpointValid = isURL(api_endpoint_input); |   $: isEndpointValid = | ||||||
|  |     api_endpoint_input === "rst" || isURL(api_endpoint_input); | ||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <div class="w-full flex flex-wrap"> | <div class="w-full flex flex-wrap"> | ||||||
| @@ -62,11 +64,15 @@ | |||||||
|           </div> |           </div> | ||||||
|         {/if} |         {/if} | ||||||
|       {/if} |       {/if} | ||||||
|       {#if $api_endpoint && !$apikey} |       {#if $api_endpoint?.includes("://") && (!$apikey || $apikey == null)} | ||||||
|         <form |         <form | ||||||
|           class="flex flex-col pt-3 md:pt-8" |           class="flex flex-col pt-3 md:pt-8" | ||||||
|           onsubmit="event.preventDefault();" |           onsubmit="event.preventDefault();" | ||||||
|           on:submit={() => { |           on:submit={() => { | ||||||
|  |             if (token === "rst") { | ||||||
|  |               clear(); | ||||||
|  |               return; | ||||||
|  |             } | ||||||
|             axios |             axios | ||||||
|               .request({ |               .request({ | ||||||
|                 method: "GET", |                 method: "GET", | ||||||
| @@ -112,42 +118,19 @@ | |||||||
|             >{$_("configure")}</button |             >{$_("configure")}</button | ||||||
|           > |           > | ||||||
|         </form> |         </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} |       {:else} | ||||||
|         <form |         <form | ||||||
|           class="flex flex-col pt-3 md:pt-8" |           class="flex flex-col pt-3 md:pt-8" | ||||||
|           onsubmit="event.preventDefault();" |           onsubmit="event.preventDefault();" | ||||||
|           on:submit={() => { |           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) !== "/") { |             if (api_endpoint_input.substr(-1) !== "/") { | ||||||
|               api_endpoint_input = api_endpoint_input + "/"; |               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 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 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 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> |   <p class="block text-sm font-bold text-gray-700 mt-2">{$_("language")}</p> | ||||||
|   <div class="w-full"> |   <div class="w-full"> | ||||||
|     <div class="inline-block mr-2 mt-2"> |     <div class="inline-block mr-2 mt-2"> | ||||||
|       <button |       <button | ||||||
|         on:click={() => { |         on:click={() => { | ||||||
|           lang.set("de-DE"); |           lang.set("de-DE"); | ||||||
|  |           location.reload(); | ||||||
|         }} |         }} | ||||||
|         type="button" |         type="button" | ||||||
|         class:bg-blue-700={$lang === "de-DE"} |         class:bg-blue-700={$lang === "de-DE"} | ||||||
| @@ -46,6 +45,7 @@ | |||||||
|       <button |       <button | ||||||
|         on:click={() => { |         on:click={() => { | ||||||
|           lang.set("en-EN"); |           lang.set("en-EN"); | ||||||
|  |           location.reload(); | ||||||
|         }} |         }} | ||||||
|         type="button" |         type="button" | ||||||
|         class:bg-blue-700={$lang === "en-EN"} |         class:bg-blue-700={$lang === "en-EN"} | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								src/store.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/store.js
									
									
									
									
									
								
							| @@ -1,29 +1,39 @@ | |||||||
| import { writable } from 'svelte/store'; | 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); | export const api_endpoint = writable(stored_api_endpoint); | ||||||
| api_endpoint.subscribe((value) => { | api_endpoint.subscribe((value) => { | ||||||
|  | 	if (value != null) { | ||||||
| 		localStorage.setItem('api_endpoint', value); | 		localStorage.setItem('api_endpoint', value); | ||||||
|  | 	} | ||||||
| }); | }); | ||||||
| const stored_apikey = localStorage.getItem('apikey'); | const stored_apikey = localStorage.getItem('apikey'); | ||||||
| export const apikey = writable(stored_apikey); | export const apikey = writable(stored_apikey); | ||||||
| apikey.subscribe((value) => { | apikey.subscribe((value) => { | ||||||
|  | 	if (value != null) { | ||||||
| 		localStorage.setItem('apikey', value); | 		localStorage.setItem('apikey', value); | ||||||
|  | 	} | ||||||
| }); | }); | ||||||
| const stored_laptime_track = localStorage.getItem('laptime_track'); | const stored_laptime_track = localStorage.getItem('laptime_track'); | ||||||
| export const laptime_track = writable(stored_laptime_track); | export const laptime_track = writable(stored_laptime_track); | ||||||
| laptime_track.subscribe((value) => { | laptime_track.subscribe((value) => { | ||||||
|  | 	if (value != null) { | ||||||
| 		localStorage.setItem('laptime_track', value); | 		localStorage.setItem('laptime_track', value); | ||||||
|  | 	} | ||||||
| }); | }); | ||||||
| const stored_lang = localStorage.getItem('lang') === 'null' ? navigator.language : localStorage.getItem('lang'); | const stored_lang = localStorage.getItem('lang') === 'null' ? navigator.language : localStorage.getItem('lang'); | ||||||
| export const lang = writable(stored_lang); | export const lang = writable(stored_lang); | ||||||
| lang.subscribe((value) => { | lang.subscribe((value) => { | ||||||
|  | 	if (value != null) { | ||||||
| 		localStorage.setItem('lang', value); | 		localStorage.setItem('lang', value); | ||||||
|  | 	} | ||||||
| }); | }); | ||||||
|  |  | ||||||
| export function clear() { | export function clear() { | ||||||
| 	api_endpoint.set(null) | 	api_endpoint.set(null) | ||||||
|  | 	api_endpoint.set("") | ||||||
| 	apikey.set(null); | 	apikey.set(null); | ||||||
|  | 	apikey.set(""); | ||||||
| 	laptime_track.set(null) | 	laptime_track.set(null) | ||||||
| 	localStorage.clear(); | 	localStorage.clear(); | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user