vesta-web 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. vesta/__init__.py +486 -0
  2. vesta/db/UNIAUTH.sql +58 -0
  3. vesta/db/db_service.py +253 -0
  4. vesta/emptyProject/.gitignore +16 -0
  5. vesta/emptyProject/.gitlab-ci.yml +12 -0
  6. vesta/emptyProject/CONTRIBUTING.md +45 -0
  7. vesta/emptyProject/LICENSE.md +3 -0
  8. vesta/emptyProject/README.md +44 -0
  9. vesta/emptyProject/crons/exemple.py +13 -0
  10. vesta/emptyProject/db/schema.sql +0 -0
  11. vesta/emptyProject/install.sh +17 -0
  12. vesta/emptyProject/mailing/mailReset.html +1 -0
  13. vesta/emptyProject/mailing/mailVerif.html +1 -0
  14. vesta/emptyProject/misc/nginx_local +15 -0
  15. vesta/emptyProject/misc/nginx_prod +29 -0
  16. vesta/emptyProject/misc/nginx_prod_ws +29 -0
  17. vesta/emptyProject/misc/vesta.service +11 -0
  18. vesta/emptyProject/requirements.txt +0 -0
  19. vesta/emptyProject/server_static.ini +6 -0
  20. vesta/emptyProject/server_static.py +15 -0
  21. vesta/emptyProject/server_static_orm.ini +13 -0
  22. vesta/emptyProject/server_static_orm.py +15 -0
  23. vesta/emptyProject/server_vesta.ini +27 -0
  24. vesta/emptyProject/server_vesta.py +17 -0
  25. vesta/emptyProject/server_vesta_ws.ini +31 -0
  26. vesta/emptyProject/server_vesta_ws.py +56 -0
  27. vesta/emptyProject/static/home/auth.css +101 -0
  28. vesta/emptyProject/static/home/auth.html +38 -0
  29. vesta/emptyProject/static/home/auth.js +159 -0
  30. vesta/emptyProject/static/home/reset.html +33 -0
  31. vesta/emptyProject/static/home/verif.html +33 -0
  32. vesta/emptyProject/static/main.html +14 -0
  33. vesta/emptyProject/static/main.mjs +9 -0
  34. vesta/emptyProject/static/mobileUiManifest.mjs +3 -0
  35. vesta/emptyProject/static/style.css +0 -0
  36. vesta/emptyProject/static/translations/en.mjs +2 -0
  37. vesta/emptyProject/static/translations/fr.mjs +2 -0
  38. vesta/emptyProject/static/translations/translation.mjs +51 -0
  39. vesta/emptyProject/static/ws/onMessage.mjs +21 -0
  40. vesta/emptyProject/tests/example/foo.py +7 -0
  41. vesta/http/baseServer.py +257 -0
  42. vesta/http/error.py +5 -0
  43. vesta/http/redirect.py +5 -0
  44. vesta/http/response.py +85 -0
  45. vesta/mailing/mailing_service.py +126 -0
  46. vesta/scripts/initDB.py +52 -0
  47. vesta/scripts/install.py +76 -0
  48. vesta/scripts/testsRun.py +83 -0
  49. vesta/scripts/utils.py +84 -0
  50. vesta/scripts/vesta.py +225 -0
  51. vesta_web-1.1.0.dist-info/METADATA +55 -0
  52. vesta_web-1.1.0.dist-info/RECORD +55 -0
  53. vesta_web-1.1.0.dist-info/WHEEL +4 -0
  54. vesta_web-1.1.0.dist-info/entry_points.txt +2 -0
  55. vesta_web-1.1.0.dist-info/licenses/LICENSE.md +5 -0
