🔂 Merge master into branch
This commit is contained in:
18
src/utils/CheckPageVisibility.js
Normal file
18
src/utils/CheckPageVisibility.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* A helper function that checks if a page is visible based on current users permissions
|
||||
* Checks a page's displayData for hideForUsers, showForUsers and hideForGuests
|
||||
* Returns a boolean that determines if the user has the required permissions
|
||||
*/
|
||||
|
||||
// Import helper functions from auth, to get current user, and check if guest
|
||||
import { getCurrentUser } from '@/utils/Auth';
|
||||
import { isVisibleToUser } from '@/utils/IsVisibleToUser';
|
||||
|
||||
/* Putting it all together, the function to export */
|
||||
export const checkPageVisibility = (page) => {
|
||||
const currentUser = getCurrentUser(); // Get current user object
|
||||
const displayData = page.displayData || {};
|
||||
return isVisibleToUser(displayData, currentUser);
|
||||
};
|
||||
|
||||
export default checkPageVisibility;
|
||||
@@ -10,7 +10,7 @@
|
||||
"type": "array",
|
||||
"description": "List of additional config files to load as extra pages",
|
||||
"items": {
|
||||
"title": "Pages",
|
||||
"title": "Page",
|
||||
"type": "object",
|
||||
"required": ["name", "path"],
|
||||
"additionalProperties": false,
|
||||
@@ -24,6 +24,90 @@
|
||||
"title": "Path",
|
||||
"type": "string",
|
||||
"description": "The file name, or path. If in public directory, use just `file-name.yml`"
|
||||
},
|
||||
"displayData": {
|
||||
"title": "Display Data",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"description": "Optional meta data for customizing a page",
|
||||
"properties": {
|
||||
"hideForUsers": {
|
||||
"title": "Hide for Users",
|
||||
"type": "array",
|
||||
"description": "Page will be visible to all users, except for those specified in this list",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "Username for the user that will not be able to view this page"
|
||||
}
|
||||
},
|
||||
"showForUsers": {
|
||||
"title": "Show for Users",
|
||||
"type": "array",
|
||||
"description": "Page will be hidden from all users, except for those specified in this list",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "Username for the user that will have access to this page"
|
||||
}
|
||||
},
|
||||
"hideForGuests": {
|
||||
"title": "Hide for Guests?",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "If set to true, page will be visible for logged in users, but not for guests"
|
||||
},
|
||||
"showForKeycloakUsers": {
|
||||
"title": "Show for select Keycloak groups or roles",
|
||||
"type": "object",
|
||||
"description": "Configure the Keycloak groups or roles that will have access to this page",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"groups": {
|
||||
"title": "Show for Groups",
|
||||
"type": "array",
|
||||
"description": "Page will be hidden from all users except those with one or more of these groups",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "Name of the group that will be able to view this page"
|
||||
}
|
||||
},
|
||||
"roles": {
|
||||
"title": "Show for Roles",
|
||||
"type": "array",
|
||||
"description": "Page will be hidden from all users except those with one or more of these roles",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "Name of the role that will be able to view this page"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"hideForKeycloakUsers": {
|
||||
"title": "Hide for select Keycloak groups or roles",
|
||||
"type": "object",
|
||||
"description": "Configure the Keycloak groups or roles that will not have access to this page",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"groups": {
|
||||
"title": "Hide for Groups",
|
||||
"type": "array",
|
||||
"description": "Page will be hidden from users with any of these groups",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "name of the group that will not be able to view this page"
|
||||
}
|
||||
},
|
||||
"roles": {
|
||||
"title": "Hide for Roles",
|
||||
"type": "array",
|
||||
"description": "Page will be hidden from users with any of roles",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"description": "name of the role that will not be able to view this page"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -536,13 +620,13 @@
|
||||
"title": "Prevent saving config to disk",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "If set to true, no users will not be able to save config changes to disk through the UI"
|
||||
"description": "If set to true, users will be prevented from saving config changes to disk through the UI"
|
||||
},
|
||||
"preventLocalSave": {
|
||||
"title": "Prevent saving config to local storage",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "If set to true, no users will not be able to save config changes to the browser's local storage"
|
||||
"description": "If set to true, users will be prevented from applying config changes to local storage"
|
||||
},
|
||||
"disableConfiguration": {
|
||||
"title": "Disable all UI Config",
|
||||
@@ -929,6 +1013,11 @@
|
||||
"type": "number",
|
||||
"description": "A numeric shortcut key, between 0 and 9. Useful for quickly launching frequently used applications"
|
||||
},
|
||||
"rel": {
|
||||
"title": "rel",
|
||||
"type": "string",
|
||||
"description": "The rel attribute for the link. For specifying the relationship between the current document and the linked document"
|
||||
},
|
||||
"tags": {
|
||||
"title": "Tags",
|
||||
"type": "array",
|
||||
@@ -1033,6 +1122,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filteredItems": {
|
||||
"title": "Filtered Items - temp",
|
||||
"type": "array",
|
||||
"description": "This attribute will be deprecated in the next release - do not use!"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export const welcomeMsg = () => {
|
||||
/* Prints warning message, usually when there is a configuration error */
|
||||
export const warningMsg = (message, stack) => {
|
||||
console.info(
|
||||
`\n%c⚠️ Warning ⚠️%c \n${message} \n\n%cThis is likely not an issue with Dashy, but rather your configuration. If you think it is a bug, please open a ticket on GitHub: https://git.io/JukXk`,
|
||||
`\n%c⚠️ Warning ⚠️%c \n${message} \n\n%cThis is likely not an issue with Dashy, but rather your configuration.\nIf you think it is a bug, please open a ticket on GitHub: https://git.io/JukXk`,
|
||||
"color:#ceb73f; background: #ceb73f33; font-size:1.5rem; padding:0.15rem; margin: 1rem auto; font-family: Rockwell, Tahoma, 'Trebuchet MS', Helvetica; border: 2px solid #ceb73f; border-radius: 4px; font-weight: bold; text-shadow: 1px 1px 1px #000000bf;",
|
||||
'font-weight: bold; font-size: 1rem;color: #ceb73f;',
|
||||
"color: #ceb73f; font-size: 0.75rem; font-family: Tahoma, 'Trebuchet MS', Helvetica;",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Dashy: Licensed under MIT, (C) Alicia Sykes 2021 <https://aliciasykes.com> */
|
||||
/* Dashy: Licensed under MIT, (C) Alicia Sykes 2024 <https://aliciasykes.com> */
|
||||
|
||||
/* Tile filtering utility */
|
||||
import ErrorHandler from '@/utils/ErrorHandler';
|
||||
@@ -24,7 +24,7 @@ const getDomainFromUrl = (url) => {
|
||||
*/
|
||||
const filterHelper = (compareStr, searchStr) => {
|
||||
if (!compareStr) return false;
|
||||
const process = (input) => input?.toString().toLowerCase().replace(/[^\w\s]/gi, '');
|
||||
const process = (input) => input?.toString().toLowerCase().replace(/[^\w\s\p{Alpha}]/giu, '');
|
||||
return process(searchStr).split(/\s/).every(word => process(compareStr).includes(word));
|
||||
};
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ module.exports = {
|
||||
'high-contrast-light',
|
||||
'adventure-basic',
|
||||
'basic',
|
||||
'tama',
|
||||
],
|
||||
/* Default color options for the theme configurator swatches */
|
||||
swatches: [
|
||||
@@ -108,11 +109,7 @@ module.exports = {
|
||||
footer: true,
|
||||
},
|
||||
/* A list of route names that page furniture (header, footer, etc) should be hidden on */
|
||||
hideFurnitureOn: [
|
||||
'minimal',
|
||||
'login',
|
||||
'download',
|
||||
],
|
||||
hideFurnitureOn: ['minimal', 'login', 'download'],
|
||||
/* Key names for local storage identifiers */
|
||||
localStorageKeys: {
|
||||
LANGUAGE: 'language',
|
||||
@@ -167,9 +164,7 @@ module.exports = {
|
||||
/* Amount of time to show splash screen, when enabled, in milliseconds */
|
||||
splashScreenTime: 1000,
|
||||
/* Page meta-data, rendered in the header of each view */
|
||||
metaTagData: [
|
||||
{ name: 'description', content: 'A simple static homepage for you\'re server' },
|
||||
],
|
||||
metaTagData: [{ name: 'description', content: "A simple static homepage for you're server" }],
|
||||
/* Default option for Toast messages */
|
||||
toastedOptions: {
|
||||
position: 'bottom-center',
|
||||
@@ -209,17 +204,19 @@ module.exports = {
|
||||
fa: 'https://kit.fontawesome.com',
|
||||
mdi: 'https://cdn.jsdelivr.net/npm/@mdi/font@7.0.96/css/materialdesignicons.min.css',
|
||||
si: 'https://unpkg.com/simple-icons@v7/icons',
|
||||
generative: 'https://avatars.dicebear.com/api/identicon/{icon}.svg',
|
||||
generative: 'https://api.dicebear.com/7.x/identicon/svg?seed={icon}',
|
||||
generativeFallback: 'https://evatar.io/{icon}',
|
||||
localPath: './item-icons',
|
||||
faviconName: 'favicon.ico',
|
||||
homeLabIcons: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/master/png/{icon}.png',
|
||||
homeLabIconsFallback: 'https://raw.githubusercontent.com/NX211/homer-icons/master/png/{icon}.png',
|
||||
homeLabIcons:
|
||||
'https://raw.githubusercontent.com/walkxcode/dashboard-icons/master/png/{icon}.png',
|
||||
homeLabIconsFallback:
|
||||
'https://raw.githubusercontent.com/NX211/homer-icons/master/png/{icon}.png',
|
||||
},
|
||||
/* API endpoints for widgets that need to fetch external data */
|
||||
widgetApiEndpoints: {
|
||||
anonAddy: 'https://app.anonaddy.com',
|
||||
astronomyPictureOfTheDay: 'https://go-apod.herokuapp.com/apod',
|
||||
astronomyPictureOfTheDay: 'https://apod.as93.net/apod',
|
||||
blacklistCheck: 'https://api.blacklistchecker.com/check',
|
||||
codeStats: 'https://codestats.net/',
|
||||
covidStats: 'https://disease.sh/v3/covid-19',
|
||||
@@ -232,6 +229,7 @@ module.exports = {
|
||||
exchangeRates: 'https://v6.exchangerate-api.com/v6/',
|
||||
flights: 'https://aerodatabox.p.rapidapi.com/flights/airports/icao/',
|
||||
githubTrending: 'https://gh-trending-repos.herokuapp.com/',
|
||||
hackernewsTrending: 'https://hacker-news.firebaseio.com/v0',
|
||||
healthChecks: 'https://healthchecks.io/api/v1/checks',
|
||||
holidays: 'https://kayaposoft.com/enrico/json/v2.0/?action=getHolidaysForDateRange',
|
||||
jokes: 'https://v2.jokeapi.dev/joke/',
|
||||
@@ -242,6 +240,7 @@ module.exports = {
|
||||
publicIp2: 'https://api.ipgeolocation.io/ipgeo',
|
||||
publicIp3: 'http://ip-api.com/json',
|
||||
readMeStats: 'https://github-readme-stats.vercel.app/api',
|
||||
rescueTime: 'https://www.rescuetime.com/anapi/data',
|
||||
rssToJson: 'https://api.rss2json.com/v1/api.json',
|
||||
sportsScores: 'https://www.thesportsdb.com/api/v1/json',
|
||||
stockPriceChart: 'https://www.alphavantage.co/query',
|
||||
@@ -249,7 +248,7 @@ module.exports = {
|
||||
walletBalance: 'https://api.blockcypher.com/v1',
|
||||
walletQrCode: 'https://www.bitcoinqrcodemaker.com/api',
|
||||
weather: 'https://api.openweathermap.org/data/2.5/weather',
|
||||
weatherForecast: 'https://api.openweathermap.org/data/2.5/forecast/daily',
|
||||
weatherForecast: 'https://api.openweathermap.org/data/2.5/forecast',
|
||||
xkcdComic: 'https://xkcd.vercel.app/',
|
||||
},
|
||||
/* URLs for web search engines */
|
||||
@@ -309,8 +308,8 @@ module.exports = {
|
||||
themeColor: '#00af87',
|
||||
msTileColor: '#0b1021',
|
||||
mode: 'production',
|
||||
manifestCrossorigin: 'use-credentials',
|
||||
iconPaths: {
|
||||
manifestCrossorigin: 'use-credentials',
|
||||
favicon64: './web-icons/favicon-64x64.png',
|
||||
favicon32: './web-icons/favicon-32x32.png',
|
||||
maskIcon: './web-icons/dashy-logo.png',
|
||||
|
||||
@@ -17,11 +17,14 @@ import nb from '@/assets/locales/nb.json';
|
||||
import nl from '@/assets/locales/nl.json';
|
||||
import pl from '@/assets/locales/pl.json';
|
||||
import pt from '@/assets/locales/pt.json';
|
||||
import gl from '@/assets/locales/gl.json';
|
||||
import ru from '@/assets/locales/ru.json';
|
||||
import ro from '@/assets/locales/ro.json';
|
||||
import sk from '@/assets/locales/sk.json';
|
||||
import sl from '@/assets/locales/sl.json';
|
||||
import sv from '@/assets/locales/sv.json';
|
||||
import tr from '@/assets/locales/tr.json';
|
||||
import ua from '@/assets/locales/ua.json';
|
||||
import zhCN from '@/assets/locales/zh-CN.json';
|
||||
import zhTW from '@/assets/locales/zh-TW.json';
|
||||
import pirate from '@/assets/locales/zz-pirate.json';
|
||||
@@ -137,12 +140,24 @@ export const languages = [
|
||||
locale: pt,
|
||||
flag: '🇵🇹',
|
||||
},
|
||||
{ // Galician
|
||||
name: 'Galego',
|
||||
code: 'gl',
|
||||
locale: gl,
|
||||
flag: '🛰️',
|
||||
},
|
||||
{ // Russian
|
||||
name: 'Русский',
|
||||
code: 'ru',
|
||||
locale: ru,
|
||||
flag: '🇷🇺',
|
||||
},
|
||||
{ // Romanian
|
||||
name: 'Romana',
|
||||
code: 'ro',
|
||||
locale: ro,
|
||||
flag: '🇷🇴',
|
||||
},
|
||||
{ // Slovak
|
||||
name: 'Slovenčina',
|
||||
code: 'sk',
|
||||
@@ -167,6 +182,12 @@ export const languages = [
|
||||
locale: tr,
|
||||
flag: '🇹🇷',
|
||||
},
|
||||
{ // Ukrainian
|
||||
name: 'Ukrainian',
|
||||
code: 'ua',
|
||||
locale: ua,
|
||||
flag: '🇺🇦',
|
||||
},
|
||||
{ // Chinese
|
||||
name: '简体中文',
|
||||
code: 'cn',
|
||||
|
||||
Reference in New Issue
Block a user