vesta-web 1.2.0__py3-none-any.whl → 1.2.2__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.
@@ -0,0 +1,9 @@
1
+ export const fillTemplateLitteral = (template, vars = {}) => {
2
+ const handler = new Function('vars', [
3
+ 'const tagged = ( ' + Object.keys(vars).join(', ') + ' ) =>',
4
+ '`' + template + '`',
5
+ 'return tagged(...Object.values(vars))'
6
+ ].join('\n'));
7
+ const res = handler(vars)
8
+ return res;
9
+ };
@@ -1,5 +1,7 @@
1
1
  // This in absolutely no spec, it comes exclusively from my deranged mind
2
2
 
3
+ import {fillTemplateLitteral} from "../framework/utils.mjs";
4
+
3
5
  export class Markdown {
4
6
  constructor() {
5
7
  }
@@ -398,7 +400,7 @@ export class Markdown {
398
400
  content = content.concat(render[0])
399
401
  }
400
402
  token.content = content
401
- return [fillTemplate(this.HTML_equiv[token.type], token), token_id]
403
+ return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
402
404
  case "-#":
403
405
  let smallContent = token.content
404
406
  while (token_id + 1 < tokens.length && tokens[token_id + 1].type !== "endline") {
@@ -408,7 +410,7 @@ export class Markdown {
408
410
  smallContent = smallContent.concat(render[0])
409
411
  }
410
412
  token.content = smallContent
411
- return [fillTemplate(this.HTML_equiv[token.type], token), token_id]
413
+ return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
412
414
  case "*":
413
415
  // this is suboptimal because we're looking for same size closing
414
416
  // smth like *** a ** b * will not work as intended
@@ -418,11 +420,11 @@ export class Markdown {
418
420
  token.content = content
419
421
  if (token.props.level % 2) {
420
422
  if (token.props.level === 3) {
421
- token.content = fillTemplate(this.HTML_equiv["**"], token)
423
+ token.content = fillTemplateLitteral(this.HTML_equiv["**"], token)
422
424
  }
423
- return [fillTemplate(this.HTML_equiv["*"], token), token_id]
425
+ return [fillTemplateLitteral(this.HTML_equiv["*"], token), token_id]
424
426
  } else {
425
- return [fillTemplate(this.HTML_equiv["**"], token), token_id]
427
+ return [fillTemplateLitteral(this.HTML_equiv["**"], token), token_id]
426
428
  }
427
429
  }
428
430
  const render = this.renderToken(tokens[token_id], token_id, tokens)
@@ -431,21 +433,21 @@ export class Markdown {
431
433
  }
432
434
  token.content = "*".repeat(token.props.level)
433
435
  // should be optimized, because we just drop a part of the render here
434
- return [fillTemplate(this.HTML_equiv["text"], token), old_id]
436
+ return [fillTemplateLitteral(this.HTML_equiv["text"], token), old_id]
435
437
  case "~~":
436
438
  case "||":
437
439
  while (token_id + 1 < tokens.length) {
438
440
  token_id += 1
439
441
  if(tokens[token_id].type === token.type){
440
442
  token.content = content
441
- return [fillTemplate(this.HTML_equiv[token.type], token), token_id]
443
+ return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
442
444
  }
443
445
  const render = this.renderToken(tokens[token_id], token_id, tokens)
444
446
  token_id = render[1]
445
447
  content = content.concat(render[0])
446
448
  }
447
449
  token.content = token.type
448
- return [fillTemplate(this.HTML_equiv["text"], token), old_id]
450
+ return [fillTemplateLitteral(this.HTML_equiv["text"], token), old_id]
449
451
  case "[":
450
452
  while (token_id + 1 < tokens.length) {
451
453
  token_id += 1
@@ -459,7 +461,7 @@ export class Markdown {
459
461
  tokens[token_id+3].type === ")"){
460
462
  token.content = content
461
463
  token.props.link = tokens[token_id+2].content
462
- return [fillTemplate(this.HTML_equiv["link"], token), token_id+3]
464
+ return [fillTemplateLitteral(this.HTML_equiv["link"], token), token_id+3]
463
465
  }else{
464
466
  break
465
467
  }
@@ -469,13 +471,13 @@ export class Markdown {
469
471
  content = content.concat(render[0])
470
472
  }
471
473
  token.content = token.type
472
- return [fillTemplate(this.HTML_equiv["text"], token), old_id]
474
+ return [fillTemplateLitteral(this.HTML_equiv["text"], token), old_id]
473
475
  case "color":
474
476
  while (token_id + 1 < tokens.length) {
475
477
  token_id += 1
476
478
  if(tokens[token_id].type === "/>"){
477
479
  token.content = content
478
- return [fillTemplate(this.HTML_equiv[token.type], token), token_id]
480
+ return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
479
481
  }
480
482
  const render = this.renderToken(tokens[token_id], token_id, tokens)
481
483
  token_id = render[1]
@@ -483,9 +485,9 @@ export class Markdown {
483
485
  }
484
486
  token.type="text"
485
487
  token.content = "<$"+token.props?.color
486
- return [fillTemplate(this.HTML_equiv[token.type], token), token_id]
488
+ return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
487
489
  default:
488
- return [fillTemplate(this.HTML_equiv[token.type], token), token_id]
490
+ return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
489
491
  }
490
492
  }
491
493
  }
@@ -497,13 +499,3 @@ class Token{
497
499
  this.props={}
498
500
  }
499
501
  }
