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
vesta/db/db_service.py ADDED
@@ -0,0 +1,253 @@
1
+ from os.path import abspath, dirname
2
+
3
+ import psycopg
4
+ from psycopg.rows import dict_row
5
+ from psycopg import sql
6
+
7
+
8
+ class DB:
9
+ def __init__(self, user, password, host, port, db):
10
+ try:
11
+ self.conn = psycopg.connect(
12
+ user=user,
13
+ password=password,
14
+ host=host,
15
+ port=port,
16
+ dbname=db,
17
+ row_factory=dict_row
18
+ )
19
+ except psycopg.Error as e:
20
+ print(f"Error connecting to PostGreSQL : {e}")
21
+ exit()
22
+
23
+ self.cur = self.conn.cursor()
24
+
25
+ def getUserCredentials(self, email):
26
+ self.cur.execute('SELECT id,password,verified FROM account WHERE email = %s', (email,))
27
+ r = self.cur.fetchone()
28
+ if r:
29
+ r["password"] = bytes(r["password"])
30
+ return r
31
+ else:
32
+ return
33
+
34
+ def getUser(self, id, target='*'):
35
+ self.cur.execute(sql.SQL('SELECT email FROM account WHERE id = %s'), (id,))
36
+ r = self.cur.fetchone()
37
+ if r:
38
+ return r
39
+ else:
40
+ return
41
+
42
+ def createAccount(self, email, password, parrain):
43
+ if parrain:
44
+ self.cur.execute(
45
+ "insert into account (email,password,inscription,verified,parrain) values(%s,%s,CURRENT_DATE,FALSE,%s) "
46
+ "RETURNING id", (email, password, parrain))
47
+ else:
48
+ self.cur.execute(
49
+ "insert into account (email,password,inscription,verified) values(%s,%s,CURRENT_DATE,FALSE) "
50
+ "RETURNING id", (email, password))
51
+ r = self.cur.fetchone()
52
+ self.conn.commit()
53
+ return r['id']
54
+
55
+ def getSomething(self, table, id, selector='id'):
56
+ try:
57
+ self.cur.execute(
58
+ sql.SQL('SELECT * FROM {} WHERE {} = %s').format(sql.Identifier(table), sql.Identifier(selector)), (id,))
59
+ r = self.cur.fetchone()
60
+ if r:
61
+ return r
62
+ else:
63
+ return []
64
+ except Exception as e:
65
+ print(f"[VESTA] An error occurred with the db: {e}")
66
+ self.conn.rollback()
67
+
68
+ def getAll(self, table, id, selector='id'):
69
+ try:
70
+ self.cur.execute(
71
+ sql.SQL('SELECT * FROM {} WHERE {} = %s').format(sql.Identifier(table), sql.Identifier(selector)), (id,))
72
+ r = self.cur.fetchall()
73
+ if r:
74
+ return r
75
+ else:
76
+ return []
77
+ except Exception as e:
78
+ print(f"[VESTA] An error occurred with the db: {e}")
79
+ self.conn.rollback()
80
+
81
+ def getSomethingProxied(self, table, proxy, commonTable, id):
82
+ '''
83
+ Get something described by a ManyToMany relation
84
+ example :
85
+ a company --> you want to get all the company of a user
86
+ table is the element you want (company)
87
+ proxy is the table that make the relation (accessCompany)
88
+ commonTable is the one that link the two (account)
89
+ id is the id you want to query (user id)
90
+
91
+ this assumes that your proxy table has a key named like table and commonTable
92
+ eg :
93
+ accessCompany :
94
+ id
95
+ company
96
+ account
97
+ '''
98
+
99
+ table = sql.Identifier(table)
100
+ proxy = sql.Identifier(proxy)
101
+ commonTable = sql.Identifier(commonTable)
102
+ try:
103
+ self.cur.execute(
104
+ sql.SQL('SELECT {}.* FROM {},{} WHERE {}.{}=%s and {}.id={}.{}').format(table, table, proxy,
105
+ proxy, commonTable, table,
106
+ proxy, table), (id,))
107
+ r = self.cur.fetchall()
108
+ if r:
109
+ return r
110
+ else:
111
+ return []
112
+ except Exception as e:
113
+ print(f"[VESTA] An error occurred with the db: {e}")
114
+ self.conn.rollback()
115
+
116
+
117
+ def getFilters(self, table, filter, basis = None):
118
+ # this take a filter in the following format
119
+ # [identifier, operation, value, AND/OR... if relevant, ...]
120
+
121
+ if basis:
122
+ condition = [sql.SQL(basis)]
123
+ else:
124
+ condition = []
125
+ values = []
126
+ for i in range(0, len(filter), 4):
127
+ if filter[i+1].upper() == 'IN':
128
+ values += filter[i+2]
129
+ placeholders = ','.join(['%s'] * len(filter[i+2]))
130
+ placeholders = " (" + placeholders + ")"
131
+ elif filter[i+2] == None:
132
+ placeholders = " NULL"
133
+ elif filter[i+2] == "true":
134
+ placeholders = " true"
135
+ elif filter[i+2] == "false":
136
+ placeholders = " false"
137
+ else:
138
+ values.append(filter[i+2])
139
+ placeholders = " %s"
140
+ if i+4 <= len(filter):
141
+ condition.append(sql.Identifier(filter[i]))
142
+ condition.append(sql.SQL(filter[i+1]+placeholders+" "+filter[i+3]))
143
+ else:
144
+ condition.append(sql.Identifier(filter[i]))
145
+ condition.append(sql.SQL(filter[i+1]+placeholders))
146
+ try:
147
+ query = sql.SQL('SELECT * FROM {} WHERE {condition}').format(sql.Identifier(table), condition=sql.SQL(' ').join(condition))
148
+ self.cur.execute(query, values)
149
+ r = self.cur.fetchall()
150
+ if r:
151
+ return r
152
+ else:
153
+ return []
154
+ except Exception as e:
155
+ print(f"[VESTA] An error occurred with the db: {e}")
156
+ self.conn.rollback()
157
+
158
+ def insertDict(self, table, dict, getId=False):
159
+ cols = []
160
+ vals = []
161
+ for key in dict:
162
+ cols.append(sql.Identifier(key))
163
+ vals.append(dict[key])
164
+ cols_str = sql.SQL(',').join(cols)
165
+ vals_str = sql.SQL(','.join(['%s' for i in range(len(vals))]))
166
+ if getId:
167
+ sql_str = sql.SQL("INSERT INTO {} ({}) VALUES ({}) ON CONFLICT DO NOTHING RETURNING id ").format(sql.Identifier(table), cols_str,
168
+ vals_str)
169
+ else:
170
+ sql_str = sql.SQL("INSERT INTO {} ({}) VALUES ({}) ON CONFLICT DO NOTHING").format(sql.Identifier(table), cols_str, vals_str)
171
+ self.cur.execute(sql_str, vals)
172
+ self.conn.commit()
173
+ if getId:
174
+ r = self.cur.fetchone()
175
+ self.conn.commit()
176
+ return r['id']
177
+
178
+ def insertReplaceDict(self, table, dict):
179
+ cols = []
180
+ vals = []
181
+ for key in dict:
182
+ cols.append(sql.Identifier(key))
183
+ vals.append(dict[key])
184
+ cols_str = sql.SQL(',').join(cols)
185
+ vals_str = sql.SQL(','.join(['%s' for i in range(len(vals))]))
186
+ sql_str = sql.SQL("INSERT INTO {} ({}) VALUES ({}) ON CONFLICT (id) DO UPDATE SET ({}) = ({})"
187
+ ).format(sql.Identifier(table), cols_str, vals_str, cols_str,
188
+ vals_str) # warning only working for dicts containing an id
189
+ self.cur.execute(sql_str, vals * 2)
190
+ self.conn.commit()
191
+
192
+ def init(self):
193
+ self.cur.execute(open("./db/create_db.sql", "r").read())
194
+ self.conn.commit()
195
+
196
+ def resetTable(self, table):
197
+ sql_str = """delete from {} cascade;ALTER SEQUENCE {} RESTART WITH 1""".format(table, table + "_id_seq")
198
+ self.cur.execute(sql_str)
199
+ self.conn.commit()
200
+
201
+ def edit(self, table, id, element, value, selector='id'):
202
+ self.cur.execute(
203
+ sql.SQL("UPDATE {} SET {} = %s WHERE {} = %s ").format(sql.Identifier(table), sql.Identifier(element), sql.Identifier(selector)),
204
+ (value, id))
205
+ self.conn.commit()
206
+
207
+ def deleteSomething(self, table, id, selector='id'):
208
+ sql_str = sql.SQL('DELETE FROM {} WHERE {} = %s').format(sql.Identifier(table), sql.Identifier(selector))
209
+ self.cur.execute(sql_str, (id,))
210
+ self.conn.commit()
211
+
212
+ def initUniauth(self):
213
+ self.cur.execute(open(dirname(abspath(__file__)) + "/UNIAUTH.sql", "r").read())
214
+ self.conn.commit()
215
+
216
+ def postUniBridgeData(self, source, name, value=None, related=None):
217
+ data = {"source": source, "name": name}
218
+ if value:
219
+ data["value"] = value
220
+ if related:
221
+ data["related_table"] = related
222
+
223
+ self.insertDict("unibridge", data)
224
+
225
+ #notif name should NEVER be arbitrary
226
+ def postUniBridgeNotification(self, notif_name, element):
227
+ if self.getSomething("unibridge", notif_name, "related_table"):
228
+ self.insertDict(notif_name, element)
229
+ else:
230
+ raise Exception(f"Notification {notif_name} does not exist in unibridge table")
231
+
232
+ def createTable(self, name, schema):
233
+ """
234
+ Create a new table in the database with the given name and schema.
235
+ :param name: Name of the table to create.
236
+ :param schema: SQL schema definition for the table.
237
+ """
238
+ try:
239
+ self.cur.execute(sql.SQL("CREATE TABLE IF NOT EXISTS {} ({})").format(sql.Identifier(name), sql.SQL(schema)))
240
+ self.conn.commit()
241
+ except psycopg.Error as e:
242
+ print(f"Error creating table {name}: {e}")
243
+ self.conn.rollback()
244
+
245
+ def getUnibridgeNotifs(self, notif_name, selector='id', selector_value=None):
246
+ if self.getSomething("unibridge", notif_name, "related_table"):
247
+ if selector_value:
248
+ return self.getAll("unibridge", selector_value, selector)
249
+
250
+ self.cur.execute(sql.SQL("SELECT * FROM {}").format(sql.Identifier(notif_name)))
251
+ return self.cur.fetchall()
252
+ else:
253
+ raise Exception(f"Notification {notif_name} does not exist in unibridge table")
@@ -0,0 +1,16 @@
1
+ /.idea/
2
+ *.iml
3
+ /dist/
4
+ /static/public/*
5
+ /mailing/dkim.txt
6
+ /venv/
7
+ /.venv/
8
+ /static/*_filled
9
+ crontab
10
+ node_modules/
11
+ yarn.lock
12
+ .parcel-cache/
13
+ package.json
14
+ /static/attachments/*
15
+ /static/markdown/
16
+ /static/framework/
@@ -0,0 +1,12 @@
1
+ test:
2
+ stage: test
3
+ image: python:3.11-slim-bookworm
4
+ script:
5
+ - echo 'Running tests...'
6
+ - apt-get update && apt-get install -y git && apt-get install -y gcc
7
+ - apt install -y libpq-dev
8
+ - python -m venv venv
9
+ - source venv/bin/activate
10
+ - pip install -r requirements.txt
11
+ - pip install git+https://gitlab.com/Louciole/vesta.git/
12
+ - vesta test
@@ -0,0 +1,45 @@
1
+ # 🎉 Contributing to PROJECT_NAME
2
+
3
+ Thank you for considering contributing to PROJECT_NAME! Your help is invaluable in making this project a success.
4
+
5
+ - GitLab: [GitLab Link](https://gitlab.com/Louciole/disclone/)
6
+ - GitHub [Mirror]: [GitHub Link](https://github.com/Louciole/disclone)
7
+ - Issues: [GitLab Issues](https://gitlab.com/Louciole/disclone/-/issues)
8
+ - Documentation: [Vesta Docs](https://louciole.gitlab.io/vesta-docs/)
9
+ - Documentation Repo: [GitLab](https://gitlab.com/Louciole/vesta-docs)
10
+
11
+ ---
12
+
13
+ ## 📋 Table of Contents
14
+
15
+ 1. [Task List](#task-list)
16
+ 2. [Process](#process)
17
+ 3. [Style](#style)
18
+ 4. [Issues and Feedback](#issues-and-feedback)
19
+
20
+ ---
21
+
22
+ ## ✅ Task List
23
+
24
+ Check out our to-do list on Synapse: [Synapse Link](https://synapse.carbonlab.dev/project?uid=11&&access=read-only)
25
+
26
+ ---
27
+
28
+ ## 🚀 Process
29
+
30
+ 1. **Choose something to work on**: Whether it's a bug fix or a new feature, you can make an impact. Need help? Contact [lou@carbonlab.dev](mailto:lou@carbonlab.dev).
31
+ 2. **Fork the repository**: Create your own copy of the project.
32
+ 3. **Open a Merge Request**: Submit your changes on gitlab for review.
33
+
34
+ ---
35
+
36
+ ## 🎨 Style
37
+
38
+ - **Commit messages** should be funny and contain at least one emoji. 😄
39
+ - **Code** should be as simple and minimalistic as possible.
40
+
41
+ ---
42
+
43
+ ## 🐛 Issues and Feedback
44
+
45
+ Found a bug? Have an amazing feature idea? Share your thoughts by [opening an issue on GitLab](https://gitlab.com/Louciole/disclone/-/issues).
@@ -0,0 +1,3 @@
1
+ # Non-White-Heterosexual-Male License
2
+
3
+ If you are not a white heterosexual male you are permitted to copy, sell and use this work in any manner you choose without need to include any attribution you do not see fit. You are asked as a courtesy to retain this license in any derivatives but you are not required. If you are a white heterosexual male you are provided the same permissions (reuse, modification, resale) but are required to include this license in any documentation and any public facing derivative. You are also required to include attribution to the original author or to an author responsible for redistribution of a derivative.
@@ -0,0 +1,44 @@
1
+ # APP.
2
+
3
+ ❓️An APP based on vesta. <br>
4
+ 🌍 Production : https://app.carbonlab.dev <br>
5
+ 🟢 Status : https://status.carbonlab.dev <br>
6
+ 🏀 Roadmap : https://synapse.carbonlab.dev/project?uid=11&&access=read-only <br>
7
+ 🏡 Home : https://gitlab.com/Louciole/app
8
+
9
+
10
+ ## 🏎️ getting started
11
+
12
+ ### install :
13
+
14
+ 0. clone the repo
15
+
16
+ git clone https://gitlab.com/Louciole/app.git
17
+ cd app
18
+
19
+ 1. edit `server.ini` with your parameters
20
+
21
+
22
+ 2. if you plan top use mailing add the DKIM private key in `mailing/dkim.txt`
23
+
24
+ nano mailing/dkim.txt
25
+
26
+
27
+ 3. Install the dependencies
28
+
29
+ bash install.sh
30
+
31
+
32
+ ## 🖥️ Work
33
+ If you plan to commit something don't forget to IGNORE the *.ini file
34
+ run
35
+
36
+ git update-index --assume-unchanged server.ini
37
+
38
+ ## 🧶 Troubleshooting
39
+
40
+ if postgres does not accept password authentication, you can change the `pg_hba.conf` file
41
+
42
+ `sudo nano /etc/postgresql/16/main/pg_hba.conf`
43
+
44
+ replace peer by ident
@@ -0,0 +1,13 @@
1
+ from vesta import Server
2
+
3
+ from datetime import datetime
4
+ from os.path import abspath, dirname, join
5
+ PATH = abspath(join(dirname(__file__),".."))
6
+
7
+
8
+ class Cron(Server):
9
+ def exec(self):
10
+ pass
11
+
12
+ task = Cron(path=PATH, configFile="/server.ini", noStart=True)
13
+ task.exec()
File without changes
@@ -0,0 +1,17 @@
1
+ echo --------------------------INSTALLING PYTHON DEPENDENCIES------------------------
2
+ sudo apt install -y postgresql postgresql-contrib
3
+ sudo apt install -y build-essential
4
+ sudo add-apt-repository ppa:deadsnakes/ppa
5
+ sudo apt install python3.11
6
+ sudo apt install -y python3.11-dev
7
+ sudo apt install -y libpq-dev
8
+ sudo apt install -y python3.11-venv
9
+ python3.11 -m venv ./venv/
10
+ source venv/bin/activate
11
+ #installing psycopg here to get the C implem in place of th pure python one
12
+ pip install "psycopg[c]"
13
+ pip install git+https://gitlab.com/Louciole/vesta.git/
14
+ pip install -r requirements.txt
15
+ sudo apt install nginx -y
16
+ sudo apt install systemd -y
17
+ python3 ./install.py all
@@ -0,0 +1 @@
1
+ <div style="border-top:solid 8px #5865F2;padding-top:20px;text-align:center;min-width:640px;width:100%;height:100%;font-family:Helvetica;padding:0" bgcolor="#fafafa"><table style="text-align:center;min-width:640px;width:100%;margin:0;padding:0" cellspacing="0" cellpadding="0" border="0" bgcolor="#fafafa"><tbody><tr><td style="font-family:Helvetica;font-size:4px;line-height:4px" bgcolor="#6b4fbb"></td></tr><tr><td style="font-family:Helvetica;line-height:1.6;color:#5c5c5c;padding:25px 0"><img alt="Carbonlab" src="https://disclone.carbonlab.dev/images/logo.png" data-bit="iit" width="55" height="55"></td></tr><tr><td style="font-family:Helvetica"><table style="width:640px;border-collapse:separate;border-spacing:0;margin:0 auto" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="font-family:Helvetica;overflow:hidden;padding:18px 25px;border:1px solid #ededed" bgcolor="#fff" align="left"><table style="width:100%;border-collapse:separate;border-spacing:0" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td><div style="color:#1f1f1f;line-height:1.25em;max-width:400px;margin:0 auto" align="center"><h3>Réinitialiser votre mot de passe</h3><p style="font-size:.9em">Pour réinitialiser votre mot de passe, copiez le code ci-dessous sur le site</p><div style="width:207px;height:53px;background-color:#f0f0f0;line-height:53px;font-weight:700;font-size:1.5em;color:#303030;margin:26px 0">{}</div><p style="font-size:.75em">Ce code expire dans 60 minutes.</p></div></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr><td style="font-family:Helvetica;line-height:1.6;color:#5c5c5c;padding:25px 0"><div style="width:fit-content;display:flex;margin:0 auto"><img alt="Carbonlab" src="https://disclone.carbonlab.dev/images/logo.png" style="display:block;width:30px;height:30px;margin:1em 2px 1em 1em" data-bit="iit"><h2 style="line-height:30px;font-size:20px;color:#000;margin-left:0">Carbonlab</h2></div><div>Vous recevez ce mail à cause de votre compte sur<a rel="noopener noreferrer" href="" style="color:#3777b0;text-decoration:none" target="_blank" data-saferedirecturl="">carbonlab.dev</a>.<a href="" rel="noopener noreferrer" style="color:#3777b0;text-decoration:none" target="_blank" data-saferedirecturl="">Paramètres de notification</a></div></td></tr><tr><td style="font-family:Helvetica;line-height:1.6;color:#5c5c5c;padding:25px 0"></td></tr></tbody></table></div>
@@ -0,0 +1 @@
1
+ <div style="border-top:solid 8px #5865F2;padding-top:20px;text-align:center;min-width:640px;width:100%;height:100%;font-family:Helvetica;padding:0" bgcolor="#fafafa"><table style="text-align:center;min-width:640px;width:100%;margin:0;padding:0" cellspacing="0" cellpadding="0" border="0" bgcolor="#fafafa"><tbody><tr><td style="font-family:Helvetica;font-size:4px;line-height:4px" bgcolor="#6b4fbb"></td></tr><tr><td style="font-family:Helvetica;line-height:1.6;color:#5c5c5c;padding:25px 0"><img alt="Carbonlab" src="https://disclone.carbonlab.dev/images/logo.png" data-bit="iit" width="55" height="55"></td></tr><tr><td style="font-family:Helvetica"><table style="width:640px;border-collapse:separate;border-spacing:0;margin:0 auto" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td style="font-family:Helvetica;overflow:hidden;padding:18px 25px;border:1px solid #ededed" bgcolor="#fff" align="left"><table style="width:100%;border-collapse:separate;border-spacing:0" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td><div style="color:#1f1f1f;line-height:1.25em;max-width:400px;margin:0 auto" align="center"><h3>Bienvenue sur Disclone !</h3><p style="font-size:.9em">Avant de terminer la création de votre compte, nous devons vérifier votre email, si vous venez de créer votre compte, copiez le code ci-dessous sur le site</p><div style="width:207px;height:53px;background-color:#f0f0f0;line-height:53px;font-weight:700;font-size:1.5em;color:#303030;margin:26px 0">{}</div><p style="font-size:.75em">Ce code expire dans 60 minutes.</p></div></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr><td style="font-family:Helvetica;line-height:1.6;color:#5c5c5c;padding:25px 0"><div style="width:fit-content;display:flex;margin:0 auto"><img alt="Carbonlab" src="https://disclone.carbonlab.dev/images/logo.png" style="display:block;width:30px;height:30px;margin:1em 2px 1em 1em" data-bit="iit"><h2 style="line-height:30px;font-size:20px;color:#000;margin-left:0">Carbonlab</h2></div><div>Vous recevez ce mail à cause de votre compte sur<a rel="noopener noreferrer" href="" style="color:#3777b0;text-decoration:none" target="_blank" data-saferedirecturl="">carbonlab.dev</a>.<a href="" rel="noopener noreferrer" style="color:#3777b0;text-decoration:none" target="_blank" data-saferedirecturl="">Paramètres de notification</a></div></td></tr><tr><td style="font-family:Helvetica;line-height:1.6;color:#5c5c5c;padding:25px 0"></td></tr></tbody></table></div>
@@ -0,0 +1,15 @@
1
+ server {
2
+ listen 808;
3
+
4
+ location /static/ {
5
+ autoindex off;
6
+ root [PATH];
7
+ }
8
+
9
+ location / {
10
+ client_max_body_size 50M;
11
+ proxy_set_header Host $host;
12
+ proxy_pass "http://127.0.0.1:[SERV-PORT]";
13
+ proxy_redirect off;
14
+ }
15
+ }
@@ -0,0 +1,29 @@
1
+ server{
2
+ listen 80;
3
+ server_name disclone.carbonlab.dev;
4
+
5
+ location /static/ {
6
+ autoindex off;
7
+ root /var/www/html/disclone;
8
+ }
9
+
10
+ location / {
11
+ client_max_body_size 50M;
12
+ proxy_set_header Host $host;
13
+ proxy_pass "http://127.0.0.1:[SERV-PORT]";
14
+ proxy_redirect off;
15
+ }
16
+ }
17
+
18
+ server{
19
+ listen 80;
20
+ server_name ws.carbonlab.dev;
21
+ location / {
22
+ proxy_set_header Host $host;
23
+ proxy_pass "http://127.0.0.1:[WS-PORT]";
24
+ proxy_http_version 1.1;
25
+ proxy_set_header Upgrade $http_upgrade;
26
+ proxy_set_header Connection "Upgrade";
27
+ proxy_redirect off;
28
+ }
29
+ }
@@ -0,0 +1,29 @@
1
+ server{
2
+ listen 80;
3
+ server_name disclone.carbonlab.dev;
4
+
5
+ location /static/ {
6
+ autoindex off;
7
+ root /var/www/html/disclone;
8
+ }
9
+
10
+ location / {
11
+ client_max_body_size 50M;
12
+ proxy_set_header Host $host;
13
+ proxy_pass "http://127.0.0.1:[SERV-PORT]";
14
+ proxy_redirect off;
15
+ }
16
+ }
17
+
18
+ server{
19
+ listen 80;
20
+ server_name ws.carbonlab.dev;
21
+ location / {
22
+ proxy_set_header Host $host;
23
+ proxy_pass "http://127.0.0.1:[WS-PORT]";
24
+ proxy_http_version 1.1;
25
+ proxy_set_header Upgrade $http_upgrade;
26
+ proxy_set_header Connection "Upgrade";
27
+ proxy_redirect off;
28
+ }
29
+ }
@@ -0,0 +1,11 @@
1
+ [Unit]
2
+ Description=[NAME] : a shitty Discord clone by Lou !
3
+ After=multi-user.target
4
+ [Service]
5
+ Type=simple
6
+ Restart=always
7
+ ExecStart=[PATH]/venv/bin/python [PATH]/server.py
8
+ KillSignal=SIGINT
9
+ ExecStopPost=killPort [SERV-PORT]
10
+ [Install]
11
+ WantedBy=multi-user.target
File without changes
@@ -0,0 +1,6 @@
1
+ [server]
2
+ IP = 0.0.0.0
3
+ PORT = 9876
4
+ DEBUG = true
5
+ DEFAULT_ENDPOINT = /
6
+ SERVICE_NAME = APP
@@ -0,0 +1,15 @@
1
+ from vesta.http import baseServer
2
+
3
+ from os.path import abspath, dirname
4
+
5
+ PATH = dirname(abspath(__file__))
6
+ server = baseServer.BaseServer
7
+
8
+ class App(server):
9
+ features = {}
10
+
11
+ @server.expose
12
+ def index(self, *args, **kwargs):
13
+ return self.file(PATH + "/static/index.html")
14
+
15
+ App(path=PATH, configFile="/server.ini")
@@ -0,0 +1,13 @@
1
+ [server]
2
+ IP = 0.0.0.0
3
+ PORT = 9876
4
+ DEBUG = true
5
+ DEFAULT_ENDPOINT = /
6
+ SERVICE_NAME = APP
7
+
8
+ [DB]
9
+ DB_USER = disclone_test
10
+ DB_PASSWORD = disclone1
11
+ DB_NAME = navigator
12
+ DB_HOST = localhost
13
+ DB_PORT = 5432
@@ -0,0 +1,15 @@
1
+ from vesta.http import baseServer
2
+
3
+ from os.path import abspath, dirname
4
+
5
+ PATH = dirname(abspath(__file__))
6
+ server = baseServer.BaseServer
7
+
8
+ class App(server):
9
+ features = {"orm": True}
10
+
11
+ @server.expose
12
+ def index(self, *args, **kwargs):
13
+ return self.file(PATH + "/static/index.html")
14
+
15
+ App(path=PATH, configFile="/server.ini")
@@ -0,0 +1,27 @@
1
+ [server]
2
+ IP = 0.0.0.0
3
+ PORT = 9876
4
+ DEBUG = true
5
+ DEFAULT_ENDPOINT = /foo
6
+ SERVICE_NAME = APP
7
+
8
+ [security]
9
+ SECRET_KEY = 12345
10
+
11
+ [DB]
12
+ DB_USER = disclone_test
13
+ DB_PASSWORD = disclone1
14
+ DB_NAME = disclone
15
+ DB_HOST = localhost
16
+ DB_PORT = 5432
17
+
18
+ [UNIAUTH]
19
+ DB_NAME = uniauth
20
+ DB_HOST = localhost
21
+ DB_PORT = 5432
22
+
23
+ [MAILING]
24
+ NOREPLY_PASSWORD = 12345
25
+ MAILING_HOST = ssl0.ovh.net
26
+ MAILING_PORT = 587
27
+
@@ -0,0 +1,17 @@
1
+ from vesta import Server, HTTPError, HTTPRedirect
2
+
3
+ from os.path import abspath, dirname
4
+
5
+ PATH = dirname(abspath(__file__))
6
+
7
+ class App(Server):
8
+ features = {"errors": {404: "/static/404.html"}}
9
+
10
+ @Server.expose
11
+ def index(self):
12
+ return self.file(PATH + "/static/home/home.html")
13
+
14
+ def onLogin(self, uid):
15
+ pass
16
+
17
+ App(path=PATH, configFile="/server.ini")
@@ -0,0 +1,31 @@
1
+ [server]
2
+ IP = 0.0.0.0
3
+ PORT = 9876
4
+ DEBUG = true
5
+ DEFAULT_ENDPOINT = /foo
6
+ SERVICE_NAME = APP
7
+
8
+ [security]
9
+ SECRET_KEY = 12345
10
+
11
+ [DB]
12
+ DB_USER = disclone_test
13
+ DB_PASSWORD = disclone1
14
+ DB_NAME = disclone
15
+ DB_HOST = localhost
16
+ DB_PORT = 5432
17
+
18
+ [UNIAUTH]
19
+ DB_NAME = uniauth
20
+ DB_HOST = localhost
21
+ DB_PORT = 5432
22
+
23
+ [MAILING]
24
+ NOREPLY_PASSWORD = 12345
25
+ MAILING_HOST = ssl0.ovh.net
26
+ MAILING_PORT = 587
27
+
28
+ [NOTIFICATION]
29
+ PORT = 9888
30
+ DEBUG_URL = ws://localhost:9888
31
+ URL = wss://ws.carbonlab.dev