@@ -0,0 +1,56 @@
1
+ from vesta import Server, HTTPError, HTTPRedirect
2
+
3
+ from os.path import abspath, dirname
4
+ import json
5
+
6
+ # websockets imports
7
+ import asyncio
8
+ import websockets
9
+ import threading
10
+
11
+ PATH = dirname(abspath(__file__))
12
+
13
+ class App(Server):
14
+ features = {"websockets": True, "errors": {404: "/static/404.html"}}
15
+ clients = []
16
+
17
+ @Server.expose
18
+ def index(self):
19
+ return self.file(PATH + "/static/home/home.html")
20
+
21
+ def onLogin(self, uid):
22
+ pass
23
+
24
+ def clean(self):
25
+ for client, ws in self.pool.items():
26
+ self.db.deleteSomething("active_client",client)
27
+
28
+ # --------------------------------WEBSOCKETS--------------------------------
29
+
30
+ async def handle_message(self, websocket):
31
+ self.clients.append(websocket)
32
+ self.calls = {}
33
+
34
+ async for message in websocket:
35
+ data = json.loads(message)
36
+ print("WS message received :",message)
37
+ match data["type"]:
38
+ case "register":
39
+ self.waiting_clients[self.currentWaiting] = {"connection": websocket, "uid": data["uid"]}
40
+ self.currentWaiting += 1
41
+ answer = {"type": "register_request", "servId": self.id, "connectionId": self.currentWaiting - 1}
42
+ await websocket.send(json.dumps(answer))
43
+ case "unregister":
44
+ print("unregister received")
45
+ if self.checkWSAuth(websocket,data["clientID"]):
46
+ client = self.db.getSomething("active_client", data["clientID"])
47
+ self.db.deleteSomething("active_client",data["clientID"])
48
+ self.db.deleteSomething("subscription",data["clientID"],selector="client")
49
+ self.pool.pop(data["clientID"])
50
+ await self.sendStatusUpdatesAsync(client["userid"])
51
+ else:
52
+ self.waiting_clients.pop(data["clientID"])
53
+ case _:
54
+ print("unknown message received", message)
55
+
56
+ App(path=PATH, configFile="/server.ini")
@@ -0,0 +1,101 @@
1
+ @font-face {
2
+ font-family: 'Arimo';
3
+ font-style: normal;
4
+ font-weight: 400;
5
+ src: url('../fonts/Arimo-VariableFont_wght.ttf') format("truetype-variations");
6
+ font-display: swap;
7
+ }
8
+
9
+ form h6 {
10
+ color: #404040;
11
+ font-size: 2rem;
12
+ text-align: center;
13
+ margin: 0.5rem 0;
14
+ }
15
+
16
+ html, body {
17
+ margin:0;
18
+ width: 100vw;
19
+ z-index: 20;
20
+ background: white;
21
+ position: fixed;
22
+ height: 100svh;
23
+ display:flex;
24
+ top: 0;
25
+ box-shadow: 10px 10px 34px -14px rgba(0,0,0,0.75);
26
+ -webkit-box-shadow: 10px 10px 34px -14px rgba(0,0,0,0.75);
27
+ -moz-box-shadow: 10px 10px 34px -14px rgba(0,0,0,0.75);
28
+ justify-content: center;
29
+ flex-direction: column;
30
+ align-items: center;
31
+ --lefancypuple: #667dff;
32
+ font-family: 'Arimo', sans-serif;
33
+ }
34
+
35
+ .input {
36
+ border-style: solid;
37
+ font-size: 16px;
38
+ height: 52px;
39
+ padding: 0 16px;
40
+ width: calc(100% - 32px);
41
+ color: #2d333a;
42
+ background-color: white;
43
+ border-radius: 5px;
44
+ margin: 1rem 0;
45
+ border: 1px solid #c2c8d0;
46
+ }
47
+
48
+ .submit {
49
+ background-color: var(--lefancypuple);
50
+ color: #ffffff;
51
+ border-radius: 5px;
52
+ width: 100%;
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+ margin-top: 1rem;
57
+ min-height: 52px;
58
+ font-size: 16px;
59
+ cursor: pointer;
60
+ border: 0;
61
+ }
62
+
63
+ form {
64
+ display: flex;
65
+ flex-direction: column;
66
+ align-items: center;
67
+ width: 95%;
68
+ max-width: 350px;
69
+ }
70
+
71
+ form p {
72
+ color: #404040;
73
+ font-size: 1rem;
74
+ margin: 0.8rem 0;
75
+ text-align: center;
76
+ line-height: 1.3rem;
77
+ }
78
+
79
+ form p a{
80
+ color: #404040;
81
+ }
82
+ #messageframe {
83
+ height: 2rem;
84
+ border: none;
85
+ color: red;
86
+ font-size: 1rem;
87
+ }
88
+
89
+ input.disabled {
90
+ cursor: not-allowed;
91
+ pointer-events: bounding-box;
92
+ color: #7b7b7b;
93
+ background: #f1f1f1;
94
+ }
95
+
96
+ .action {
97
+ margin-top: 1rem;
98
+ font-size: 1rem;
99
+ text-decoration: underline;
100
+ cursor: pointer;
101
+ }
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html lang="fr">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title> Disclone | Login 🧮</title>
6
+ <meta name="referrer" content="always">
7
+ <meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=10.0,minimal-ui">
8
+ <meta name="referrer" content="always">
9
+ <meta name="mobile-web-app-capable" content="yes">
10
+ <meta name="apple-mobile-web-app-capable" content="yes">
11
+ <meta name="apple-mobile-web-app-title" content="Disclone">
12
+ <meta content="website" property="og:type">
13
+ <meta content="https://disclone.carbonlab.dev" property="og:url">
14
+ <meta name="description" content="The better discord, tracker free and open source">
15
+ <meta name="keywords" content="disclone">
16
+ <meta content="Disclone" property="og:site_name">
17
+ <meta content="The better discord, tracker free and open source" property="og:title">
18
+ <meta content="/static/logo.png" property="og:image">
19
+
20
+ <link href="/static/home/auth.css" rel="stylesheet">
21
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
22
+ <script src="/static/home/auth.js"></script>
23
+ </head>
24
+ <body onload="attachFormSubmitEvent('logForm',loginSubmit)">
25
+ <p id="messageframe"></p>
26
+ <form id="logForm" >
27
+
28
+ <h6 class="login">Login or Create your account</h6>
29
+ <p class="login">We take your privacy seriously. You control your information and won't be spammed.</p>
30
+
31
+ <input class="input login" name="email" id="email" type="email" placeholder="Email address *" required>
32
+ <input class="input login" name="password" id="password" type="password" placeholder="Password *" minlength="8" required>
33
+
34
+ <button type="submit" name="action" class="submit login">Continue</button>
35
+ <div class="action" onclick="askReset()">Forgot your password?</div>
36
+ </form>
37
+ </body>
38
+ </html>
@@ -0,0 +1,159 @@
1
+ function loginSubmit(event) {
2
+ let url = "/login";
3
+ const queryString = window.location.search;
4
+ const urlParams = new URLSearchParams(queryString);
5
+
6
+ if (urlParams.has('parrain')){
7
+ const parrain = urlParams.get('parrain')
8
+ url+="?parrain="+parrain
9
+ }
10
+
11
+ const errorBox = document.querySelector("#messageframe");
12
+ let request = new XMLHttpRequest();
13
+ request.open('POST', url, true);
14
+ request.onload = function() { // request successful
15
+ console.log(request.responseText)
16
+ if (request.responseText === "ok"){
17
+ if (urlParams.has('ref')){
18
+ const ref = urlParams.get('ref')
19
+ window.location.href = "/" + ref;
20
+ }else{
21
+ window.location.href = "/channels";
22
+ }
23
+ }else if(request.responseText === "verif"){
24
+ if (urlParams.has('ref')){
25
+ const ref = urlParams.get('ref')
26
+ window.location.href = "/verif?ref="+ref
27
+ }else{
28
+ window.location.href = "/verif";
29
+ }
30
+ }else{
31
+ errorBox.innerHTML=request.responseText
32
+ }
33
+ };
34
+
35
+ request.onerror = function() {
36
+ console.log("request failed")
37
+ };
38
+
39
+ request.send(new FormData(event.target));
40
+ event.preventDefault();
41
+ }
42
+
43
+ function signupSubmit(event){
44
+ const url = "/signup";
45
+ const errorBox = document.querySelector("#messageframe");
46
+ const queryString = window.location.search;
47
+ const urlParams = new URLSearchParams(queryString);
48
+
49
+ let request = new XMLHttpRequest();
50
+ request.open('POST', url, true);
51
+ request.onload = function() { // request successful
52
+ if (request.responseText === "ok"){
53
+ if (urlParams.has('ref')){
54
+ const ref = urlParams.get('ref')
55
+ window.location.href = "/" + ref;
56
+ }else{
57
+ window.location.href = "/channels";
58
+ }
59
+ }else{
60
+ errorBox.innerHTML=request.responseText
61
+ }
62
+ };
63
+
64
+ request.onerror = function() {
65
+ console.log("request failed")
66
+ };
67
+
68
+ console.log(new FormData(event.target))
69
+ request.send(new FormData(event.target));
70
+ event.preventDefault();
71
+ }
72
+
73
+ function resetSubmit(event){
74
+ const url = "/changePasswordVerif";
75
+ const errorBox = document.querySelector("#messageframe");
76
+
77
+ let request = new XMLHttpRequest();
78
+ request.open('POST', url, true);
79
+ request.onload = function() { // request successful
80
+ if (request.responseText === "ok"){
81
+ window.location.href = "/auth";
82
+ }else{
83
+ errorBox.innerHTML=request.responseText
84
+ }
85
+ };
86
+
87
+ request.onerror = function() {
88
+ console.log("request failed")
89
+ };
90
+
91
+ console.log(new FormData(event.target))
92
+ request.send(new FormData(event.target));
93
+ event.preventDefault();
94
+ }
95
+
96
+ function attachFormSubmitEvent(formId,fn){
97
+ document.getElementById(formId).addEventListener("submit", fn);
98
+ }
99
+
100
+ function resendValidation(){
101
+ const resendBtn = document.querySelector("#resend");
102
+ setTimeout(() => {activateBtn(resendBtn)}, 10000)
103
+ resendBtn.style.color="lightgray"
104
+ resendBtn.onclick="none"
105
+
106
+ const url = "/resendVerif";
107
+ const errorBox = document.querySelector("#messageframe");
108
+
109
+ let request = new XMLHttpRequest();
110
+ request.open('POST', url, true);
111
+ request.onload = function() {
112
+ };
113
+
114
+ request.onerror = function() {
115
+ console.log("request failed")
116
+ };
117
+ request.send();
118
+ }
119
+
120
+ function activateBtn(btn){
121
+ btn.style.color="grey"
122
+ btn.onclick=resendValidation
123
+ }
124
+
125
+ function initReset(){
126
+ const queryString = window.location.search;
127
+ const urlParams = new URLSearchParams(queryString);
128
+
129
+ if (urlParams.has('email')){
130
+ const mailBox = document.getElementById("mail")
131
+ mailBox.value = urlParams.get('email')
132
+ attachFormSubmitEvent('resetForm',resetSubmit)
133
+ }
134
+ }
135
+
136
+ function askReset(){
137
+ const errorBox = document.querySelector("#messageframe");
138
+ const mail = document.getElementById("email").value
139
+ if (mail === ""){
140
+ errorBox.innerHTML="Please enter your email to reset your password"
141
+ return
142
+ }
143
+ const url = "/passwordReset?email="+mail;
144
+
145
+ let request = new XMLHttpRequest();
146
+ request.open('POST', url, true);
147
+ request.onload = function() {
148
+ if (request.responseText === "ok"){
149
+ window.location.href = "/reset?email="+mail;
150
+ }else{
151
+ errorBox.innerHTML=request.responseText
152
+ }
153
+ };
154
+
155
+ request.onerror = function() {
156
+ console.log("request failed")
157
+ };
158
+ request.send();
159
+ }
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title> Disclone | Reset Password 🧮</title>
6
+ <meta name="referrer" content="always">
7
+ <meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=10.0,minimal-ui">
8
+ <meta name="mobile-web-app-capable" content="yes">
9
+ <meta name="apple-mobile-web-app-capable" content="yes">
10
+ <meta name="apple-mobile-web-app-title" content="Smooth Projects">
11
+ <meta content="website" property="og:type">
12
+ <meta content="https://seedify.carbonlab.dev" property="og:url">
13
+ <meta name="description" content="Smooth Projects vous offre la possibilité de faire pousser votre carrière professionnelle de manière naturelle et efficace. Avec notre interface intuitive basée sur des swipe, trouver votre prochain emploi n'a jamais été aussi facile. Nous croyons en une croissance durable et en l'importance de soutenir les talents locaux. Rejoignez Smooth Projects pour faire germer votre avenir professionnel dès aujourd'hui!">
14
+ <meta name="keywords" content="Smooth Projects, job, emploi, swipe, tinder, linkedin, start-up">
15
+ <meta content="Smooth Projects" property="og:site_name">
16
+ <meta content="Smooth Projects" property="og:title">
17
+ <meta content="Smooth Projects vous offre la possibilité de faire pousser votre carrière professionnelle de manière naturelle et efficace. Avec notre interface intuitive basée sur des swipe, trouver votre prochain emploi n'a jamais été aussi facile. Nous croyons en une croissance durable et en l'importance de soutenir les talents locaux. Rejoignez Smooth Projects pour faire germer votre avenir professionnel dès aujourd'hui!" property="og:description">
18
+ <link href="/static/home/auth.css" rel="stylesheet">
19
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
20
+ <script src="/static/home/auth.js"></script>
21
+ </head>
22
+ <body onload="initReset()">
23
+ <p id="messageframe"></p>
24
+ <form id="resetForm">
25
+ <h6 class="login">Réinitialiser votre mot de passe</h6>
26
+ <p class="login">Pour réinitialiser votre mot de passe, veuillez vérifier votre mail en remplissant le code reçu par mail ci-dessous.</p>
27
+ <input class="input login disabled" name="mail" id="mail" type="text" required readonly>
28
+ <input class="input login" name="code" id="code" type="text" placeholder="Code reçu par mail *" required>
29
+ <input class="input login" name="password" id="password" type="password" placeholder="New password *" minlength="8" required>
30
+ <button type="submit" name="action" class="submit login">Reset Password</button>
31
+ </form>
32
+ </body>
33
+ </html>
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title> Disclone | Verify mail 🧮</title>
6
+ <meta name="referrer" content="always">
7
+ <meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=10.0,minimal-ui">
8
+ <meta name="mobile-web-app-capable" content="yes">
9
+ <meta name="apple-mobile-web-app-capable" content="yes">
10
+ <meta name="apple-mobile-web-app-title" content="Smooth Projects">
11
+ <meta content="website" property="og:type">
12
+ <meta content="https://seedify.carbonlab.dev" property="og:url">
13
+ <meta name="description" content="Smooth Projects vous offre la possibilité de faire pousser votre carrière professionnelle de manière naturelle et efficace. Avec notre interface intuitive basée sur des swipe, trouver votre prochain emploi n'a jamais été aussi facile. Nous croyons en une croissance durable et en l'importance de soutenir les talents locaux. Rejoignez Smooth Projects pour faire germer votre avenir professionnel dès aujourd'hui!">
14
+ <meta name="keywords" content="Smooth Projects, job, emploi, swipe, tinder, linkedin, start-up">
15
+ <meta content="Smooth Projects" property="og:site_name">
16
+ <meta content="Smooth Projects" property="og:title">
17
+ <meta content="Smooth Projects vous offre la possibilité de faire pousser votre carrière professionnelle de manière naturelle et efficace. Avec notre interface intuitive basée sur des swipe, trouver votre prochain emploi n'a jamais été aussi facile. Nous croyons en une croissance durable et en l'importance de soutenir les talents locaux. Rejoignez Smooth Projects pour faire germer votre avenir professionnel dès aujourd'hui!" property="og:description">
18
+ <link href="/static/home/auth.css" rel="stylesheet">
19
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
20
+ <script src="/static/home/auth.js"></script>
21
+ </head>
22
+ <body onload="attachFormSubmitEvent('signupForm',signupSubmit)">
23
+ <p id="messageframe"></p>
24
+ <form id="signupForm">
25
+ <h6 class="login">Bienvenue sur Disclone</h6>
26
+ <p class="login">Pour terminer votre inscription, veuillez vérifier votre mail en remplissant le code reçu par mail ci-dessous.</p>
27
+ <input class="input login" name="code" id="code" type="text" placeholder="Code reçu par mail *" required>
28
+ <div id=resend style="color: grey;cursor: pointer;text-decoration: underline" onclick="resendValidation()">renvoyer le code</div>
29
+ <p class="login" style="color:grey;font-size: 0.8rem">En cliquant sur Inscription, vous acceptez nos <a href="/TOS" target="_blank">CGU</a>, notre <a href="/privacy" target="_blank">politique de confidentialité</a> et consentez à l'usage de cookies nécessaires. Vous pourrez vous désinscrire quand bon vous semble</p>
30
+ <button type="submit" name="action" class="submit login">Inscription</button>
31
+ </form>
32
+ </body>
33
+ </html>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Title</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/images/favicon.ico">
8
+ <script type="module" src="/static/main.mjs"></script>
9
+ <link href="/static/style.css" rel="stylesheet">
10
+ </head>
11
+ <body>
12
+ Hello, world!
13
+ </body>
14
+ </html>
@@ -0,0 +1,9 @@
1
+ import global from "/static/framework/global.mjs"
2
+ // import {initWebSockets} from "./framework/websockets.mjs";
3
+ import {initNavigation, printWatermark} from "./framework/navigation.mjs";
4
+ import {initTranslations} from "./translations/translation.mjs";
5
+
6
+ // initWebSockets()
7
+ initNavigation()
8
+ await initTranslations()
9
+ printWatermark("emptyProject@carbonlab.dev", "gitlab.com/louciole/emptyProject")
@@ -0,0 +1,3 @@
1
+ let mobileTemplatesAlts = {
2
+
3
+ }
File without changes
@@ -0,0 +1,2 @@
1
+ export let lang = {
2
+ }
@@ -0,0 +1,2 @@
1
+ export let lang = {
2
+ }
@@ -0,0 +1,51 @@
1
+ export async function initTranslations(){
2
+ if(document.cookie.includes("disclone_lang=")){
3
+ global.settings.lang = document.cookie.split("disclone_lang=")[1].split(";")[0]
4
+ }else{
5
+ global.settings.lang = navigator.language.split("-")[0]
6
+ }
7
+
8
+ let pack;
9
+ try {
10
+ pack = await import("/static/translations/" + global.settings.lang + ".mjs")
11
+ } catch (e) {
12
+ global.settings.lang = "en"
13
+ pack = await import("/static/translations/" + global.settings.lang + ".mjs")
14
+ }
15
+
16
+ global.i18n = pack.lang
17
+ }
18
+
19
+ function setLang(code){
20
+ document.cookie = "disclone_lang=" + code + ";path=/"
21
+ document.location.reload()
22
+ }
23
+ window.setLang = setLang
24
+
25
+ function _t(key){
26
+ const DEBUG = true
27
+ if (DEBUG) {
28
+ if(!global?.i18n[key]){
29
+ console.warn("traduction :", key + " is missing")
30
+ }
31
+ }
32
+
33
+
34
+ if(global.i18n){
35
+ return global.i18n[key] ?? key;
36
+ }
37
+ return key;
38
+ }
39
+ window._t = _t
40
+
41
+ function setLangDropdownText() {
42
+ if(global.settings.lang !== 'fr') {
43
+ let elt = document.querySelector('#lang-dropdown .selected')
44
+ elt.classList.remove("selected")
45
+ elt = document.querySelector('#lang-dropdown .lang-'.concat(global.settings.lang))
46
+ elt.classList.add("selected")
47
+ document.querySelector('#lang-dropdown .dropdown-text').innerText = elt.innerText
48
+ }
49
+ }
50
+ window.setLangDropdownText = setLangDropdownText
51
+
@@ -0,0 +1,21 @@
1
+ import global from "../framework/global.mjs";
2
+ import {xhr} from "../framework/templating.mjs";
3
+
4
+ export function onMessage(event) {
5
+ console.log("Received message from Python server:", event.data);
6
+ const message = JSON.parse(event.data)
7
+ switch (message.type){
8
+ case "register_request":
9
+ //TODO handle multiserver xhr with the received servID
10
+
11
+ const effect = function (){
12
+ global.state.clientID = JSON.parse(this.responseText)
13
+ postWS()
14
+ }
15
+
16
+ xhr("authWS?connectionId=".concat(message.connectionId),effect)
17
+ break
18
+ default:
19
+ break;
20
+ }
21
+ }
@@ -0,0 +1,7 @@
1
+ def run():
2
+ resList = []
3
+ resList.append(dummy())
4
+ return resList
5
+
6
+ def dummy():
7
+ return ("dummy",True)