small-software 0.6.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.
- small_cli/__init__.py +1 -0
- small_cli/__main__.py +3 -0
- small_cli/access.py +114 -0
- small_cli/archive.py +127 -0
- small_cli/cli.py +76 -0
- small_cli/commands/__init__.py +8 -0
- small_cli/commands/access.py +167 -0
- small_cli/commands/dashboard.py +49 -0
- small_cli/commands/db.py +154 -0
- small_cli/commands/deploy.py +248 -0
- small_cli/commands/destroy.py +63 -0
- small_cli/commands/domain.py +123 -0
- small_cli/commands/env.py +151 -0
- small_cli/commands/init.py +86 -0
- small_cli/commands/link.py +53 -0
- small_cli/commands/logs.py +59 -0
- small_cli/commands/mail.py +203 -0
- small_cli/commands/notify.py +147 -0
- small_cli/commands/sleep.py +61 -0
- small_cli/common.py +92 -0
- small_cli/config.py +82 -0
- small_cli/dashboard.py +648 -0
- small_cli/i18n.py +55 -0
- small_cli/railway.py +369 -0
- small_cli/scaffold.py +81 -0
- small_cli/templates/fastapi/magic_link.py +675 -0
- small_cli/templates/fastapi/main.py +67 -0
- small_cli/templates/fastapi/requirements.txt +2 -0
- small_cli/templates/node-http/magic-link.js +509 -0
- small_cli/templates/node-http/package.json +11 -0
- small_cli/templates/node-http/server.js +33 -0
- small_cli/templates/python-http/app.py +47 -0
- small_cli/templates/python-http/magic_link.py +675 -0
- small_cli/templates/streamlit/app.py +181 -0
- small_cli/templates/streamlit/requirements.txt +1 -0
- small_software-0.6.0.dist-info/METADATA +559 -0
- small_software-0.6.0.dist-info/RECORD +41 -0
- small_software-0.6.0.dist-info/WHEEL +5 -0
- small_software-0.6.0.dist-info/entry_points.txt +2 -0
- small_software-0.6.0.dist-info/licenses/LICENSE +21 -0
- small_software-0.6.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""A small app created by `small init`. Deploy it with `small deploy`.
|
|
2
|
+
|
|
3
|
+
Who gets in is decided by magic_link.py: people you invite by work email (`small access add ivan@company.com`)
|
|
4
|
+
or with a personal invite link (`small access add bob`). Write your own code in app() — it is a plain WSGI app.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import re
|
|
9
|
+
from socketserver import ThreadingMixIn
|
|
10
|
+
from wsgiref.simple_server import WSGIRequestHandler, WSGIServer, make_server
|
|
11
|
+
|
|
12
|
+
from magic_link import MagicLink
|
|
13
|
+
|
|
14
|
+
PAGE = """<!doctype html>
|
|
15
|
+
<html lang="en">
|
|
16
|
+
<head>
|
|
17
|
+
<meta charset="utf-8">
|
|
18
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
19
|
+
<title>small app</title>
|
|
20
|
+
</head>
|
|
21
|
+
<body style="font-family: system-ui, sans-serif; text-align: center; padding: 48px 16px;">
|
|
22
|
+
<h1>🚀 It works!</h1>
|
|
23
|
+
<p>This app was created by <code>small init</code>. Edit <code>app.py</code> and run <code>small deploy</code>.</p>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
26
|
+
""".encode("utf-8")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def app(environ, start_response):
|
|
30
|
+
start_response("200 OK", [("Content-Type", "text/html; charset=utf-8"), ("Content-Length", str(len(PAGE)))])
|
|
31
|
+
return [PAGE]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ThreadingServer(ThreadingMixIn, WSGIServer):
|
|
35
|
+
daemon_threads = True
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Handler(WSGIRequestHandler):
|
|
39
|
+
def log_message(self, format, *args):
|
|
40
|
+
# Keep ?token=... (invite link) and ?t=... (sign-in link from an email) out of the logs.
|
|
41
|
+
super().log_message(format, *(re.sub(r"\b(token|t)=[^&\s]*", r"\1=***", str(a)) for a in args))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
host, port = os.environ.get("HOST", "0.0.0.0"), int(os.environ.get("PORT", 8080))
|
|
46
|
+
print("Listening on %s:%d" % (host, port), flush=True)
|
|
47
|
+
make_server(host, port, MagicLink(app), server_class=ThreadingServer, handler_class=Handler).serve_forever()
|