500
-
501
- const fillTemplate = (template, vars = {}) => {
502
- const handler = new Function('vars', [
503
- 'const tagged = ( ' + Object.keys(vars).join(', ') + ' ) =>',
504
- '`' + template + '`',
505
- 'return tagged(...Object.values(vars))'
506
- ].join('\n'));
507
- const res = handler(vars)
508
- return res;
509
- };
vesta/http/baseServer.py CHANGED
@@ -82,6 +82,7 @@ class BaseServer:
82
82
  def wrapper(self, *args, **kwargs):
83
83
  res = func(self, *args, **kwargs)
84
84
  self.response.ok()
85
+ self.response.headers.append(('Server', 'Vesta v1 Harpie'))
85
86
  if res:
86
87
  if isinstance(res, bytes):
87
88
  return res
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vesta-web
3
- Version: 1.2.0
3
+ Version: 1.2.2
4
4
  Summary: An extensive web framework adding every feature needed for Carbonlab
5
5
  Project-URL: Homepage, https://gitlab.com/Louciole/vesta
6
6
  Project-URL: Issues, https://gitlab.com/Louciole/vesta/-/issues
@@ -31,6 +31,7 @@ vesta/emptyProject/static/style.css,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
31
31
  vesta/emptyProject/static/framework/global.mjs,sha256=Zr3F9E_DfyYzxqYfdeSBCTezf42VNUqkWR1zB3Py_Tw,124
32
32
  vesta/emptyProject/static/framework/navigation.mjs,sha256=EMI-bTJDp0XqTWxHQkZKyT-u5Q9cKA6QVkF4hJyKrRY,11119
33
33
  vesta/emptyProject/static/framework/templating.mjs,sha256=v0w-JtkOoSgHWAy7_A24jZzvBQ99f5FBii2RrykUAkU,3319
34
+ vesta/emptyProject/static/framework/utils.mjs,sha256=S6Ed6BoFY-OyS4jumQ3BMbyTBRXlIcgEriwz0Pv3VoM,321
34
35
  vesta/emptyProject/static/framework/vesta.mjs,sha256=0YrLyt4US22TIknO3OFWeOQuWimIWLBwMFCoKzBEHX4,5459
35
36
  vesta/emptyProject/static/framework/websockets.mjs,sha256=Ck0bdEj0mVU3PHZ1MtPPz2He47OYl2WmRxqE3NSKh-c,1349
36
37
  vesta/emptyProject/static/home/auth.css,sha256=Vw-wFyQJm1ydDVBHPdKWp4dvzrfFRry4-kgScVFleOM,1924
@@ -38,14 +39,14 @@ vesta/emptyProject/static/home/auth.html,sha256=sz-CC-B4NUqth8aSQqwQCvq2V46AnhaI
38
39
  vesta/emptyProject/static/home/auth.js,sha256=txMlUqr4A-15Czf4MYwaED35XXcaHI_zrc4SpnjItJU,4622
39
40
  vesta/emptyProject/static/home/reset.html,sha256=EcXfX2Vil3NrYhDvEptrIhW9QV9X_kDy59-TK2S_P4w,2655
40
41
  vesta/emptyProject/static/home/verif.html,sha256=tUw96l0FZ5-AXuE8s-7v1nM632onErq5swgCU53zP-s,2906
