tg-prepare 2.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.
Files changed (82) hide show
  1. tg_prepare-2.2.2.dist-info/METADATA +20 -0
  2. tg_prepare-2.2.2.dist-info/RECORD +82 -0
  3. tg_prepare-2.2.2.dist-info/WHEEL +5 -0
  4. tg_prepare-2.2.2.dist-info/entry_points.txt +4 -0
  5. tg_prepare-2.2.2.dist-info/licenses/LICENSE +202 -0
  6. tg_prepare-2.2.2.dist-info/projects/.secret_key +1 -0
  7. tg_prepare-2.2.2.dist-info/top_level.txt +2 -0
  8. tgp_backend/__init__.py +17 -0
  9. tgp_backend/auth.py +71 -0
  10. tgp_backend/cli.py +95 -0
  11. tgp_backend/config.py +35 -0
  12. tgp_backend/directories.py +79 -0
  13. tgp_backend/interfaces.py +3 -0
  14. tgp_backend/nextcloud.py +146 -0
  15. tgp_backend/project.py +468 -0
  16. tgp_backend/session_manager.py +47 -0
  17. tgp_backend/tgclient.py +187 -0
  18. tgp_backend/user.py +137 -0
  19. tgp_backend/util.py +131 -0
  20. tgp_ui/__init__.py +0 -0
  21. tgp_ui/app.py +150 -0
  22. tgp_ui/routes/__init__.py +0 -0
  23. tgp_ui/routes/auth.py +72 -0
  24. tgp_ui/routes/collection.py +319 -0
  25. tgp_ui/routes/data.py +229 -0
  26. tgp_ui/routes/project.py +103 -0
  27. tgp_ui/routes/publication.py +229 -0
  28. tgp_ui/routes/tabs.py +34 -0
  29. tgp_ui/routes/views.py +66 -0
  30. tgp_ui/static/css/bootstrap-icons.min.css +5 -0
  31. tgp_ui/static/css/bootstrap.min.css +6 -0
  32. tgp_ui/static/css/bootstrap.min.css.map +1 -0
  33. tgp_ui/static/css/main.css +141 -0
  34. tgp_ui/static/css/navbar.css +92 -0
  35. tgp_ui/static/css/simpleXML.css +67 -0
  36. tgp_ui/static/img/favicon.ico +0 -0
  37. tgp_ui/static/img/textgrid-logo.svg +1 -0
  38. tgp_ui/static/js/bootstrap.bundle.min.js +7 -0
  39. tgp_ui/static/js/collectionManager.js +60 -0
  40. tgp_ui/static/js/fileManager.js +153 -0
  41. tgp_ui/static/js/jquery.min.js +2 -0
  42. tgp_ui/static/js/main.js +36 -0
  43. tgp_ui/static/js/modalManager.js +105 -0
  44. tgp_ui/static/js/navbarManager.js +151 -0
  45. tgp_ui/static/js/projectManager.js +60 -0
  46. tgp_ui/static/js/require.js +5 -0
  47. tgp_ui/static/js/sidebarManager.js +44 -0
  48. tgp_ui/static/js/simpleXML.js +193 -0
  49. tgp_ui/static/js/tabManager.js +83 -0
  50. tgp_ui/templates/auth/login.html +42 -0
  51. tgp_ui/templates/details/empty_container.html +16 -0
  52. tgp_ui/templates/details/manage_collection.html +209 -0
  53. tgp_ui/templates/file_tree.html +39 -0
  54. tgp_ui/templates/includes/get_sessionid.html +29 -0
  55. tgp_ui/templates/includes/publish_form.html +55 -0
  56. tgp_ui/templates/includes/set_sessionid.html +26 -0
  57. tgp_ui/templates/includes/upload_form.html +258 -0
  58. tgp_ui/templates/layout.html +74 -0
  59. tgp_ui/templates/macros.html +101 -0
  60. tgp_ui/templates/modal/delete_project.html +25 -0
  61. tgp_ui/templates/modal/empty_container.html +9 -0
  62. tgp_ui/templates/modal/file_explorer_content.html +34 -0
  63. tgp_ui/templates/modal/file_explorer_main.html +22 -0
  64. tgp_ui/templates/modal/file_explorer_nextcloud.html +27 -0
  65. tgp_ui/templates/modal/github_modal.html +29 -0
  66. tgp_ui/templates/modal/nextcloud_login.html +48 -0
  67. tgp_ui/templates/modal/tei_explorer.html +58 -0
  68. tgp_ui/templates/modal/xpath_parser.html +52 -0
  69. tgp_ui/templates/nxc_login.html +25 -0
  70. tgp_ui/templates/nxc_tab.html +15 -0
  71. tgp_ui/templates/project_main.html +36 -0
  72. tgp_ui/templates/project_navbar.html +81 -0
  73. tgp_ui/templates/projects_main.html +58 -0
  74. tgp_ui/templates/tabs/check_upload.html +87 -0
  75. tgp_ui/templates/tabs/edit_project.html +113 -0
  76. tgp_ui/templates/tabs/empty_container.html +12 -0
  77. tgp_ui/templates/tabs/import_data.html +122 -0
  78. tgp_ui/templates/tabs/manage_collections.html +107 -0
  79. tgp_ui/templates/tabs/publication.html +42 -0
  80. tgp_ui/templates/tabs/select_directories.html +68 -0
  81. tgp_ui/templates/tabs/upload.html +42 -0
  82. tgp_ui/templates/tabs/validate_metadata.html +227 -0
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.4
2
+ Name: tg_prepare
3
+ Version: 2.2.2
4
+ Summary: Simple UI to handle TextGrid imports visually.
5
+ Author: Ralf Klammer, Moritz Wilhelm
6
+ Author-email: ralf.klammer@tu-dresden.de, moritz.wilhelm@tu-dresden.de
7
+ License-File: LICENSE
8
+ Requires-Dist: click
9
+ Requires-Dist: flask
10
+ Requires-Dist: flask_json
11
+ Requires-Dist: flask_login
12
+ Requires-Dist: tg_model>=3.11.0
13
+ Requires-Dist: tgclients
14
+ Requires-Dist: tgadmin
15
+ Requires-Dist: nextcloud-api-wrapper
16
+ Dynamic: author
17
+ Dynamic: author-email
18
+ Dynamic: license-file
19
+ Dynamic: requires-dist
20
+ Dynamic: summary
@@ -0,0 +1,82 @@
1
+ tg_prepare-2.2.2.dist-info/licenses/LICENSE,sha256=deYu6g1OGKm0VUwhM4Octoh8qlzjsiHHxoI-KkCBVBE,11351
2
+ tg_prepare-2.2.2.dist-info/projects/.secret_key,sha256=PF3sI74fctNP5J8NoHmvl6nRsvyTeGMU82UTY_E3re4,66
3
+ tgp_backend/__init__.py,sha256=Hsy1huPlOgpNffJVJpxGZzUKdHU8X837K-cOW_DkEy0,373
4
+ tgp_backend/auth.py,sha256=hUPd0rc01BTT003xpkdmhNc6o0JztbAdimyDb0B9oTQ,2293
5
+ tgp_backend/cli.py,sha256=UJVUYF1Ux0K1V-ibFxSV_uRLEcgSN-lX12LWxHUltNE,2360
6
+ tgp_backend/config.py,sha256=enjLQVzJn5un7796ZYruBRXRn1MxDYoqKk55tC7MAoE,969
7
+ tgp_backend/directories.py,sha256=wNmwc2Uhd9ivZYIM9UkfCv2HkQY8pmDQk2y39wOgBQo,2366
8
+ tgp_backend/interfaces.py,sha256=SO7mOdhkd1f7irUBrwFhp5aKx3UKkkUzU9QBYDl0Tvc,91
9
+ tgp_backend/nextcloud.py,sha256=JNhyJfuR26o33r5QV37ClTALQm_fMQn451SMV5lixNc,5133
10
+ tgp_backend/project.py,sha256=vvO3Y3CWxXZRuxQ7hlkyKM2m0bXH82QAOVlN8r53RHs,15541
11
+ tgp_backend/session_manager.py,sha256=pQGhnXtGPqwdw6xQhZItjGgurx9JBUsIW8mzfSKk_WM,1395
12
+ tgp_backend/tgclient.py,sha256=ZyvIzy_iU5tYh9UKh8rBwDFlZyjK9gP3XwVpa6YrnHo,6619
13
+ tgp_backend/user.py,sha256=5A9M1hIKlqcZ9a27ECE5b0fFsw9YfrzkE6lvZO5u5HM,4415
14
+ tgp_backend/util.py,sha256=4lTaC3liik2ixRcx5wDQS4-FW3QpPhRdXQm32_64J_E,3648
15
+ tgp_ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ tgp_ui/app.py,sha256=5RnzTdXSiuEMVVNMHJMzCGjrBWnSc_W5pD59g6BxEek,4377
17
+ tgp_ui/routes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ tgp_ui/routes/auth.py,sha256=QgDjAgxjnbvl9_y4199lCe8-YZR6l8BWppO7EeqHN1g,1924
19
+ tgp_ui/routes/collection.py,sha256=suKNA4SZTBoePrgEOHeH0H8_bpG7Dbx4153A4rmqufM,9575
20
+ tgp_ui/routes/data.py,sha256=8Ok68gxyA0tW18UBcL-s3DyfWMl8E9Ki0j8sVxSgZzc,7043
21
+ tgp_ui/routes/project.py,sha256=Dj0HyaO5BexfXoTUzaPph96TbqFIP0A1zbFhP6UWxc4,2900
22
+ tgp_ui/routes/publication.py,sha256=CwX2Vi1nYnndBeRnA34Ja-optLDbdVGO1gZy33J_1xI,7361
23
+ tgp_ui/routes/tabs.py,sha256=JaZpoY03S_p8uz_sVRCR-fIOfl-ml0M6CJ7_KaYN9aI,908
24
+ tgp_ui/routes/views.py,sha256=v3Zbe_um4IHdSMzFc9W_sN00EZ33hq_pNTijopydsSg,1977
25
+ tgp_ui/static/css/bootstrap-icons.min.css,sha256=XxUvYRPQvG4RTCkukUmXwvf1N0YF9KQ_ocuWV6O1dk8,85797
26
+ tgp_ui/static/css/bootstrap.min.css,sha256=2FMn2Zx6PuH5tdBQDRNwrOo60ts5wWPC9R8jK67b3t4,232111
27
+ tgp_ui/static/css/bootstrap.min.css.map,sha256=SBRPr2qg-zzSznSNlzAjj4iPSrcV8F2r0cmvLFZxmIo,590038
28
+ tgp_ui/static/css/main.css,sha256=7kEwzqEm7AsLhEh8qEP9mfUDDPY0oeOoL0FkIVky1G8,2594
29
+ tgp_ui/static/css/navbar.css,sha256=D68mfVJ88zruV1sRH1D6zjwQ2MoHRy2HQ7BAn_8OSkc,1609
30
+ tgp_ui/static/css/simpleXML.css,sha256=dfY7UZCiC79BkNOT1hM0GQ6v_yLSxhKCnmV0RZIT9S8,961
31
+ tgp_ui/static/img/favicon.ico,sha256=avMR6pxad-unbXWKHOw8LyGuF59y1-QwpwW3_bTMI0c,15086
32
+ tgp_ui/static/img/textgrid-logo.svg,sha256=wj4rBXvKsyASor_9lvpWQWb39CchruK4WPxE4phzbaI,35349
33
+ tgp_ui/static/js/bootstrap.bundle.min.js,sha256=5P1JGBOIxI7FBAvT_mb1fCnI5n_NhQKzNUuW7Hq0fMc,80496
34
+ tgp_ui/static/js/collectionManager.js,sha256=gbeXe7CtEdCdka3WLfBx7cVRcT8cveUP_t3TDwRdgvo,2291
35
+ tgp_ui/static/js/fileManager.js,sha256=tYshZ85ndkJ19eOyEegcVigUYSWs9BdUopkBRqpNDCE,5871
36
+ tgp_ui/static/js/jquery.min.js,sha256=_xUj-3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej_m4,89501
37
+ tgp_ui/static/js/main.js,sha256=VCaLVlGFml8ObO0mbyV_kT1aDVH-OB4jqVlzsfT42xM,1107
38
+ tgp_ui/static/js/modalManager.js,sha256=8q4Dtx88aO4zbG5EgZ6Nw1NJa36-RKoRcVzy4DVHEVg,4030
39
+ tgp_ui/static/js/navbarManager.js,sha256=E1_SF262uU4I405vxVCrEXhAE7aEZt9ASixG7huL1As,6713
40
+ tgp_ui/static/js/projectManager.js,sha256=LoT8lZnyvrgquSD7aSNkYaAdggH5kUZYRXVFD-d3dzk,2296
41
+ tgp_ui/static/js/require.js,sha256=DCwpJYECNmnwjgb2xsUmuvSrkNPXRYgYADz7nlUc_-Y,20781
42
+ tgp_ui/static/js/sidebarManager.js,sha256=K4MmcKbjJw8bL4TT-UWPYm1qs5y5MT9gECYVI87GW2E,1521
43
+ tgp_ui/static/js/simpleXML.js,sha256=jEkZe3TuiHuEt6V7If_1EmqYIgTywssJ3OwOQzOFYNg,8065
44
+ tgp_ui/static/js/tabManager.js,sha256=s9-Y8isR_KbCbexGs_frNTY3VpxSSqopxIiVZELjCSc,3517
45
+ tgp_ui/templates/file_tree.html,sha256=IKWp5MLUvnFF65cIUIxU4Jf5wi9Fg8koSXD96Mk328E,1640
46
+ tgp_ui/templates/layout.html,sha256=FUjeyNkT6uZdKUe1Q8sWCs4SJxFGW08kDZdbzYvjNYU,3504
47
+ tgp_ui/templates/macros.html,sha256=27-5dI7FrOs_k2x6-y_dhaXhr1I9os-ps4v4K6964qU,4466
48
+ tgp_ui/templates/nxc_login.html,sha256=tDxqHYPZqsY2ZNnkn4a5bMOYiD8ybcNRpzSq7MvMWCo,1269
49
+ tgp_ui/templates/nxc_tab.html,sha256=9HWCa7UZKxL0fZasT_g6uozI64L-497Y2LppPPTHF2M,517
50
+ tgp_ui/templates/project_main.html,sha256=UkHRsticqIcIPoL42W5nyBBYjtKDIOU8P6wgX6nZjXE,1876
51
+ tgp_ui/templates/project_navbar.html,sha256=48JpHahTfOBxR2w_jT7BHZ4oepavyx34SYucNQbBBeA,4422
52
+ tgp_ui/templates/projects_main.html,sha256=2c6PNdomNV1w6j6e-FH27bvdwVNfrzTf5DY1pNzHuMM,2530
53
+ tgp_ui/templates/auth/login.html,sha256=iM_h4SCFHxX4d7ZmgGRROFliNxFKn9WxVGIbEgYZHEg,1869
54
+ tgp_ui/templates/details/empty_container.html,sha256=-xNao7K8Sw74WGuF4pbeBUFZI8wDk9a_O4bq-LiCHaU,553
55
+ tgp_ui/templates/details/manage_collection.html,sha256=VbB9-qxbaQ-rMjlbUD6ixFlG-LNMPHQIA4440RZjfns,11686
56
+ tgp_ui/templates/includes/get_sessionid.html,sha256=lQUXUc71Gb5nxKnckQ7PBpzGkv9pkjHAP3E6jCsleBE,1273
57
+ tgp_ui/templates/includes/publish_form.html,sha256=WAMYA1ezQ4MGvhhKEM_AO3R-BCXZr09rhOqtLw3xv7U,2757
58
+ tgp_ui/templates/includes/set_sessionid.html,sha256=PcyasSD6lzSJ4V22dqkoAvJHEqRfyFNuoTozhfhPQU4,1363
59
+ tgp_ui/templates/includes/upload_form.html,sha256=iwglb8p3dEUlxZ2VzK87w2hnlwQsOM-_jWQ9kcBN80g,14738
60
+ tgp_ui/templates/modal/delete_project.html,sha256=H_IBQWPtY9-V47WWeEMsSg5CzqCk5lxBvKJbOnD-MWo,1285
61
+ tgp_ui/templates/modal/empty_container.html,sha256=UYq6AEqrUXY7Qtn4-HrwXxtOUOq2l1Qj5ZPxgWApg3Y,423
62
+ tgp_ui/templates/modal/file_explorer_content.html,sha256=x3cA2b02VqrGe-YBw2j91hKQg6Vm32bNa0j9XOrL6E8,1317
63
+ tgp_ui/templates/modal/file_explorer_main.html,sha256=mOhEuPzBHSVupBuRU5VYAaTZWYdm84W5kUntKHpa3jo,890
64
+ tgp_ui/templates/modal/file_explorer_nextcloud.html,sha256=gV5w4MF8pk4bg_MiCThGY49hlXIoFhXYE1QpYdO_O7I,1260
65
+ tgp_ui/templates/modal/github_modal.html,sha256=nzH7Y8uMzdGxTlgu8LvvdOyxXSjMyK6TXHL94WYTP9s,1460
66
+ tgp_ui/templates/modal/nextcloud_login.html,sha256=S6ogSAGqNiYOheOV6eZGss7f5XKq88ul0rIuCfftbQs,2411
67
+ tgp_ui/templates/modal/tei_explorer.html,sha256=4JL2d3CfThgDRGnFlhtFONVZBd7nEenmJuZHtYnVxuo,3134
68
+ tgp_ui/templates/modal/xpath_parser.html,sha256=Qkk2Mh53E8l4z486hcboTsQlPHoFPezbMP59pEwB0fY,2552
69
+ tgp_ui/templates/tabs/check_upload.html,sha256=Im9vEyAeK7uORftLl7mcGBYKVxyNYtgJFoArYT9IBi8,4318
70
+ tgp_ui/templates/tabs/edit_project.html,sha256=ssbtzgY9VfTeCgghJR6iov1GdCB2TZ34-H4sTwZwIXQ,6923
71
+ tgp_ui/templates/tabs/empty_container.html,sha256=yBNUUdrbmNbTNdc7xK2HrwztrEpiRPqCICGo0mZNCIQ,433
72
+ tgp_ui/templates/tabs/import_data.html,sha256=Bzbxk7ecvcxOUMbL4i9C47APvhkIZQoxLGhAxNPCxZA,5936
73
+ tgp_ui/templates/tabs/manage_collections.html,sha256=vZLIV6BnZXNxUgQhBX3Fwa65ENcJs-UHaquOQ_7r36A,6065
74
+ tgp_ui/templates/tabs/publication.html,sha256=ycz1juSZfqhbZGZHY-czG_PjdX18Hkw7L80IFb1o2oE,1788
75
+ tgp_ui/templates/tabs/select_directories.html,sha256=zmXIgSJLNTm5ka9i9fx5vkGSVVdOs51QZXkbG5VHOcM,2922
76
+ tgp_ui/templates/tabs/upload.html,sha256=tc-yv-T6hg3-gD3P3Xz7Xdb8qYyaQ9FVoyWDw144mm0,1785
77
+ tgp_ui/templates/tabs/validate_metadata.html,sha256=USGG08KDMrc0rHtDEmma-DCbVEXbspMCIZhBqYfVpe4,12190
78
+ tg_prepare-2.2.2.dist-info/METADATA,sha256=Y4qU_Aho8yLQDEiLtM6RqZ53xdz7ylKpP5Wegaq6SU0,552
79
+ tg_prepare-2.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
80
+ tg_prepare-2.2.2.dist-info/entry_points.txt,sha256=MNkh--aX-ThL2O3Zv48_nkP_bKNYqvNRown5KbPVE9s,110
81
+ tg_prepare-2.2.2.dist-info/top_level.txt,sha256=ueOyX_KdozreQJD_HRs6kAsvGNO4vfM9B_QqqhdyRPI,19
82
+ tg_prepare-2.2.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ tgp_app = tgp_ui.app:startup
3
+ tgp_cli = tgp_backend.cli:main
4
+ tgp_user = tgp_backend.cli:user
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [2025] [TU Dresden - ZIH]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1 @@
1
+ "94c9d50a8949b627be9608827a66d0025919e013d89236b092de90dd0b79fd12"
@@ -0,0 +1,2 @@
1
+ tgp_backend
2
+ tgp_ui
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2023 TU-Dresden (ZIH)
3
+ # ralf.klammer@tu-dresden.deimport logging
4
+
5
+ import logging
6
+
7
+ from .config import LOG_LEVEL
8
+
9
+ log = logging.getLogger(__name__)
10
+
11
+ log_config = dict(
12
+ level=LOG_LEVEL,
13
+ format="%(asctime)s %(name)-10s %(levelname)-4s %(message)s",
14
+ )
15
+
16
+ logging.basicConfig(**log_config)
17
+ logging.getLogger("").setLevel(LOG_LEVEL)
tgp_backend/auth.py ADDED
@@ -0,0 +1,71 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2023-2025 TU-Dresden (ZIH)
3
+ # ralf.klammer@tu-dresden.de
4
+ # moritz.wilhelm@tu-dresden.de
5
+ import logging
6
+
7
+ import json
8
+ import os
9
+ import secrets
10
+
11
+ from typing import Optional
12
+
13
+ # Removed unused import of Path
14
+ from pathlib import Path
15
+
16
+ log = logging.getLogger(__name__)
17
+
18
+
19
+ class SecretKeyManager:
20
+ """Manages the secret key for Flask sessions."""
21
+
22
+ def __init__(self, base_path: str, env_var: str = "FLASK_SECRET_KEY"):
23
+ # Initialize with the base path and environment variable name
24
+ self.env_var = env_var
25
+ self.secret_file = Path(base_path) / ".secret_key"
26
+ self._secret_key: Optional[str] = None
27
+
28
+ @property
29
+ def secret_key(self) -> str:
30
+ """Returns the secret key or generates a new one if it doesn't exist."""
31
+ if self._secret_key is None:
32
+ self._secret_key = self._get_or_create_key()
33
+ return self._secret_key
34
+
35
+ def _get_or_create_key(self) -> str:
36
+ """Fetches the key from the environment or file, or creates a new one."""
37
+ # 1. Try to get the key from the environment variable
38
+ if env_key := os.environ.get(self.env_var):
39
+ log.info(f"Using secret key from {self.env_var}")
40
+ return env_key
41
+
42
+ # 2. Try to load the key from the saved file
43
+ try:
44
+ if self.secret_file.exists():
45
+ with open(self.secret_file) as f:
46
+ log.info(f"Loading secret key from {self.secret_file}")
47
+ return json.load(f)
48
+ except Exception as e:
49
+ log.warning(f"Could not load secret key: {e}")
50
+
51
+ # 3. Generate a new key
52
+ new_key = secrets.token_hex(32)
53
+ log.info("Generating a new secret key")
54
+
55
+ try:
56
+ # Create the directory if it doesn't exist
57
+ self.secret_file.parent.mkdir(parents=True, exist_ok=True)
58
+
59
+ # Save the key to the file
60
+ with open(self.secret_file, "w") as f:
61
+ json.dump(new_key, f)
62
+
63
+ # Set file permissions
64
+ self.secret_file.chmod(0o600)
65
+
66
+ log.info(f"New secret key saved to {self.secret_file}")
67
+ return new_key
68
+
69
+ except Exception as e:
70
+ log.warning(f"Could not save secret key: {e}")
71
+ return new_key
tgp_backend/cli.py ADDED
@@ -0,0 +1,95 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2023-2024 TU-Dresden (ZIH)
3
+ # ralf.klammer@tu-dresden.de
4
+ # moritz.wilhelm@tu-dresden.de
5
+
6
+ import logging
7
+
8
+ import click
9
+ from .util import cli_startup
10
+ from .user import UserManager
11
+
12
+ log = logging.getLogger(__name__)
13
+
14
+
15
+ @click.group()
16
+ @click.option("--debug/--no-debug", "-d", is_flag=True, default=False)
17
+ @click.option("--login", default="rk")
18
+ @click.pass_context
19
+ def main(ctx, debug, login):
20
+ cli_startup(log_level=debug and logging.DEBUG or logging.INFO)
21
+ ctx.ensure_object(dict)
22
+ ctx.obj["DEBUG"] = debug
23
+ ctx.obj["login"] = login
24
+
25
+
26
+ @main.group()
27
+ def user():
28
+ """Benutzerverwaltung"""
29
+ pass
30
+
31
+
32
+ @user.command()
33
+ @click.argument("username")
34
+ @click.argument("password")
35
+ @click.option("--email", default=None)
36
+ @click.option("--role", default="user", type=click.Choice(["user", "admin"]))
37
+ def create(username, password, email, role):
38
+ """Erstelle einen neuen Benutzer"""
39
+ user_manager = UserManager()
40
+
41
+ success, message = user_manager.create_user(
42
+ username, password, email, role
43
+ )
44
+
45
+ if success:
46
+ click.echo(
47
+ click.style(
48
+ f"Benutzer '{username}' erfolgreich erstellt.", fg="green"
49
+ )
50
+ )
51
+ else:
52
+ click.echo(click.style(f"Fehler: {message}", fg="red"))
53
+
54
+
55
+ @user.command()
56
+ def list():
57
+ """Liste alle Benutzer auf"""
58
+ user_manager = UserManager()
59
+
60
+ users = user_manager.users
61
+
62
+ if not users:
63
+ click.echo("Keine Benutzer gefunden.")
64
+ return
65
+
66
+ click.echo(f"{'Benutzername':<20} {'E-Mail':<30} {'Rolle':<10}")
67
+ click.echo("-" * 60)
68
+
69
+ for username, user in users.items():
70
+ email = user.email or "-"
71
+ click.echo(f"{username:<20} {email:<30} {user.role:<10}")
72
+
73
+
74
+ @user.command()
75
+ @click.argument("username")
76
+ def delete(username):
77
+ """Lösche einen Benutzer"""
78
+ user_manager = UserManager()
79
+
80
+ if username not in user_manager.users:
81
+ click.echo(
82
+ click.style(
83
+ f"Fehler: Benutzer '{username}' existiert nicht.", fg="red"
84
+ )
85
+ )
86
+ return
87
+
88
+ if click.confirm(f"Benutzer '{username}' wirklich löschen?"):
89
+ del user_manager.users[username]
90
+ user_manager.save_users()
91
+ click.echo(
92
+ click.style(
93
+ f"Benutzer '{username}' erfolgreich gelöscht.", fg="green"
94
+ )
95
+ )
tgp_backend/config.py ADDED
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2023-2024 TU-Dresden (ZIH)
3
+ # ralf.klammer@tu-dresden.de
4
+ import logging
5
+
6
+ import os
7
+
8
+ from configparser import ConfigParser
9
+
10
+ log = logging.getLogger(__name__)
11
+
12
+
13
+ def get_config_value(section, parameter, default=None):
14
+ _config = ConfigParser()
15
+ _config.read("config.ini")
16
+
17
+ if section not in _config:
18
+ log.warn("Section: %s not in *.ini -> using default" % section)
19
+ return default
20
+ config_val = _config[section].get(parameter)
21
+ if not config_val:
22
+ log.info(
23
+ "Parameter: %s not in section: (%s) of *.ini -> using default: %s"
24
+ % (parameter, section, default)
25
+ )
26
+ return default
27
+ else:
28
+ return config_val
29
+
30
+
31
+ LOG_LEVEL = get_config_value("log", "level", default="INFO")
32
+ MAIN_PATH = get_config_value(
33
+ "main", "path", default=os.path.abspath(os.getcwd() + "/projects")
34
+ )
35
+ MAX_FILENAME_LENGTH = get_config_value("main", "maxFileNameLength", default=15)
@@ -0,0 +1,79 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2023-2024 TU-Dresden (ZIH)
3
+ # ralf.klammer@tu-dresden.de
4
+ import logging
5
+
6
+ import os
7
+ import re
8
+
9
+ from tgp_backend.config import MAX_FILENAME_LENGTH
10
+ from tgp_backend.util import get_file_extension
11
+
12
+ log = logging.getLogger(__name__)
13
+
14
+
15
+ def generateList(path=None):
16
+ # path = path if path else config("main", "path", default="/tmp")
17
+ path = path if path else os.getcwd()
18
+ if not path.startswith("/"):
19
+ path = "/%s" % path
20
+ dList = []
21
+ fList = []
22
+ tp_dict = {}
23
+
24
+ log.debug("generateList - path: %s" % path)
25
+
26
+ for name in os.listdir(path):
27
+ fullpath = "%s/%s" % (path, name)
28
+ if not name.startswith("."):
29
+ if os.path.isdir(fullpath):
30
+ dList.append({"fullpath": fullpath, "name": name})
31
+ else:
32
+ fList.append({"fullpath": fullpath, "name": name})
33
+ dir_list_dict = []
34
+ file_list_dict = []
35
+ # curDir = os.getcwd()
36
+ curDir = path
37
+
38
+ for d in dList:
39
+ if len(d["name"]) > MAX_FILENAME_LENGTH:
40
+ dots = "..."
41
+ else:
42
+ dots = ""
43
+ temp_dir = {}
44
+ temp_dir["f"] = d["name"][0:MAX_FILENAME_LENGTH] + dots
45
+ temp_dir["name"] = d["name"]
46
+ temp_dir["f_url"] = re.sub("#", "|HASHTAG|", d["fullpath"])
47
+ temp_dir["currentDir"] = curDir
48
+ temp_dir["f_complete"] = d["fullpath"]
49
+ temp_dir["size"] = "---"
50
+
51
+ dir_list_dict.append(temp_dir)
52
+
53
+ for f in fList:
54
+ image = None
55
+ try:
56
+ tp = get_file_extension(f["name"])
57
+ except Exception as e:
58
+ log.warn(e)
59
+ pass
60
+ if not image:
61
+ image = "files_icon/unknown-icon.png"
62
+ if len(f["name"]) > MAX_FILENAME_LENGTH:
63
+ dots = "..."
64
+ else:
65
+ dots = ""
66
+ temp_file = {}
67
+ temp_file["f"] = f["name"][0:MAX_FILENAME_LENGTH] + dots
68
+ temp_file["name"] = f["name"]
69
+ temp_file["name_stripped"] = f["name"].replace(f".{tp}", "")
70
+ temp_file["f_url"] = re.sub("#", "|HASHTAG|", f["fullpath"])
71
+ temp_file["extension"] = tp.lower()
72
+ temp_file["currentDir"] = curDir
73
+ temp_file["fullpath"] = f["fullpath"]
74
+ temp_file["image"] = image
75
+ temp_file["is_xml"] = tp.lower() == "xml"
76
+
77
+ file_list_dict.append(temp_file)
78
+
79
+ return dir_list_dict, file_list_dict
@@ -0,0 +1,3 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2023 TU-Dresden (ZIH)
3
+ # ralf.klammer@tu-dresden.de