ptn 0.1.4__py3-none-any.whl → 0.3.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 (45) hide show
  1. porterminal/__init__.py +82 -14
  2. porterminal/_version.py +34 -0
  3. porterminal/app.py +32 -4
  4. porterminal/application/ports/__init__.py +2 -0
  5. porterminal/application/ports/connection_registry_port.py +46 -0
  6. porterminal/application/services/management_service.py +2 -3
  7. porterminal/application/services/terminal_service.py +116 -28
  8. porterminal/asgi.py +8 -3
  9. porterminal/cli/args.py +103 -0
  10. porterminal/cli/display.py +1 -1
  11. porterminal/composition.py +19 -5
  12. porterminal/config.py +62 -70
  13. porterminal/container.py +3 -10
  14. porterminal/domain/__init__.py +0 -2
  15. porterminal/domain/entities/output_buffer.py +0 -4
  16. porterminal/domain/ports/__init__.py +1 -2
  17. porterminal/domain/ports/pty_port.py +0 -29
  18. porterminal/domain/ports/tab_repository.py +0 -5
  19. porterminal/infrastructure/auth.py +131 -0
  20. porterminal/infrastructure/cloudflared.py +5 -1
  21. porterminal/infrastructure/config/__init__.py +0 -2
  22. porterminal/infrastructure/config/shell_detector.py +342 -1
  23. porterminal/infrastructure/repositories/in_memory_tab.py +0 -4
  24. porterminal/infrastructure/server.py +37 -5
  25. porterminal/static/assets/app-BkHv5qu0.css +32 -0
  26. porterminal/static/assets/app-CaIGfw7i.js +72 -0
  27. porterminal/static/assets/app-D9ELFbEO.js +72 -0
  28. porterminal/static/assets/app-DF3nl_io.js +72 -0
  29. porterminal/static/assets/app-DQePboVd.css +32 -0
  30. porterminal/static/assets/app-DoBiVkTD.js +72 -0
  31. porterminal/static/assets/app-azbHOsRw.css +32 -0
  32. porterminal/static/assets/app-nMNFwMa6.css +32 -0
  33. porterminal/static/index.html +28 -25
  34. porterminal/updater.py +115 -168
  35. ptn-0.3.2.dist-info/METADATA +171 -0
  36. {ptn-0.1.4.dist-info → ptn-0.3.2.dist-info}/RECORD +39 -33
  37. porterminal/infrastructure/config/yaml_loader.py +0 -34
  38. porterminal/static/assets/app-BQiuUo6Q.css +0 -32
  39. porterminal/static/assets/app-YNN_jEhv.js +0 -71
  40. porterminal/static/manifest.json +0 -31
  41. porterminal/static/sw.js +0 -66
  42. ptn-0.1.4.dist-info/METADATA +0 -191
  43. {ptn-0.1.4.dist-info → ptn-0.3.2.dist-info}/WHEEL +0 -0
  44. {ptn-0.1.4.dist-info → ptn-0.3.2.dist-info}/entry_points.txt +0 -0
  45. {ptn-0.1.4.dist-info → ptn-0.3.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,31 +0,0 @@
1
- {
2
- "name": "Porterminal",
3
- "short_name": "Terminal",
4
- "description": "Mobile terminal via Cloudflare Tunnel",
5
- "start_url": "/",
6
- "display": "standalone",
7
- "orientation": "any",
8
- "background_color": "#1e1e1e",
9
- "theme_color": "#252526",
10
- "icons": [
11
- {
12
- "src": "/static/icon.svg",
13
- "sizes": "any",
14
- "type": "image/svg+xml",
15
- "purpose": "any maskable"
16
- }
17
- ],
18
- "categories": ["developer", "utilities"],
19
- "shortcuts": [
20
- {
21
- "name": "PowerShell",
22
- "url": "/?shell=powershell",
23
- "description": "Open PowerShell terminal"
24
- },
25
- {
26
- "name": "CMD",
27
- "url": "/?shell=cmd",
28
- "description": "Open Command Prompt"
29
- }
30
- ]
31
- }
porterminal/static/sw.js DELETED
@@ -1,66 +0,0 @@
1
- /**
2
- * Service Worker for Porterminal PWA
3
- * Caches UI assets for offline access
4
- */
5
-
6
- const CACHE_NAME = 'porterminal-v1';
7
- const STATIC_ASSETS = [
8
- '/',
9
- '/static/index.html',
10
- '/static/manifest.json',
11
- '/static/icon.svg',
12
- ];
13
-
14
- // Install - cache static assets
15
- self.addEventListener('install', (event) => {
16
- event.waitUntil(
17
- caches.open(CACHE_NAME).then((cache) => {
18
- return cache.addAll(STATIC_ASSETS);
19
- })
20
- );
21
- self.skipWaiting();
22
- });
23
-
24
- // Activate - clean old caches
25
- self.addEventListener('activate', (event) => {
26
- event.waitUntil(
27
- caches.keys().then((keys) => {
28
- return Promise.all(
29
- keys.filter((key) => key !== CACHE_NAME)
30
- .map((key) => caches.delete(key))
31
- );
32
- })
33
- );
34
- self.clients.claim();
35
- });
36
-
37
- // Fetch - serve from cache, fallback to network
38
- self.addEventListener('fetch', (event) => {
39
- const url = new URL(event.request.url);
40
-
41
- // Don't cache WebSocket or API requests
42
- if (url.pathname.startsWith('/ws') || url.pathname.startsWith('/api')) {
43
- return;
44
- }
45
-
46
- event.respondWith(
47
- caches.match(event.request).then((cached) => {
48
- // Return cached version or fetch from network
49
- return cached || fetch(event.request).then((response) => {
50
- // Cache successful responses
51
- if (response.ok && event.request.method === 'GET') {
52
- const clone = response.clone();
53
- caches.open(CACHE_NAME).then((cache) => {
54
- cache.put(event.request, clone);
55
- });
56
- }
57
- return response;
58
- });
59
- }).catch(() => {
60
- // Offline fallback
61
- if (event.request.destination === 'document') {
62
- return caches.match('/');
63
- }
64
- })
65
- );
66
- });
@@ -1,191 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: ptn
3
- Version: 0.1.4
4
- Summary: Web-based terminal accessible from phone via Cloudflare Tunnel
5
- Project-URL: Homepage, https://github.com/lyehe/porterminal
6
- Project-URL: Repository, https://github.com/lyehe/porterminal
7
- Project-URL: Documentation, https://github.com/lyehe/porterminal/tree/main/docs
8
- Project-URL: Issues, https://github.com/lyehe/porterminal/issues
9
- Author: Porterminal Contributors
10
- Maintainer: Porterminal Contributors
11
- License: AGPL-3.0-or-later
12
- License-File: LICENSE
13
- Keywords: cloudflare,mobile,pty,terminal,tunnel,web,websocket,xterm
14
- Classifier: Development Status :: 4 - Beta
15
- Classifier: Environment :: Web Environment
16
- Classifier: Framework :: FastAPI
17
- Classifier: Intended Audience :: Developers
18
- Classifier: Intended Audience :: System Administrators
19
- Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
20
- Classifier: Operating System :: MacOS
21
- Classifier: Operating System :: Microsoft :: Windows
22
- Classifier: Operating System :: POSIX :: Linux
23
- Classifier: Programming Language :: Python :: 3.12
24
- Classifier: Programming Language :: Python :: 3.13
25
- Classifier: Topic :: Internet :: WWW/HTTP
26
- Classifier: Topic :: System :: Shells
27
- Classifier: Topic :: Terminals :: Terminal Emulators/X Terminals
28
- Requires-Python: >=3.12
29
- Requires-Dist: fastapi>=0.104.0
30
- Requires-Dist: pydantic>=2.0
31
- Requires-Dist: pywinpty>=2.0.0; sys_platform == 'win32'
32
- Requires-Dist: pyyaml>=6.0
33
- Requires-Dist: qrcode>=7.4
34
- Requires-Dist: rich>=13.0
35
- Requires-Dist: uvicorn[standard]>=0.24.0
36
- Provides-Extra: dev
37
- Requires-Dist: watchfiles>=0.21.0; extra == 'dev'
38
- Description-Content-Type: text/markdown
39
-
40
- <p align="center">
41
- <a href="https://github.com/lyehe/porterminal">
42
- <img src="assets/banner.jpg" alt="Porterminal - Vibe Code From Anywhere" width="600">
43
- </a>
44
- </p>
45
-
46
- <p align="center">
47
- <a href="https://pypi.org/project/ptn/">
48
- <img src="https://img.shields.io/pypi/v/ptn?style=flat-square&logo=pypi&logoColor=white&label=PyPI" alt="PyPI">
49
- </a>
50
- <a href="https://pypi.org/project/ptn/">
51
- <img src="https://img.shields.io/pypi/pyversions/ptn?style=flat-square&logo=python&logoColor=white" alt="Python">
52
- </a>
53
- <a href="https://pypi.org/project/ptn/">
54
- <img src="https://img.shields.io/pypi/dm/ptn?style=flat-square&label=Downloads" alt="Downloads">
55
- </a>
56
- <a href="https://github.com/lyehe/porterminal/blob/main/LICENSE">
57
- <img src="https://img.shields.io/github/license/lyehe/porterminal?style=flat-square" alt="License">
58
- </a>
59
- </p>
60
-
61
- Simple, quick and dirty web terminal accessible from your phone via Cloudflare Quick Tunnel. Vibe-coding-friendly interface with virtual keys, multi-tab sessions, etc.
62
-
63
- ## Features
64
-
65
- - **Touch-optimized** - Virtual keyboard, touch gestures
66
- - **Multi-tab sessions** - Run multiple terminals simultaneously with persistent sessions
67
- - **Instant access** - Cloudflare Quick Tunnel with QR code, no port forwarding needed
68
- - **Cross-platform** - Windows (PowerShell, CMD, WSL), Linux/macOS (Bash, Zsh, Fish)
69
-
70
- ## Quick Start
71
-
72
- ```bash
73
- # Run without installing
74
- uvx ptn
75
-
76
-
77
- # Or install
78
- uv tool install ptn
79
- ptn
80
- ```
81
-
82
- Scan the QR code with your phone to connect.
83
-
84
-
85
- ## Usage
86
-
87
- ```
88
- ptn [path] [options]
89
- ```
90
-
91
- **Examples:**
92
-
93
- ```bash
94
- # Start in current directory with tunnel
95
- ptn
96
-
97
- # Start in a specific project folder
98
- ptn ~/projects/myapp
99
-
100
- # Local network only (no Cloudflare tunnel)
101
- ptn --no-tunnel
102
-
103
- # Run in background (returns immediately)
104
- ptn -b
105
-
106
- # Show detailed startup logs
107
- ptn -v
108
-
109
- # Update to latest version
110
- ptn -U
111
-
112
- # Check for updates without installing
113
- ptn --check-update
114
- ```
115
-
116
- **Options:**
117
-
118
- | Option | Description |
119
- |--------|-------------|
120
- | `path` | Starting directory for the shell (default: current) |
121
- | `--no-tunnel` | Local network only, no Cloudflare tunnel |
122
- | `-b, --background` | Run in background and return immediately |
123
- | `-v, --verbose` | Show detailed startup logs |
124
- | `-U, --update` | Update to the latest version |
125
- | `--check-update` | Check if a newer version is available |
126
- | `-V, --version` | Show version |
127
- | `-h, --help` | Show help message |
128
-
129
- ## Configuration
130
-
131
- Create `config.yaml` in your working directory to customize:
132
-
133
- ```yaml
134
- # Server settings
135
- server:
136
- host: "127.0.0.1"
137
- port: 8000
138
-
139
- # Terminal settings
140
- terminal:
141
- cols: 120 # Default columns (40-500)
142
- rows: 30 # Default rows (10-200)
143
- default_shell: powershell # Default shell ID
144
-
145
- # Custom shells (optional - auto-detected if not specified)
146
- shells:
147
- - id: powershell
148
- name: PowerShell
149
- command: powershell.exe
150
- args: ["-NoLogo"]
151
- - id: wsl
152
- name: WSL
153
- command: wsl.exe
154
- args: []
155
-
156
- # Custom quick-action buttons
157
- buttons:
158
- - label: "git"
159
- send: "git status\r"
160
- - label: "ls"
161
- send: "ls -la\r"
162
- - label: "clear"
163
- send: "clear\r"
164
- - label: "exit"
165
- send: "exit\r"
166
- ```
167
-
168
- **Minimal config example:**
169
-
170
- ```yaml
171
- terminal:
172
- default_shell: bash
173
- ```
174
-
175
- ## Security
176
-
177
- > **Warning:** The URL is the only authentication. Anyone with the link can access your terminal.
178
-
179
- - Environment variables sanitized (API keys, tokens, secrets blocked)
180
- - Rate limiting on input
181
- - Sessions isolated per user via Cloudflare Access
182
-
183
- ## Requirements
184
-
185
- - Python 3.12+
186
- - [uv](https://docs.astral.sh/uv/) is prefered
187
- - [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/) (auto-installed if missing)
188
-
189
- ## License
190
-
191
- [AGPL-3.0](LICENSE)
File without changes