From 02ee7bf7f5b3d95a0dd89b1a3e0d20fd57d36f35 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Wed, 8 Nov 2023 14:48:36 -0800 Subject: [PATCH] Favicon, title, automatic & manual server naming. --- cista-front/index.html | 4 +- cista-front/public/favicon.ico | Bin 4286 -> 0 bytes cista-front/public/old-index.html | 241 ---------------------------- cista-front/public/robots.txt | 2 + cista-front/src/App.vue | 5 +- cista-front/src/assets/logo.svg | 1 + cista-front/src/repositories/WS.ts | 1 + cista-front/src/stores/documents.ts | 1 + cista/api.py | 2 +- cista/config.py | 1 + 10 files changed, 13 insertions(+), 245 deletions(-) delete mode 100644 cista-front/public/favicon.ico delete mode 100755 cista-front/public/old-index.html create mode 100644 cista-front/public/robots.txt create mode 100644 cista-front/src/assets/logo.svg diff --git a/cista-front/index.html b/cista-front/index.html index 34a5c8d..7459f57 100644 --- a/cista-front/index.html +++ b/cista-front/index.html @@ -1,9 +1,9 @@ -Cista +Cista Storage - + diff --git a/cista-front/public/favicon.ico b/cista-front/public/favicon.ico deleted file mode 100644 index df36fcfb72584e00488330b560ebcf34a41c64c2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S diff --git a/cista-front/public/old-index.html b/cista-front/public/old-index.html deleted file mode 100755 index db336cb..0000000 --- a/cista-front/public/old-index.html +++ /dev/null @@ -1,241 +0,0 @@ - -Storage - -
-

Quick file upload

-

Uses parallel WebSocket connections for increased bandwidth /api/upload

- - -
- -
-

Files

-
    -
    - - diff --git a/cista-front/public/robots.txt b/cista-front/public/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/cista-front/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/cista-front/src/App.vue b/cista-front/src/App.vue index dbb7e16..d7a91d5 100644 --- a/cista-front/src/App.vue +++ b/cista-front/src/App.vue @@ -15,7 +15,7 @@ import { RouterView } from 'vue-router' import type { ComputedRef } from 'vue' import type HeaderMain from '@/components/HeaderMain.vue' -import { onMounted, onUnmounted, ref } from 'vue' +import { onMounted, onUnmounted, ref, watchEffect } from 'vue' import { watchConnect, watchDisconnect } from '@/repositories/WS' import { useDocumentStore } from '@/stores/documents' @@ -35,6 +35,9 @@ const path: ComputedRef = computed(() => { pathList } }) +watchEffect(() => { + document.title = path.value.path.replace(/\/$/, '').split('/').pop() || documentStore.server.name || 'Cista Storage' +}) onMounted(watchConnect) onUnmounted(watchDisconnect) // Update human-readable x seconds ago messages from mtimes diff --git a/cista-front/src/assets/logo.svg b/cista-front/src/assets/logo.svg new file mode 100644 index 0000000..cf8f699 --- /dev/null +++ b/cista-front/src/assets/logo.svg @@ -0,0 +1 @@ + diff --git a/cista-front/src/repositories/WS.ts b/cista-front/src/repositories/WS.ts index b760e17..d5ebf8a 100644 --- a/cista-front/src/repositories/WS.ts +++ b/cista-front/src/repositories/WS.ts @@ -42,6 +42,7 @@ export const watchConnect = () => { } if ("server" in msg) { console.log('Connected to backend', msg) + store.server = msg.server store.connected = true reconnectDuration = 500 store.error = '' diff --git a/cista-front/src/stores/documents.ts b/cista-front/src/stores/documents.ts index 59662d0..97c6ca6 100644 --- a/cista-front/src/stores/documents.ts +++ b/cista-front/src/stores/documents.ts @@ -33,6 +33,7 @@ export const useDocumentStore = defineStore({ fileExplorer: null, error: '' as string, connected: false, + server: {} as Record, user: { username: '', privileged: false, diff --git a/cista/api.py b/cista/api.py index 38b16d1..d08705f 100644 --- a/cista/api.py +++ b/cista/api.py @@ -89,7 +89,7 @@ async def watch(req, ws): msgspec.json.encode( { "server": { - "name": "Cista", # Should be configurable + "name": config.config.name or config.config.path.name, "version": __version__, "public": config.config.public, }, diff --git a/cista/config.py b/cista/config.py index 56aa708..de5310c 100644 --- a/cista/config.py +++ b/cista/config.py @@ -14,6 +14,7 @@ class Config(msgspec.Struct): listen: str secret: str = secrets.token_hex(12) public: bool = False + name: str = "" users: dict[str, User] = {} links: dict[str, Link] = {} -- 2.45.2