41
- vesta/emptyProject/static/markdown/markdown.mjs,sha256=eqSV-uzI1PcZS6eev8pqXv2UocDv2NHyFG6v91b-KAo,24105
42
+ vesta/emptyProject/static/markdown/markdown.mjs,sha256=tmrT20hbA2w-6IJ--Xu5sY0U-oryWIqX3HFsr5EoHww,23963
42
43
  vesta/emptyProject/static/markdown/utils.mjs,sha256=PGxhsJfub_lt-LEZVqYt8lKEp_RTRVGXuNhGmWxto-k,614
43
44
  vesta/emptyProject/static/translations/en.mjs,sha256=ouMluPVTgB4Q5vmb7zGE6YGTH4URruog5_a52sBDYNE,22
44
45
  vesta/emptyProject/static/translations/fr.mjs,sha256=ouMluPVTgB4Q5vmb7zGE6YGTH4URruog5_a52sBDYNE,22
45
46
  vesta/emptyProject/static/translations/translation.mjs,sha256=JxJ2peSlYVQK-bUKpfddPLXm0XZiz2yu6A6iWIqpKyM,1422
46
47
  vesta/emptyProject/static/ws/onMessage.mjs,sha256=ow5nwSEdiBcvm-Y2zOUMhnqLp-5xWgo11kHviaTRlTw,658
47
48
  vesta/emptyProject/tests/example/foo.py,sha256=NS9oIXFBOvIyWK1LHwkJm9amJuSMN4cxJwouBrJlh2I,115
48
- vesta/http/baseServer.py,sha256=ltfXhkqJQPcvKlUX1u5jUguPnodDslmM4t1BOO0ZVR8,15083
49
+ vesta/http/baseServer.py,sha256=Fc3eCGB3V9cj2KNiTUuw1N0T6mmg_H70iP9p2psgvnw,15155
49
50
  vesta/http/error.py,sha256=fWdp-oI2ObJD2mHHuxs1yVJvhON5oHYgYFRLAcUMs-I,180
50
51
  vesta/http/redirect.py,sha256=OiDeOmU-X5Mos8a0BQIeOIJqvgWjDEtaYrM4-x4MXl0,177
51
52
  vesta/http/response.py,sha256=G7cmbrXFNbIbQoqNxNkR06I5VymIwjFSAe3LtVa56Ok,3760
@@ -55,8 +56,8 @@ vesta/scripts/initDB.py,sha256=4o_J3IK0vcil2oHvk_qmtqLSlWABcRPFBC3M61-oSF8,1842
55
56
  vesta/scripts/install.py,sha256=GvH_HHx5aU5_54RQ1_2vz4DaLCh42AHfUKy-m0q21vY,2125
56
57
  vesta/scripts/testsRun.py,sha256=bXJImdexKQUDW8CR8F9VIKTrgkd7QfnvHQPENEV4x38,2463
57
58
  vesta/scripts/utils.py,sha256=PR2XPonaoZEbegzV3QX1EHfyq67sU-cbDEUexCuJp9Q,6013
58
- vesta_web-1.2.0.dist-info/METADATA,sha256=-Y1fT4y1JvrNFro0-AnUig48F5cAru500JpWkdsUy-0,1584
59
- vesta_web-1.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
60
- vesta_web-1.2.0.dist-info/entry_points.txt,sha256=MHMrWJwtkb4FmNz0CTpxZzwQ3LTqndXBh8YBPDfXlW4,49
61
- vesta_web-1.2.0.dist-info/licenses/LICENSE.md,sha256=zoPFEFUUoSgosmDBK5fGTWGRHHBaSVuuJT2ZQIYXuIk,177
62
- vesta_web-1.2.0.dist-info/RECORD,,
59
+ vesta_web-1.2.2.dist-info/METADATA,sha256=7d0oKOi2qXIB9cocPpcaBC0_WkV89EmBzkEOjPuvsVI,1584
60
+ vesta_web-1.2.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
61
+ vesta_web-1.2.2.dist-info/entry_points.txt,sha256=MHMrWJwtkb4FmNz0CTpxZzwQ3LTqndXBh8YBPDfXlW4,49
62
+ vesta_web-1.2.2.dist-info/licenses/LICENSE.md,sha256=zoPFEFUUoSgosmDBK5fGTWGRHHBaSVuuJT2ZQIYXuIk,177
63
+ vesta_web-1.2.2.dist-info/RECORD,,