aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/App.vue22
-rw-r--r--src/assets/app.scss4
-rw-r--r--src/components/ConnectivityChecker.vue4
-rw-r--r--src/components/DarkMode.vue2
-rw-r--r--src/components/Message.vue1
-rw-r--r--src/components/SearchInput.vue2
-rw-r--r--src/components/Service.vue5
-rw-r--r--src/components/SettingToggle.vue5
-rw-r--r--src/components/services/OpenWeather.vue28
-rw-r--r--src/components/services/UptimeKuma.vue1
-rw-r--r--src/main.js16
-rw-r--r--src/registerServiceWorker.js34
12 files changed, 46 insertions, 78 deletions
diff --git a/src/App.vue b/src/App.vue
index 664867f..4120fe5 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -49,10 +49,10 @@
49 <SearchInput 49 <SearchInput
50 class="navbar-item is-inline-block-mobile" 50 class="navbar-item is-inline-block-mobile"
51 :hotkey="searchHotkey()" 51 :hotkey="searchHotkey()"
52 @input="filterServices" 52 @input="filterServices($event.target?.value)"
53 @search-focus="showMenu = true" 53 @search-focus="showMenu = true"
54 @search-open="navigateToFirstService" 54 @search-open="navigateToFirstService($event?.target?.value)"
55 @search-cancel="filterServices" 55 @search-cancel="filterServices()"
56 /> 56 />
57 </Navbar> 57 </Navbar>
58 </div> 58 </div>
@@ -140,8 +140,8 @@
140</template> 140</template>
141 141
142<script> 142<script>
143const jsyaml = require("js-yaml"); 143import jsyaml from "js-yaml";
144const merge = require("lodash.merge"); 144import merge from "lodash.merge";
145 145
146import Navbar from "./components/Navbar.vue"; 146import Navbar from "./components/Navbar.vue";
147import GetStarted from "./components/GetStarted.vue"; 147import GetStarted from "./components/GetStarted.vue";
@@ -153,7 +153,7 @@ import SettingToggle from "./components/SettingToggle.vue";
153import DarkMode from "./components/DarkMode.vue"; 153import DarkMode from "./components/DarkMode.vue";
154import DynamicTheme from "./components/DynamicTheme.vue"; 154import DynamicTheme from "./components/DynamicTheme.vue";
155 155
156import defaultConfig from "./assets/defaults.yml"; 156import defaultConfig from "./assets/defaults.yml?raw";
157 157
158export default { 158export default {
159 name: "App", 159 name: "App",
@@ -255,11 +255,12 @@ export default {
255 }); 255 });
256 }, 256 },
257 matchesFilter: function (item) { 257 matchesFilter: function (item) {
258 const needle = this.filter?.toLowerCase();
258 return ( 259 return (
259 item.name.toLowerCase().includes(this.filter) || 260 item.name.toLowerCase().includes(needle) ||
260 (item.subtitle && item.subtitle.toLowerCase().includes(this.filter)) || 261 (item.subtitle && item.subtitle.toLowerCase().includes(needle)) ||
261 (item.tag && item.tag.toLowerCase().includes(this.filter)) || 262 (item.tag && item.tag.toLowerCase().includes(needle)) ||
262 (item.keywords && item.keywords.toLowerCase().includes(this.filter)) 263 (item.keywords && item.keywords.toLowerCase().includes(needle))
263 ); 264 );
264 }, 265 },
265 navigateToFirstService: function (target) { 266 navigateToFirstService: function (target) {
@@ -271,6 +272,7 @@ export default {
271 } 272 }
272 }, 273 },
273 filterServices: function (filter) { 274 filterServices: function (filter) {
275 console.log(filter);
274 this.filter = filter; 276 this.filter = filter;
275 277
276 if (!filter) { 278 if (!filter) {
diff --git a/src/assets/app.scss b/src/assets/app.scss
index ae2cb6b..d112482 100644
--- a/src/assets/app.scss
+++ b/src/assets/app.scss
@@ -2,7 +2,7 @@
2 2
3@import "./webfonts/webfonts.scss"; 3@import "./webfonts/webfonts.scss";
4 4
5@import "bulma"; 5@import "../../node_modules/bulma/bulma";
6 6
7// Themes import 7// Themes import
8@import "./themes/sui.scss"; 8@import "./themes/sui.scss";
@@ -13,7 +13,7 @@
13 text-overflow: ellipsis; 13 text-overflow: ellipsis;
14} 14}
15 15
16html, body, body #app { 16html, body, body #app-mount, body #app {
17 height: 100%; 17 height: 100%;
18 background-color: var(--background); 18 background-color: var(--background);
19} 19}
diff --git a/src/components/ConnectivityChecker.vue b/src/components/ConnectivityChecker.vue
index 2b3e47b..0e724fc 100644
--- a/src/components/ConnectivityChecker.vue
+++ b/src/components/ConnectivityChecker.vue
@@ -56,7 +56,9 @@ export default {
56 56
57 // extra check to make sure we're not offline 57 // extra check to make sure we're not offline
58 let that = this; 58 let that = this;
59 const aliveCheckUrl = window.location.href + "?t=" + new Date().valueOf(); 59 const aliveCheckUrl = `${window.location.origin}${
60 window.location.pathname
61 }/index.html?t=${new Date().valueOf()}`;
60 return fetch(aliveCheckUrl, { 62 return fetch(aliveCheckUrl, {
61 method: "HEAD", 63 method: "HEAD",
62 cache: "no-store", 64 cache: "no-store",
diff --git a/src/components/DarkMode.vue b/src/components/DarkMode.vue
index 677238a..4318c22 100644
--- a/src/components/DarkMode.vue
+++ b/src/components/DarkMode.vue
@@ -1,6 +1,6 @@
1<template> 1<template>
2 <a 2 <a
3 v-on:click="toggleTheme()" 3 @click="toggleTheme()"
4 aria-label="Toggle dark mode" 4 aria-label="Toggle dark mode"
5 class="navbar-item is-inline-block-mobile" 5 class="navbar-item is-inline-block-mobile"
6 > 6 >
diff --git a/src/components/Message.vue b/src/components/Message.vue
index 00ce158..2b338ef 100644
--- a/src/components/Message.vue
+++ b/src/components/Message.vue
@@ -47,7 +47,6 @@ export default {
47 } 47 }
48 if (this.item.url) { 48 if (this.item.url) {
49 let fetchedMessage = await this.downloadMessage(this.item.url); 49 let fetchedMessage = await this.downloadMessage(this.item.url);
50 console.log("done");
51 if (this.item.mapping) { 50 if (this.item.mapping) {
52 fetchedMessage = this.mapRemoteMessage(fetchedMessage); 51 fetchedMessage = this.mapRemoteMessage(fetchedMessage);
53 } 52 }
diff --git a/src/components/SearchInput.vue b/src/components/SearchInput.vue
index 165c992..53480e7 100644
--- a/src/components/SearchInput.vue
+++ b/src/components/SearchInput.vue
@@ -75,7 +75,7 @@ export default {
75 this.$emit("input", value.toLowerCase()); 75 this.$emit("input", value.toLowerCase());
76 }, 76 },
77 }, 77 },
78 beforeDestroy() { 78 beforeUnmount() {
79 document.removeEventListener("keydown", this._keyListener); 79 document.removeEventListener("keydown", this._keyListener);
80 }, 80 },
81}; 81};
diff --git a/src/components/Service.vue b/src/components/Service.vue
index 25b86d5..ac378ec 100644
--- a/src/components/Service.vue
+++ b/src/components/Service.vue
@@ -1,8 +1,9 @@
1<template> 1<template>
2 <component v-bind:is="component" :item="item" :proxy="proxy"></component> 2 <component :is="component" :item="item" :proxy="proxy"></component>
3</template> 3</template>
4 4
5<script> 5<script>
6import { defineAsyncComponent } from "vue";
6import Generic from "./services/Generic.vue"; 7import Generic from "./services/Generic.vue";
7 8
8export default { 9export default {
@@ -17,7 +18,7 @@ export default {
17 if (type === "Generic") { 18 if (type === "Generic") {
18 return Generic; 19 return Generic;
19 } 20 }
20 return () => import(`./services/${type}.vue`); 21 return defineAsyncComponent(() => import(`./services/${type}.vue`));
21 }, 22 },
22 }, 23 },
23}; 24};
diff --git a/src/components/SettingToggle.vue b/src/components/SettingToggle.vue
index 6c8a10f..efa7caa 100644
--- a/src/components/SettingToggle.vue
+++ b/src/components/SettingToggle.vue
@@ -1,5 +1,8 @@
1<template> 1<template>
2 <a v-on:click="toggleSetting()" class="navbar-item is-inline-block-mobile"> 2 <a
3 @click.prevent="toggleSetting()"
4 class="navbar-item is-inline-block-mobile"
5 >
3 <span><i :class="['fas', 'fa-fw', value ? icon : secondaryIcon]"></i></span> 6 <span><i :class="['fas', 'fa-fw', value ? icon : secondaryIcon]"></i></span>
4 <slot></slot> 7 <slot></slot>
5 </a> 8 </a>
diff --git a/src/components/services/OpenWeather.vue b/src/components/services/OpenWeather.vue
index 79d5e37..ba0be96 100644
--- a/src/components/services/OpenWeather.vue
+++ b/src/components/services/OpenWeather.vue
@@ -22,7 +22,7 @@
22 <div v-else> 22 <div v-else>
23 <p class="title is-4">{{ name }}</p> 23 <p class="title is-4">{{ name }}</p>
24 <p class="subtitle is-6"> 24 <p class="subtitle is-6">
25 {{ temp | tempSuffix(this.item.units) }} 25 {{ temperature }}
26 </p> 26 </p>
27 </div> 27 </div>
28 </div> 28 </div>
@@ -50,6 +50,19 @@ export default {
50 conditions: null, 50 conditions: null,
51 error: false, 51 error: false,
52 }), 52 }),
53 computed: {
54 temperature: function () {
55 if (!this.temp) return "";
56
57 let unit = "K";
58 if (this.item.units === "metric") {
59 unit = "°C";
60 } else if (this.item.units === "imperial") {
61 unit = "°F";
62 }
63 return `${this.temp} ${unit}`;
64 },
65 },
53 created() { 66 created() {
54 this.fetchWeather(); 67 this.fetchWeather();
55 }, 68 },
@@ -86,19 +99,6 @@ export default {
86 }); 99 });
87 }, 100 },
88 }, 101 },
89 filters: {
90 tempSuffix: function (value, type) {
91 if (!value) return "";
92
93 let unit = "K";
94 if (type === "metric") {
95 unit = "°C";
96 } else if (type === "imperial") {
97 unit = "°F";
98 }
99 return `${value} ${unit}`;
100 },
101 },
102}; 102};
103</script> 103</script>
104 104
diff --git a/src/components/services/UptimeKuma.vue b/src/components/services/UptimeKuma.vue
index 3be53b8..5117a05 100644
--- a/src/components/services/UptimeKuma.vue
+++ b/src/components/services/UptimeKuma.vue
@@ -99,6 +99,7 @@ export default {
99 }, 99 },
100 }, 100 },
101 created() { 101 created() {
102 /* eslint-disable */
102 this.item.url = `${this.item.url}/status/${this.dashboard}`; 103 this.item.url = `${this.item.url}/status/${this.dashboard}`;
103 this.fetchStatus(); 104 this.fetchStatus();
104 }, 105 },
diff --git a/src/main.js b/src/main.js
index e5995a4..a1d7b47 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,19 +1,13 @@
1import Vue from "vue"; 1import { createApp, h } from "vue";
2import App from "./App.vue"; 2import App from "./App.vue";
3import "./registerServiceWorker";
4 3
5import "@fortawesome/fontawesome-free/css/all.css"; 4import "@fortawesome/fontawesome-free/css/all.css";
6
7import "./assets/app.scss"; 5import "./assets/app.scss";
8 6
9Vue.config.productionTip = false; 7const app = createApp(App);
10 8
11Vue.component("DynamicStyle", { 9app.component("DynamicStyle", (_props, context) => {
12 render: function (createElement) { 10 return h("style", {}, context.slots);
13 return createElement("style", this.$slots.default);
14 },
15}); 11});
16 12
17new Vue({ 13app.mount("#app-mount");
18 render: (h) => h(App),
19}).$mount("#app");
diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js
deleted file mode 100644
index 1473a0a..0000000
--- a/src/registerServiceWorker.js
+++ /dev/null
@@ -1,34 +0,0 @@
1/* eslint-disable no-console */
2
3import { register } from "register-service-worker";
4
5if (process.env.NODE_ENV === "production") {
6 register(`${process.env.BASE_URL}service-worker.js`, {
7 ready() {
8 console.log(
9 "App is being served from cache by a service worker.\n" +
10 "For more details, visit https://goo.gl/AFskqB"
11 );
12 },
13 registered() {
14 console.log("Service worker has been registered.");
15 },
16 cached() {
17 console.log("Content has been cached for offline use.");
18 },
19 updatefound() {
20 console.log("New content is downloading.");
21 },
22 updated() {
23 console.log("New content is available; please refresh.");
24 },
25 offline() {
26 console.log(
27 "No internet connection found. App is running in offline mode."
28 );
29 },
30 error(error) {
31 console.error("Error during service worker registration:", error);
32 },
33 });
34}