From 41d9e081b5a0e560221b71502213a5c9c6641798 Mon Sep 17 00:00:00 2001 From: Andy Bunce Date: Sat, 18 Oct 2025 22:59:51 +0100 Subject: [PATCH] [add] server --- README.md | 4 +- webapp/lsp-manager/api-jobs.xqm | 37 ------ webapp/lsp-manager/api-sockets.xqm | 19 +++ webapp/lsp-manager/app.xqm | 42 ++++--- webapp/lsp-manager/static/favicon.png | Bin 0 -> 3877 bytes webapp/lsp-manager/views/components.htm | 58 --------- webapp/lsp-manager/views/job/home.htm | 56 --------- webapp/lsp-manager/views/job/list.htm | 28 ----- webapp/lsp-manager/views/layout.htm | 117 +++---------------- webapp/lsp-manager/views/notifications.htm | 15 --- webapp/lsp-manager/views/pdf/home.htm | 78 ------------- webapp/lsp-manager/views/pdf/item-iframe.htm | 16 --- webapp/lsp-manager/views/pdf/item.htm | 60 ---------- webapp/lsp-manager/views/pdf/list.htm | 53 --------- webapp/lsp-manager/views/pdf/settings.htm | 97 --------------- webapp/lsp-manager/views/socket.htm | 24 ++++ webapp/lsp-manager/views/sockets.htm | 9 +- webapp/lsp-manager/views/tweets.htm | 67 ----------- webapp/lsp/lsp-ws.xqm | 1 + 19 files changed, 88 insertions(+), 693 deletions(-) delete mode 100644 webapp/lsp-manager/api-jobs.xqm create mode 100644 webapp/lsp-manager/api-sockets.xqm create mode 100644 webapp/lsp-manager/static/favicon.png delete mode 100644 webapp/lsp-manager/views/components.htm delete mode 100644 webapp/lsp-manager/views/job/home.htm delete mode 100644 webapp/lsp-manager/views/job/list.htm delete mode 100644 webapp/lsp-manager/views/notifications.htm delete mode 100644 webapp/lsp-manager/views/pdf/home.htm delete mode 100644 webapp/lsp-manager/views/pdf/item-iframe.htm delete mode 100644 webapp/lsp-manager/views/pdf/item.htm delete mode 100644 webapp/lsp-manager/views/pdf/list.htm delete mode 100644 webapp/lsp-manager/views/pdf/settings.htm create mode 100644 webapp/lsp-manager/views/socket.htm delete mode 100644 webapp/lsp-manager/views/tweets.htm diff --git a/README.md b/README.md index 0fabb95..e1661a1 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,10 @@ State is held in [websocket attributes](https://docs.basex.org/main/WebSocket_Fu |Name|Use| |----|---| -|client|the client initialize message| +|id|wsid| +|connectTime|dateTime of connection| |initialized|set true after client sends initialized message| +|client|the client initialize message| |files|A map whose keys are open uris, values are maps (doctype-> attribute name where doctype is stored| | |file-{uuid}|name of websocket attribute containing the textDocument| |parse-{uuid}|name of websocket attribute containing parse tree XML| diff --git a/webapp/lsp-manager/api-jobs.xqm b/webapp/lsp-manager/api-jobs.xqm deleted file mode 100644 index 9eaaa58..0000000 --- a/webapp/lsp-manager/api-jobs.xqm +++ /dev/null @@ -1,37 +0,0 @@ -module namespace joba = 'app/jobs'; - -declare variable $joba:names:=("id","type","state","user","duration","time","start"); -(: - id: job ID - type: type of the job (command, query, REST, RESTXQ, etc.) - state: current state of the job: scheduled, queued, running, cached - user: user who started the job - duration: evaluation time (included if a job is running or if the result was cached) - start: next start of job (included if a job will be executed repeatedly) - time: time when job was registered - :) -declare function joba:jobs() -as element(job)* -{ - job:list()[. ne job:current()] ! job:list-details(.) -}; - -declare function joba:table($jobs as element(job)*,$names as xs:string+) -as element(table) -{ - - - {$names!} - - - {for $j in $jobs - return - {for $n in $names - let $val:= $j/@*[name() eq $n] - return - } - } - -
{ . }
{$val/string()}
- -}; \ No newline at end of file diff --git a/webapp/lsp-manager/api-sockets.xqm b/webapp/lsp-manager/api-sockets.xqm new file mode 100644 index 0000000..8b5d2d7 --- /dev/null +++ b/webapp/lsp-manager/api-sockets.xqm @@ -0,0 +1,19 @@ +module namespace wsa = 'app/sockets'; +import module namespace ws="http://basex.org/modules/ws"; + + +declare function wsa:wsids() +as xs:string* +{ + ws:ids() +}; + +declare %rest:path('/app/api/sockets') +function wsa:list() +as element(ul) +{ + + +}; \ No newline at end of file diff --git a/webapp/lsp-manager/app.xqm b/webapp/lsp-manager/app.xqm index ce75122..3d2d264 100644 --- a/webapp/lsp-manager/app.xqm +++ b/webapp/lsp-manager/app.xqm @@ -3,7 +3,7 @@ :) module namespace app = 'app/common'; import module namespace cm = "app/cm" at "common.xqm"; - +import module namespace wsa = 'app/sockets' at "api-sockets.xqm"; (:~ : Redirects to the start page. @@ -50,9 +50,25 @@ function app:home() as item()* { -declare %rest:path('/app/sockets') -function app:profile() { - cm:htmx2("sockets.htm", map{}) +declare %rest:path('/app/socket') +function app:sockets() { + cm:htmx2("sockets.htm", map{"sockets": wsa:wsids()=>reverse() + ,"count":count( wsa:wsids()) + }) +}; + +declare %rest:path('/app/socket/{$wsid}') +function app:socket($wsid) { + let $files:=ws:get($wsid,"files") + let $file:= $files($files=>map:keys()=>head()) + let $doc:=ws:get($wsid,$file?textDocument) + return cm:htmx2("socket.htm", map{ + "wsid": $wsid, + "connectTime": ws:get($wsid,"connectTime"), + "files": map:keys($files), + "file1": json:serialize($file, { 'format': 'w3', 'indent': 'no' }), + "doc": json:serialize($doc, { 'format': 'w3', 'indent': 'no' }) + }) }; declare %rest:path('/app/dev') @@ -60,21 +76,3 @@ function app:dev() { cm:htmx2("dev/home.htm", map{}) }; - -declare %rest:path('/app/notifications') -function app:notifications() { - cm:htmx2("notifications.htm", map{}) -}; - -declare %rest:path('/app/components') -function app:components() { - cm:htmx2("components.htm", map{}) -}; - -declare %rest:path('/app/tweets') -function app:tweets() { - cm:htmx2("tweets.htm", map{}) -}; - - - diff --git a/webapp/lsp-manager/static/favicon.png b/webapp/lsp-manager/static/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..41b0e9a6b724b947de2391e05a2793f103b7a8ad GIT binary patch literal 3877 zcmZ8kcTkgC(|>f||uib-+|Bw+c2w0^3Kl%SI1*lu83;-R~ zQ(h4!4|@IIsDEyxfBoM`X;l1&XsB^%{`Is}yGBL-JEb5m|7SOeWE;2lUZ471=5ZrE zxK*(I8a|{{;8R#{+w^DL=iXiAlvn4#Dq<=8Ne?(V+>loP^b||=dWcy*7LzmNfW+Kp zl{NlEfG~5^8tKt8E7e$O?w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S2zG9Xxd#k= z%ioDeVCcv@iYb0oBY;umqIX%`HDBj%sfTcMRxg{6pa4?e+|A!VSRKSp^^-~#zkGOIs5D@gP zPG2QR&Uvr*xn2^rrI7Exj#|6C-Y}5$ftnlL6TaJT$k}50~kTeNHX-$JWuF`-YU3cn3F)c(!xsGIrseXtYZukQ0ICf7D}<%N;mA?E2;^?lyPxJU z)0s4YAt>T{)N{W}ZnC6kpT^~?)vR(&g~5+#L)Fi>8YFlIuz$Z9)KQfcb0{uPL~AxR z6j6>4T`*`}Y^9%ShC{$=1+4eq#!$)#)tn$CztNEPN+9VixZ0|IH?(de8bxMc09ufixL_3)~ucKTXlJb^A;Lgv>7 zTv9P#Qr)wOMsm};Z=7j~pD2GvIOA&@KW;QTL$(Y54t05|ae6!i-UUj;IulNw8vZi| zZCXAHn&w|9RK;w)@1QvY`G>+ZM9oYP*;PS2^Q-x?jR+*vi}C*cW72j7ui$7_AUSmd z*Abc!Y}W1?mA5-g?Fvsw$?NXlbl;s4cg^;;PwvO`iw4=kkCn9twLfmK{YW%7K>+P) zKk%}T$;e0A5xKORuxHwrcJkVb(&qL>xu0Hmbk3hTJzcs%9iz0*SW3f6AYLxsRexqZ NBYktda$U!${{WaS88rX^ literal 0 HcmV?d00001 diff --git a/webapp/lsp-manager/views/components.htm b/webapp/lsp-manager/views/components.htm deleted file mode 100644 index 67702c2..0000000 --- a/webapp/lsp-manager/views/components.htm +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Components - - - -
-

Components (test page) wc

-

You have no direct messages - -

- - Available Trees - - -
- - Slide 1 - Slide 2 - Slide 3 - Slide 4 - Slide 5 - Slide 6 - Slide 21 - Slide 22 - Slide 23 - Slide 24 - Slide 25 - Slide 26 - - -
-
- - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/job/home.htm b/webapp/lsp-manager/views/job/home.htm deleted file mode 100644 index b40c99f..0000000 --- a/webapp/lsp-manager/views/job/home.htm +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Jobs home - - - -
- - - -
-
-
-
-
Something - ,covers:
-
    -
  • aaa
  • -
-
-
-
-
-
-
-
Job tasks
- - - -
-

Last updated 3 mins ago

-
-
-
-
- - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/job/list.htm b/webapp/lsp-manager/views/job/list.htm deleted file mode 100644 index e31942c..0000000 --- a/webapp/lsp-manager/views/job/list.htm +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Jobs - - - -
-
- - Jobs home - jobs 4 - - Refresh -
- -

Jobs

-
-
- Nothing Yet! -
- -
- - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/layout.htm b/webapp/lsp-manager/views/layout.htm index a7c8160..d6da21f 100644 --- a/webapp/lsp-manager/views/layout.htm +++ b/webapp/lsp-manager/views/layout.htm @@ -19,20 +19,10 @@ /> LSP manager - - - - - - - + - - + @@ -40,84 +30,21 @@
-
- -
- -
- + diff --git a/webapp/lsp-manager/views/notifications.htm b/webapp/lsp-manager/views/notifications.htm deleted file mode 100644 index 93238a5..0000000 --- a/webapp/lsp-manager/views/notifications.htm +++ /dev/null @@ -1,15 +0,0 @@ - - - - - Notifications - - - -
-

Notifications

-
- - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/pdf/home.htm b/webapp/lsp-manager/views/pdf/home.htm deleted file mode 100644 index 94ed1ae..0000000 --- a/webapp/lsp-manager/views/pdf/home.htm +++ /dev/null @@ -1,78 +0,0 @@ - - - - - PDF home - - - -
- - - -
-
-
-
-
PDF slugs - ,covers:
-
    -
  • aaa
  • -
-
-
-
-
-
-
-
PDF tasks
- -
- -
- - -
- -
-
- update covers - - -
- -
- -
-

Last updated 3 mins ago

-
-
-
-
- - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/pdf/item-iframe.htm b/webapp/lsp-manager/views/pdf/item-iframe.htm deleted file mode 100644 index 7e3cea2..0000000 --- a/webapp/lsp-manager/views/pdf/item-iframe.htm +++ /dev/null @@ -1,16 +0,0 @@ - - - - - PDF-view - - - -
- -
- - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/pdf/item.htm b/webapp/lsp-manager/views/pdf/item.htm deleted file mode 100644 index f1b0b59..0000000 --- a/webapp/lsp-manager/views/pdf/item.htm +++ /dev/null @@ -1,60 +0,0 @@ - - - - - PDF - - - -
- - PDF - list - # - - -
-
- Image of cover page. - -
-
-
-
Card title
-

This is a wider card with supporting text below as a natural lead-in to additional - content. This card has even longer content than the first to show that equal height action.

-

Last updated 3 mins ago

-
-
- -
-
-
Tasks
-
-
- - - -
- - -
-
-
-

Last updated 3 mins ago

-
-
- -
-
- - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/pdf/list.htm b/webapp/lsp-manager/views/pdf/list.htm deleted file mode 100644 index be60fff..0000000 --- a/webapp/lsp-manager/views/pdf/list.htm +++ /dev/null @@ -1,53 +0,0 @@ - - - - - Pdfs - - - -
- - PDF - list (#) - - -
- - - -
- -
path
- {pdf.index} -
- - - {pdf} - - - - -
-
- - Image of cover page. - -
-
- -
- slug:
{pdf.id}
-
-
-
- - -
-
- - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/pdf/settings.htm b/webapp/lsp-manager/views/pdf/settings.htm deleted file mode 100644 index 168c1a3..0000000 --- a/webapp/lsp-manager/views/pdf/settings.htm +++ /dev/null @@ -1,97 +0,0 @@ - - - - - Settings - - - -
- - PDF - settings - -
-
- Settings -
- -
- -
-
-
- -
-
- - -
- -
-
-
-
- -
- - -
- - None - Fade - slide-fade - bounce - -
-
-
-
-
-
- Save - Reset to default values -
-
- -
- - - - - \ No newline at end of file diff --git a/webapp/lsp-manager/views/socket.htm b/webapp/lsp-manager/views/socket.htm new file mode 100644 index 0000000..2a1fbbf --- /dev/null +++ b/webapp/lsp-manager/views/socket.htm @@ -0,0 +1,24 @@ + + + + + socket + + + +
+

# @ #

+ +
+
doc
+
doc
+
+ + + \ No newline at end of file diff --git a/webapp/lsp-manager/views/sockets.htm b/webapp/lsp-manager/views/sockets.htm index 6285400..22ef05c 100644 --- a/webapp/lsp-manager/views/sockets.htm +++ b/webapp/lsp-manager/views/sockets.htm @@ -8,8 +8,13 @@
-

{uid} profile

-
+

Active sockets #

+
diff --git a/webapp/lsp-manager/views/tweets.htm b/webapp/lsp-manager/views/tweets.htm deleted file mode 100644 index bf3928f..0000000 --- a/webapp/lsp-manager/views/tweets.htm +++ /dev/null @@ -1,67 +0,0 @@ - - - - -Tweets - - -
-

Tweets

-
- -
- 2020-07-15T09:17:00-04:00 -
-
Another use case for 'this.context' I think might be valid: forms. They're too painful right now.
-
-
- -
- 2024-04-15T09:17:00-04:00
-
I just published “What will Datasmoothie bring to the analytics startup landscape?” https://medium.com/@afanasjevas/what-will-datasmoothie-bring-to-the-analytics-startup-landscape-f7dab70d75c3?source=tw-81c4e81fe6f8-1427630532296
-
-
- -
52m52 minutes ago
-
new talks uploaded on our YouTube page - check them out http://bit.ly/1yoXSAO
-
- -
- - diff --git a/webapp/lsp/lsp-ws.xqm b/webapp/lsp/lsp-ws.xqm index ddf7389..942b902 100644 --- a/webapp/lsp/lsp-ws.xqm +++ b/webapp/lsp/lsp-ws.xqm @@ -20,6 +20,7 @@ function lsp-ws:connect() as empty-sequence() { let $id:=ws:id()=>trace("CONNECT: ") return ( ws:set($id, "id", $id), + ws:set($id, "connectTime", current-dateTime()), ws:set($id, "initialized", false()) ) };