Detect custom css / js changes, no refresh
This commit is contained in:
parent
e17e47364a
commit
08e3164e84
@ -1,10 +1,8 @@
|
|||||||
import useSWR from "swr"
|
import useSWR from "swr"
|
||||||
|
|
||||||
export default function FileContent({ path, loadingValue, errorValue, emptyValue = '', refresh = 1500 }) {
|
export default function FileContent({ path, loadingValue, errorValue, emptyValue = '' }) {
|
||||||
const fetcher = (url) => fetch(url).then((res) => res.text())
|
const fetcher = (url) => fetch(url).then((res) => res.text())
|
||||||
const { data, error, isLoading } = useSWR(`/api/config/${ path }`, fetcher, {
|
const { data, error, isLoading } = useSWR(`/api/config/${ path }`, fetcher)
|
||||||
refreshInterval: refresh,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (error) return (errorValue)
|
if (error) return (errorValue)
|
||||||
if (isLoading) return (loadingValue)
|
if (isLoading) return (loadingValue)
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { readFileSync } from "fs";
|
|||||||
|
|
||||||
import checkAndCopyConfig, { CONF_DIR } from "utils/config/config";
|
import checkAndCopyConfig, { CONF_DIR } from "utils/config/config";
|
||||||
|
|
||||||
const configs = ["docker.yaml", "settings.yaml", "services.yaml", "bookmarks.yaml", "widgets.yaml"];
|
const configs = ["docker.yaml", "settings.yaml", "services.yaml", "bookmarks.yaml", "widgets.yaml", "custom.css", "custom.js"];
|
||||||
|
|
||||||
function hash(buffer) {
|
function hash(buffer) {
|
||||||
const hashSum = createHash("sha256");
|
const hashSum = createHash("sha256");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user