Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

🎨 Resolves style regressions

Alicia Sykes201d83fb3c78
diff --git a/services/app.js b/services/app.js
index 5ccee702..ccd99cc4 100644
--- a/services/app.js
+++ b/services/app.js
@@ -33,8 +33,16 @@ const sslServer = require('./ssl-server'); // TLS-enabled web server
const corsProxy = require('./cors-proxy'); // Enables API requests to CORS-blocked services
const getUser = require('./get-user'); // Enables server side user lookup
-/* Helper functions, and default config */
-const ENDPOINTS = require('../src/utils/defaults').serviceEndpoints; // API endpoint URL paths
+/* Service endpoint URL paths (see also serviceEndpoints in src/utils/defaults.js) */
+const ENDPOINTS = {
+ statusPing: '/status-ping',
+ statusCheck: '/status-check',
+ save: '/config-manager/save',
+ rebuild: '/config-manager/rebuild',
+ systemInfo: '/system-info',
+ corsProxy: '/cors-proxy',
+ getUser: '/get-user',
+};
/* Indicates for the webpack config, that running as a server */
process.env.IS_SERVER = 'True';
diff --git a/src/assets/interface-icons/config-pages.svg b/src/assets/interface-icons/config-pages.svg
index 36c44675..f44164c8 100644
--- a/src/assets/interface-icons/config-pages.svg
+++ b/src/assets/interface-icons/config-pages.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M429.3 93.38l-74.63-74.64C342.6 6.742 326.3 0 309.4 0H160C124.7 0 96 28.65 96 64l.0098 288c0 35.34 28.65 64 64 64h224C419.2 416 448 387.2 448 352V138.6C448 121.7 441.3 105.4 429.3 93.38zM400 352c0 8.836-7.164 16-16 16H160c-8.838 0-16-7.164-16-16L144 64.13c0-8.836 7.164-16 16-16h128V128c0 17.67 14.33 32 32 32h79.99V352zM328 512h-208C53.83 512 0 458.2 0 392v-272C0 106.8 10.75 96 24 96S48 106.8 48 120v272c0 39.7 32.3 72 72 72h208c13.25 0 24 10.75 24 24S341.3 512 328 512z"/></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path fill="currentColor" d="M429.3 93.38l-74.63-74.64C342.6 6.742 326.3 0 309.4 0H160C124.7 0 96 28.65 96 64l.0098 288c0 35.34 28.65 64 64 64h224C419.2 416 448 387.2 448 352V138.6C448 121.7 441.3 105.4 429.3 93.38zM400 352c0 8.836-7.164 16-16 16H160c-8.838 0-16-7.164-16-16L144 64.13c0-8.836 7.164-16 16-16h128V128c0 17.67 14.33 32 32 32h79.99V352zM328 512h-208C53.83 512 0 458.2 0 392v-272C0 106.8 10.75 96 24 96S48 106.8 48 120v272c0 39.7 32.3 72 72 72h208c13.25 0 24 10.75 24 24S341.3 512 328 512z"/></svg>
\ No newline at end of file
diff --git a/src/assets/interface-icons/section-expand-collapse.svg b/src/assets/interface-icons/section-expand-collapse.svg
index c9cf291e..26fa4806 100644
--- a/src/assets/interface-icons/section-expand-collapse.svg
+++ b/src/assets/interface-icons/section-expand-collapse.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M296 391.1c-6.141 0-12.28 2.344-16.97 7.031L248 430.1v-86.06c0-13.25-10.75-24-24-24s-24 10.75-24 24v86.06l-31.03-31.03C164.3 394.3 158.1 391.1 152 391.1c-12.82 0-24 10.33-24 24c0 6.141 2.344 12.28 7.031 16.97l72 72.01C209.6 507.5 215.5 512 224 512s14.4-4.461 16.97-7.031l72-72.01C317.7 428.3 320 422.1 320 415.1C320 402.3 308.8 391.1 296 391.1zM152 119.1c6.141 0 12.28-2.344 16.97-7.031L200 81.91v86.07c0 13.25 10.75 24 24 24s24-10.75 24-24V81.91l31.03 31.03C283.7 117.6 289.8 119.1 296 119.1c18.79 0 24-17.2 24-23.1c0-6.141-2.344-12.28-7.031-16.97l-72-72.01C234.9 .9766 227.7 0 223.1 0C220.3 0 213.1 .9687 207 7l-72 72.01C130.3 83.7 128 89.84 128 95.98C128 109.7 139.2 119.1 152 119.1zM424 232H24C10.75 232 0 242.7 0 255.1S10.75 280 24 280h400c13.25 0 24-10.76 24-24.01S437.3 232 424 232z"/></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path fill="currentColor" d="M296 391.1c-6.141 0-12.28 2.344-16.97 7.031L248 430.1v-86.06c0-13.25-10.75-24-24-24s-24 10.75-24 24v86.06l-31.03-31.03C164.3 394.3 158.1 391.1 152 391.1c-12.82 0-24 10.33-24 24c0 6.141 2.344 12.28 7.031 16.97l72 72.01C209.6 507.5 215.5 512 224 512s14.4-4.461 16.97-7.031l72-72.01C317.7 428.3 320 422.1 320 415.1C320 402.3 308.8 391.1 296 391.1zM152 119.1c6.141 0 12.28-2.344 16.97-7.031L200 81.91v86.07c0 13.25 10.75 24 24 24s24-10.75 24-24V81.91l31.03 31.03C283.7 117.6 289.8 119.1 296 119.1c18.79 0 24-17.2 24-23.1c0-6.141-2.344-12.28-7.031-16.97l-72-72.01C234.9 .9766 227.7 0 223.1 0C220.3 0 213.1 .9687 207 7l-72 72.01C130.3 83.7 128 89.84 128 95.98C128 109.7 139.2 119.1 152 119.1zM424 232H24C10.75 232 0 242.7 0 255.1S10.75 280 24 280h400c13.25 0 24-10.76 24-24.01S437.3 232 424 232z"/></svg>
\ No newline at end of file
diff --git a/src/components/Configuration/ConfigContainer.vue b/src/components/Configuration/ConfigContainer.vue
index 6ed1ab34..9f0f3368 100644
--- a/src/components/Configuration/ConfigContainer.vue
+++ b/src/components/Configuration/ConfigContainer.vue
@@ -239,9 +239,6 @@ a.config-button, button.config-button {
min-width: 15rem;
width: 100%;
svg.button-icon {
- path {
- fill: var(--config-settings-color);
- }
width: 1rem;
height: 1rem;
padding: 0.2rem;
@@ -249,9 +246,6 @@ a.config-button, button.config-button {
&:hover:not(.disallowed) {
background: var(--config-settings-color);
color: var(--config-settings-background);
- svg path {
- fill: var(--config-settings-background);
- }
}
}
diff --git a/src/components/FormElements/Button.vue b/src/components/FormElements/Button.vue
index 3924e579..41d7e03f 100644
--- a/src/components/FormElements/Button.vue
+++ b/src/components/FormElements/Button.vue
@@ -43,37 +43,31 @@ button {
justify-content: center;
flex-direction: row-reverse;
align-items: center;
+ gap: 0.5rem;
padding: 0.5rem 0.75rem;
margin: 0.5rem auto;
font-size: 1.2rem;
min-width: 10rem;
cursor: pointer;
- svg {
- width: 1.2rem;
- margin: 0 0.5rem;
- path, g {
- fill: currentColor;
- }
- }
&.disallowed {
cursor: not-allowed !important;
}
}
/* Default visual settings, can be overridden when needed */
-button {
+:where(button) {
color: var(--primary);
background: var(--background);
border: 1px solid var(--primary);
border-radius: var(--curve-factor);
- &:hover:not(:disabled):not(.disallowed) {
- color: var(--background);
- background: var(--primary);
- border-color: var(--background);
- }
- &:disabled {
- cursor: progress;
- opacity: var(--dimming-factor);
- }
+}
+:where(button:hover:not(:disabled):not(.disallowed)) {
+ color: var(--background);
+ background: var(--primary);
+ border-color: var(--background);
+}
+:where(button:disabled) {
+ cursor: progress;
+ opacity: var(--dimming-factor);
}
</style>
diff --git a/src/components/InteractiveEditor/EditModeSaveMenu.vue b/src/components/InteractiveEditor/EditModeSaveMenu.vue
index 6fc9d281..c5768d11 100644
--- a/src/components/InteractiveEditor/EditModeSaveMenu.vue
+++ b/src/components/InteractiveEditor/EditModeSaveMenu.vue
@@ -263,13 +263,11 @@ div.edit-mode-bottom-banner {
color: var(--interactive-editor-background);
border-color: var(--interactive-editor-color);
background: var(--interactive-editor-color);
- svg path { fill: var(--interactive-editor-background); }
}
svg {
width: 1rem;
height: 1rem;
margin: 0 0 -0.15rem 0.25rem;
- path { fill: var(--interactive-editor-color); }
}
}
}
diff --git a/src/components/InteractiveEditor/SaveCancelButtons.vue b/src/components/InteractiveEditor/SaveCancelButtons.vue
index 73764bdb..5f097cc8 100644
--- a/src/components/InteractiveEditor/SaveCancelButtons.vue
+++ b/src/components/InteractiveEditor/SaveCancelButtons.vue
@@ -53,7 +53,6 @@ export default {
background: var(--interactive-editor-color);
svg {
background: var(--interactive-editor-color);
- path { fill: var(--interactive-editor-background); }
}
}
&:focus {
diff --git a/src/components/LinkItems/ItemOpenMethodIcon.vue b/src/components/LinkItems/ItemOpenMethodIcon.vue
index a3cbb2a1..8af6f537 100644
--- a/src/components/LinkItems/ItemOpenMethodIcon.vue
+++ b/src/components/LinkItems/ItemOpenMethodIcon.vue
@@ -69,9 +69,6 @@ export default {
position: absolute;
width: 1rem;
margin: 2px;
- path {
- fill: currentColor;
- }
}
&.top svg { top: 0; }
&.bottom svg { bottom: 0; }
diff --git a/src/components/LinkItems/Section.vue b/src/components/LinkItems/Section.vue
index adc93f59..8cf1e38e 100644
--- a/src/components/LinkItems/Section.vue
+++ b/src/components/LinkItems/Section.vue
@@ -310,8 +310,8 @@ export default {
mounted() {
// Set the section width, and recalculate when section resized
if (this.$refs[this.sectionRef]) {
- this.resizeObserver = new ResizeObserver(this.calculateSectionWidth)
- .observe(this.$refs[this.sectionRef].$el);
+ this.resizeObserver = new ResizeObserver(this.calculateSectionWidth);
+ this.resizeObserver.observe(this.$refs[this.sectionRef].$el);
}
},
beforeUnmount() {
diff --git a/src/components/LinkItems/SectionContextMenu.vue b/src/components/LinkItems/SectionContextMenu.vue
index c6bcbcf5..7faaf666 100644
--- a/src/components/LinkItems/SectionContextMenu.vue
+++ b/src/components/LinkItems/SectionContextMenu.vue
@@ -111,8 +111,7 @@ div.context-menu {
}
svg {
width: 1rem;
- margin-right: 0.5rem;
- path { fill: currentColor; }
+ margin-right: 0.5rem;
}
}
}
diff --git a/src/components/PageStrcture/PageTitle.vue b/src/components/PageStrcture/PageTitle.vue
index eebaef6d..de20710d 100644
--- a/src/components/PageStrcture/PageTitle.vue
+++ b/src/components/PageStrcture/PageTitle.vue
@@ -90,9 +90,9 @@ export default {
padding: 0.25rem;
margin: 0.25rem;
cursor: pointer;
+ color: var(--primary);
border: 1px solid var(--background-darker);
border-radius: var(--curve-factor);
- path { fill: var(--primary); }
&:hover { border: 1px solid var(--primary); }
}
}
diff --git a/src/components/Settings/ItemSizeSelector.vue b/src/components/Settings/ItemSizeSelector.vue
index efe7d5bf..1760ebd0 100644
--- a/src/components/Settings/ItemSizeSelector.vue
+++ b/src/components/Settings/ItemSizeSelector.vue
@@ -67,9 +67,6 @@ span.options-label {
.display-options {
color: var(--settings-text-color);
svg {
- path {
- fill: var(--settings-text-color);
- }
width: 1rem;
height: 1rem;
margin: 0.2rem;
@@ -81,7 +78,7 @@ span.options-label {
cursor: pointer;
&:hover, &.selected {
background: var(--settings-text-color);
- path { fill: var(--background); }
+ color: var(--background);
}
}
}
diff --git a/src/components/Settings/LayoutSelector.vue b/src/components/Settings/LayoutSelector.vue
index 8f7366cf..9962326c 100644
--- a/src/components/Settings/LayoutSelector.vue
+++ b/src/components/Settings/LayoutSelector.vue
@@ -65,9 +65,6 @@ span.options-label {
.display-options {
color: var(--settings-text-color);
svg {
- path {
- fill: var(--settings-text-color);
- }
width: 1rem;
height: 1rem;
margin: 0.2rem;
@@ -79,7 +76,7 @@ span.options-label {
cursor: pointer;
&:hover, &.selected {
background: var(--settings-text-color);
- path { fill: var(--background); }
+ color: var(--background);
}
}
}
diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue
index 68d761dd..b4497e4e 100644
--- a/src/components/Widgets/WidgetBase.vue
+++ b/src/components/Widgets/WidgetBase.vue
@@ -34,6 +34,7 @@
</template>
<script>
+import { defineAsyncComponent } from 'vue';
// Import form elements, icons and utils
import ErrorHandler from '@/utils/ErrorHandler';
import Button from '@/components/FormElements/Button';
@@ -41,6 +42,8 @@ import UpdateIcon from '@/assets/interface-icons/widget-update.svg';
import OpenIcon from '@/assets/interface-icons/open-new-tab.svg';
import LoadingAnimation from '@/assets/interface-icons/loader.svg';
+const widgetModules = import.meta.glob('./*.vue');
+
const COMPAT = {
'adguard-dns-info': 'AdGuardDnsInfo',
'adguard-filter-status': 'AdGuardFilterStatus',
@@ -189,8 +192,13 @@ export default {
ErrorHandler('Widget type was not found');
return null;
}
- // eslint-disable-next-line prefer-template
- return () => import(/* @vite-ignore */ '@/components/Widgets/' + type + '.vue').catch(() => import('@/components/Widgets/Blank.vue'));
+ const path = `./${type}.vue`;
+ const loader = widgetModules[path];
+ if (!loader) {
+ ErrorHandler(`Widget component not found: ${type}`);
+ return defineAsyncComponent(() => import('./Blank.vue'));
+ }
+ return defineAsyncComponent(() => loader().catch(() => import('./Blank.vue')));
},
},
methods: {
diff --git a/src/directives/Tooltip.js b/src/directives/Tooltip.js
index 8332f910..9cd1d6a3 100644
--- a/src/directives/Tooltip.js
+++ b/src/directives/Tooltip.js
@@ -1,13 +1,20 @@
/**
- * Custom v-tooltip directive for Vue 3.
- * Lightweight replacement for floating-vue β€” zero external dependencies.
- * Supports string or object bindings, HTML content (sanitized via DOMPurify),
- * auto-positioning with viewport flip/shift, accessible keyboard + screen reader support,
- * and theme-aware styling via CSS variables.
+ * Dashy's custom zero-dependency v-tooltip directive for Vue 3
+ * Supports strings or object bindings, HTML content, auto-positioning
+ * and is designed to be accessible, responsive, performant and configurable.
+ *
+ * Usage: it's registered globally already, so no need to import.
+ * Just add the v-tooltip attribute to any element, passing in text or options
+ *
+ * Examples:
+ * <button v-tooltip="I like big buttons and I cannot lie">Sir Mix Alot says..</button>
+ * <span v-tooltip="{ content: '<b>Bold</b> & safe', html: true }">?</span>
+ * <a v-tooltip="{ content: 'nothing at all', disabled: true }">y no tooltip?</a>
+ * <i v-tooltip="{ content: 'I am a pretty tooltip', popperClass: 'in-modal-tt' }" />
+ * <i v-tooltip="{ content: 'Focus me', triggers: ['focus'], delay: { show: 500, hide: 200 }}" />
*/
import DOMPurify from 'dompurify';
-/* ── Defaults ── */
const DEFAULTS = {
triggers: ['hover', 'focus'],
placement: 'auto',
@@ -17,7 +24,6 @@ const GAP = 8;
const ARROW_SIZE = 6;
const TRANSITION_MS = 150;
-/* ── Style injection (once) ── */
let stylesInjected = false;
function injectStyles() {
if (stylesInjected) return;
@@ -84,7 +90,6 @@ function injectStyles() {
document.head.appendChild(style);
}
-/* ── Positioning ── */
const PLACEMENTS = ['top', 'bottom', 'right', 'left'];
const FLIP = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' };
@@ -115,7 +120,12 @@ function fitsViewport(target, tip, vw, vh, placement) {
function positionTooltip(targetEl, tipEl, requested) {
const target = targetEl.getBoundingClientRect();
- const tipEl2 = tipEl; // keep ref stable
+ if (target.width === 0 && target.height === 0) {
+ const owner = targetEl;
+ if (owner._tooltip) hide(owner);
+ return;
+ }
+ const tipEl2 = tipEl;
tipEl2.style.visibility = 'hidden';
tipEl2.style.display = 'block';
const tip = tipEl2.getBoundingClientRect();
@@ -158,13 +168,12 @@ function positionTooltip(targetEl, tipEl, requested) {
tipEl2.style.display = '';
}
-/* ── Options normalizer ── */
let idCounter = 0;
function normalize(value) {
if (!value && value !== 0) return null;
if (typeof value === 'string' || typeof value === 'number') return { content: String(value) };
- if (typeof value === 'object' && value !== null) {
+ if (typeof value === 'object') {
if (value.disabled || !value.content) return null;
return value;
}
@@ -177,7 +186,7 @@ function resolveDelay(raw) {
return { show: raw.show ?? DEFAULTS.delay.show, hide: raw.hide ?? DEFAULTS.delay.hide };
}
-/* ── Show / Hide ── */
+/* Show / hide */
function show(el) {
const state = el._tooltip;
if (!state || state.visible) return;
@@ -257,7 +266,21 @@ function hide(el) {
}
}
-/* ── Event binding ── */
+/* Global click-to-dismiss */
+let globalClickBound = false;
+function ensureGlobalClick() {
+ if (globalClickBound) return;
+ globalClickBound = true;
+ document.addEventListener('click', () => {
+ document.querySelectorAll('.dashy-tooltip.is-visible').forEach((tip) => {
+ // Find the owner element via the tooltip id
+ const owner = document.querySelector(`[aria-describedby="${tip.id}"]`);
+ if (owner) hide(owner);
+ });
+ }, { capture: true });
+}
+
+/* Event binding */
function bind(el) {
const state = el._tooltip;
const triggers = state.options?.triggers || DEFAULTS.triggers;
@@ -273,6 +296,9 @@ function bind(el) {
el.addEventListener('focusin', state.onShow);
el.addEventListener('focusout', state.onHide);
}
+ // Always hide on click (e.g. opening a modal)
+ el.addEventListener('click', state.onHide);
+ ensureGlobalClick();
}
function unbind(el) {
@@ -282,9 +308,10 @@ function unbind(el) {
el.removeEventListener('mouseleave', state.onHide);
el.removeEventListener('focusin', state.onShow);
el.removeEventListener('focusout', state.onHide);
+ el.removeEventListener('click', state.onHide);
}
-/* ── Directive hooks ── */
+/* Directive hooks */
export default {
mounted(el, binding) {
const opts = normalize(binding.value);
diff --git a/src/styles/style-helpers.scss b/src/styles/style-helpers.scss
index 6b73c9bc..80dba337 100644
--- a/src/styles/style-helpers.scss
+++ b/src/styles/style-helpers.scss
@@ -19,29 +19,27 @@
.svg-button {
color: var(--primary);
svg {
- path {
- fill: var(--settings-text-color);
- }
+ color: var(--settings-text-color);
width: 1rem;
height: 1rem;
margin: 0.2rem;
padding: 0.2rem;
text-align: center;
background: var(--background);
- border: 1px solid currentColor;
+ border: 1px solid var(--primary);
border-radius: var(--curve-factor);
cursor: pointer;
&:hover, &.selected {
background: var(--settings-text-color);
- path { fill: var(--background); }
+ color: var(--background);
}
&.disabled {
opacity: var(--dimming-factor);
cursor: not-allowed;
&:hover {
- border: 1px solid currentColor;
+ border: 1px solid var(--primary);
background: var(--background);
- path { fill: var(--settings-text-color); }
+ color: var(--settings-text-color);
}
}
}