ptn 0.1.4__py3-none-any.whl → 0.2.5__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.
- porterminal/__init__.py +19 -3
- porterminal/_version.py +34 -0
- porterminal/app.py +8 -4
- porterminal/application/services/terminal_service.py +116 -28
- porterminal/asgi.py +8 -3
- porterminal/cli/args.py +50 -0
- porterminal/composition.py +13 -5
- porterminal/config.py +54 -70
- porterminal/container.py +0 -11
- porterminal/domain/__init__.py +0 -2
- porterminal/domain/entities/output_buffer.py +0 -4
- porterminal/domain/ports/__init__.py +1 -2
- porterminal/domain/ports/pty_port.py +0 -29
- porterminal/domain/ports/tab_repository.py +0 -5
- porterminal/infrastructure/config/__init__.py +0 -2
- porterminal/infrastructure/config/shell_detector.py +1 -0
- porterminal/infrastructure/repositories/in_memory_tab.py +0 -4
- porterminal/infrastructure/server.py +10 -3
- porterminal/static/assets/app-By4EXMHC.js +72 -0
- porterminal/static/assets/app-DQePboVd.css +32 -0
- porterminal/static/index.html +16 -25
- porterminal/updater.py +115 -168
- ptn-0.2.5.dist-info/METADATA +148 -0
- {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/RECORD +27 -29
- porterminal/infrastructure/config/yaml_loader.py +0 -34
- porterminal/static/assets/app-BQiuUo6Q.css +0 -32
- porterminal/static/assets/app-YNN_jEhv.js +0 -71
- porterminal/static/manifest.json +0 -31
- porterminal/static/sw.js +0 -66
- ptn-0.1.4.dist-info/METADATA +0 -191
- {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/WHEEL +0 -0
- {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/entry_points.txt +0 -0
- {ptn-0.1.4.dist-info → ptn-0.2.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2014 The xterm.js authors. All rights reserved.
|
|
3
|
+
* Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
|
|
4
|
+
* https://github.com/chjj/term.js
|
|
5
|
+
* @license MIT
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
|
15
|
+
* all copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
* THE SOFTWARE.
|
|
24
|
+
*
|
|
25
|
+
* Originally forked from (with the author's permission):
|
|
26
|
+
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
27
|
+
* http://bellard.org/jslinux/
|
|
28
|
+
* Copyright (c) 2011 Fabrice Bellard
|
|
29
|
+
* The original design remains. The terminal itself
|
|
30
|
+
* has been extended to include xterm CSI codes, among
|
|
31
|
+
* other features.
|
|
32
|
+
*/.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}:root{--row-height: 30px;--content-padding: 12px;--scrollbar-width: 8px;--transition-fast: .15s ease;--radius-sm: 4px;--radius-md: 6px;--radius-lg: 8px;--radius-xl: 12px;--bg-primary: #1e1e1e;--bg-elevated: #252525;--bg-surface: #2d2d2d;--bg-hover: #3a3a3a;--bg-gradient-top: #232323;--bg-gradient-bottom: #1a1a1a;--text-primary: #cccccc;--text-high: rgba(255, 255, 255, .9);--text-white: #fff;--text-secondary: rgba(255, 255, 255, .7);--text-muted: rgba(255, 255, 255, .5);--text-disabled: rgba(255, 255, 255, .4);--border-subtle: rgba(255, 255, 255, .05);--border-light: rgba(255, 255, 255, .1);--border-medium: rgba(255, 255, 255, .15);--border-active: rgba(255, 255, 255, .2);--color-success: rgba(100, 220, 100, .8);--color-success-text: rgba(130, 230, 150, 1);--color-success-bg: rgba(100, 200, 120, .15);--color-success-border: rgba(100, 200, 120, .3);--bg-success-gradient-top: #2a3a2a;--bg-success-gradient-bottom: #1f2f1f;--color-danger: rgba(255, 100, 100, .8);--color-danger-muted: rgba(255, 120, 120, .7);--color-danger-text: rgba(255, 150, 150, 1);--color-danger-bg: rgba(255, 80, 80, .15);--color-danger-border: rgba(255, 120, 120, .3);--bg-danger-gradient-top: #3a2a2a;--bg-danger-gradient-bottom: #2f1f1f;--color-accent: rgba(80, 160, 255, .8);--color-accent-text: rgba(150, 200, 255, 1);--color-accent-bg: rgba(80, 160, 255, .3);--color-accent-strong: rgba(80, 160, 255, .5);--color-locked: rgba(255, 160, 60, .8);--color-locked-bg: rgba(255, 160, 60, .5);--glow-locked: 0 0 8px rgba(255, 160, 60, .5);--color-tmux: rgba(0, 180, 0, .8);--color-tmux-text: rgba(100, 220, 100, 1);--color-tmux-bg: rgba(0, 180, 0, .15);--hover-overlay: rgba(255, 255, 255, .05);--active-overlay: rgba(255, 255, 255, .08);--scrollbar-thumb: rgba(255, 255, 255, .15);--scrollbar-hover: rgba(255, 255, 255, .25);--cursor-color: #aeafad;--selection-bg: rgba(38, 79, 120, .5);--shadow-elevated: 0 4px 16px rgba(0, 0, 0, .5);--glow-success: 0 0 6px rgba(100, 220, 100, .4);--glow-danger: 0 0 6px rgba(255, 100, 100, .4);--glow-accent: 0 0 8px rgba(80, 160, 255, .4);--overlay-bg: rgba(0, 0, 0, .9)}.tool-btn,.tab-btn{-webkit-touch-callout:none}html,body{margin:0;padding:0;height:100%;overflow:hidden;background:var(--bg-primary);color:var(--text-primary);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:13px;position:fixed;width:100%;touch-action:none;overscroll-behavior:none}#app{display:flex;flex-direction:column;height:100%;height:100dvh;height:100svh;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);overflow:hidden;overscroll-behavior:none}#tab-bar{display:flex;align-items:center;height:var(--row-height);min-height:var(--row-height);background:linear-gradient(to bottom,var(--bg-gradient-top),var(--bg-gradient-bottom));border-bottom:1px solid var(--border-subtle);overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-ms-overflow-style:none}#tab-bar::-webkit-scrollbar{display:none}.tab-btn{display:flex;align-items:center;gap:2px;height:var(--row-height);padding:0 8px;background:transparent;border:none;border-right:1px solid var(--border-subtle);color:var(--text-muted);font-size:12px;cursor:pointer;white-space:nowrap;flex-shrink:0;transition:all var(--transition-fast)}.tab-btn:active{background:var(--hover-overlay)}.tab-btn.active{background:var(--active-overlay);color:var(--text-high)}.tab-btn.tab-add{color:var(--text-disabled);font-size:18px;padding:0 10px;border-right:none}.tab-btn.tab-add:active{color:var(--text-high)}.tab-label{max-width:100px;overflow:hidden;text-overflow:ellipsis}.tab-close{display:flex;align-items:center;justify-content:center;width:16px;height:16px;margin-left:2px;border-radius:var(--radius-sm);font-size:14px;color:var(--text-disabled);transition:all var(--transition-fast);position:relative;overflow:hidden}.tab-close:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:var(--color-danger-bg);transform:scaleX(0);transform-origin:left;transition:transform .4s ease-out;z-index:-1}.tab-close.holding:before{transform:scaleX(1)}.tab-close.holding{color:var(--color-danger-text)}.tab-close.ready{background:var(--color-danger-bg);color:var(--color-danger-text);animation:pulseReady .3s ease}@keyframes pulseReady{0%,to{transform:scale(1)}50%{transform:scale(1.1)}}#shell-selector{margin-left:auto;display:flex;align-items:center;padding:0 var(--content-padding);height:var(--row-height);border-left:1px solid var(--border-subtle)}#shell-select{background:transparent;border:none;color:var(--text-secondary);font-size:11px;padding:4px 8px;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}#connection-dot{width:6px;height:6px;border-radius:50%;background:var(--color-danger);margin-left:var(--content-padding);margin-right:8px;box-shadow:var(--glow-danger);flex-shrink:0}#connection-dot.connected{background:var(--color-success);box-shadow:var(--glow-success)}#btn-info,#btn-textview,#btn-shutdown{background:transparent;border:none;color:var(--text-disabled);font-size:14px;padding:4px;margin-left:4px;cursor:pointer;transition:color var(--transition-fast)}#btn-textview{padding:4px 0;margin-left:2px;margin-right:4px;font-size:11px;font-weight:500}#btn-info:active,#btn-textview:active{color:var(--color-accent)}#btn-shutdown{color:var(--color-danger-muted)}#btn-shutdown:active{color:var(--color-danger-text)}#terminal-container{flex:1;overflow:hidden;background:var(--bg-primary);padding:0 0 0 var(--content-padding);-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;touch-action:none;overscroll-behavior:contain;contain:strict;isolation:isolate}#terminal{height:100%!important;contain:layout paint}.terminal-instance{height:100%;width:100%;contain:layout paint}.xterm-screen canvas,.xterm canvas{transform:translateZ(0);backface-visibility:hidden}#terminal .xterm-viewport{background:var(--bg-primary)!important;overflow-y:overlay!important;touch-action:none;overscroll-behavior:contain;contain:paint}#terminal .xterm-viewport::-webkit-scrollbar{width:var(--scrollbar-width)}#terminal .xterm-viewport::-webkit-scrollbar-track{background:transparent}#terminal .xterm-viewport::-webkit-scrollbar-thumb{background:var(--scrollbar-thumb);border-radius:var(--radius-sm)}#terminal .xterm-viewport::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-hover)}#terminal .xterm-screen{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}#terminal .xterm-helper-textarea,.xterm-helper-textarea{-webkit-text-security:none!important;font-size:16px!important;-webkit-user-select:text;user-select:text}.xterm-helper-textarea::-webkit-contacts-auto-fill-button,.xterm-helper-textarea::-webkit-credentials-auto-fill-button{visibility:hidden;display:none!important;pointer-events:none;position:absolute;right:0;width:0;height:0}#toolbar{display:flex;flex-direction:column;background:linear-gradient(to bottom,var(--bg-gradient-top),var(--bg-gradient-bottom));border-top:1px solid var(--border-subtle);padding-bottom:env(safe-area-inset-bottom,0px)}.toolbar-row{display:flex;align-items:center;justify-content:center;height:var(--row-height);min-height:var(--row-height);gap:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-ms-overflow-style:none}.toolbar-row:first-child{border-bottom:1px solid var(--border-subtle)}.toolbar-row::-webkit-scrollbar{display:none}.tool-btn{display:flex;align-items:center;justify-content:center;height:var(--row-height);padding:0 10px;background:transparent;border:none;border-right:1px solid var(--border-subtle);border-radius:0;color:var(--text-muted);font-size:12px;cursor:pointer;transition:all var(--transition-fast);-webkit-touch-callout:none;flex-shrink:0}.tool-btn:active{background:var(--hover-overlay);color:var(--text-high)}.tool-btn.arrow{padding:0 10px}.tool-btn.danger{color:var(--color-danger-muted)}.tool-btn.danger:active{background:var(--color-danger-bg);color:var(--color-danger-text)}.tool-btn.tmux{color:var(--color-tmux)}.tool-btn.tmux:active{background:var(--color-tmux-bg);color:var(--color-tmux-text)}.tool-btn.modifier{padding:0 10px}.tool-btn.icon{font-size:18px}.tool-btn.enter{color:var(--color-success)}.tool-btn.enter:active{background:var(--color-success-bg);color:var(--color-success-text)}.tool-btn.sticky{background:var(--color-accent-bg);color:var(--color-accent-text)}.tool-btn.locked{background:var(--color-locked-bg);color:var(--text-white);box-shadow:var(--glow-locked)}#disconnect-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:var(--overlay-bg);z-index:1000;display:flex;align-items:center;justify-content:center}#disconnect-content{text-align:center}#disconnect-icon{font-size:48px;color:var(--color-danger);margin-bottom:16px}#disconnect-text{color:var(--text-secondary);font-size:18px;margin-bottom:24px}#disconnect-retry{padding:var(--content-padding) 32px;background:var(--border-light);border:1px solid var(--border-medium);border-radius:var(--radius-lg);color:var(--text-high);font-size:14px;cursor:pointer;transition:all var(--transition-fast)}#disconnect-retry:active{background:var(--border-active);color:var(--text-white)}#copy-button{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);padding:8px 20px;background:linear-gradient(to bottom,var(--bg-surface),var(--bg-elevated));border:1px solid var(--border-light);border-radius:var(--radius-md);color:var(--text-high);font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:13px;font-weight:500;cursor:pointer;z-index:10000;box-shadow:var(--shadow-elevated);display:none;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;touch-action:manipulation;transition:all var(--transition-fast)}#copy-button:active{background:linear-gradient(to bottom,var(--bg-hover),var(--bg-surface));transform:translate(-50%,-50%) scale(.97)}#copy-button.visible{display:block;animation:copyButtonAppear .1s ease-out}#copy-button.success{background:linear-gradient(to bottom,var(--bg-success-gradient-top),var(--bg-success-gradient-bottom));border-color:var(--color-success-border);color:var(--color-success-text)}#copy-button.error{background:linear-gradient(to bottom,var(--bg-danger-gradient-top),var(--bg-danger-gradient-bottom));border-color:var(--color-danger-border);color:var(--color-danger-text)}@keyframes copyButtonAppear{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}#help-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:var(--overlay-bg);z-index:1000;display:flex;align-items:center;justify-content:center;padding:20px}#help-content{background:var(--bg-elevated);border:1px solid var(--border-light);border-radius:var(--radius-xl);max-width:320px;width:100%;box-shadow:var(--shadow-elevated);animation:helpAppear var(--transition-fast)}@keyframes helpAppear{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}#help-header{display:flex;align-items:center;justify-content:space-between;padding:var(--content-padding) 16px;border-bottom:1px solid var(--border-subtle);color:var(--text-high);font-size:14px;font-weight:500}#help-close{background:transparent;border:none;color:var(--text-muted);font-size:20px;cursor:pointer;padding:4px 8px;line-height:1}#help-close:active{color:var(--text-high)}#help-body{padding:var(--content-padding) 16px}.help-section{margin-bottom:var(--content-padding)}.help-section:last-child{margin-bottom:0}.help-title{color:var(--text-muted);font-size:10px;text-transform:uppercase;letter-spacing:.5px;margin-bottom:6px}.help-item{display:flex;align-items:center;gap:10px;padding:4px 0;color:var(--text-secondary);font-size:12px}.help-key{display:inline-block;min-width:80px;padding:2px 6px;background:var(--bg-surface);border:1px solid var(--border-subtle);border-radius:var(--radius-sm);color:var(--text-high);font-size:11px;text-align:center}#textview-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:var(--bg-primary);z-index:1000;display:flex;flex-direction:column;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}#textview-content{display:flex;flex-direction:column;width:100%;height:100%;background:var(--bg-primary)}#textview-header{display:flex;align-items:center;height:var(--row-height);min-height:var(--row-height);background:linear-gradient(to bottom,var(--bg-gradient-top),var(--bg-gradient-bottom));border-bottom:1px solid var(--border-subtle);flex-shrink:0}#textview-title{padding:0 var(--content-padding);color:var(--text-muted);font-size:12px;border-right:1px solid var(--border-subtle)}.textview-zoom-btn{display:flex;align-items:center;justify-content:center;height:var(--row-height);padding:0 var(--content-padding);background:transparent;border:none;border-right:1px solid var(--border-subtle);color:var(--text-muted);font-size:14px;cursor:pointer;transition:all var(--transition-fast)}.textview-zoom-btn:active{background:var(--hover-overlay);color:var(--text-high)}#textview-close{margin-left:auto;display:flex;align-items:center;justify-content:center;height:var(--row-height);padding:0 var(--content-padding);background:transparent;border:none;border-left:1px solid var(--border-subtle);color:var(--text-muted);font-size:16px;cursor:pointer;transition:all var(--transition-fast)}#textview-close:active{background:var(--hover-overlay);color:var(--text-high)}#textview-body{flex:1;min-height:0;margin:0;padding:8px var(--content-padding);background:var(--bg-primary);border:none;color:var(--text-primary);font-family:Menlo,Monaco,Consolas,monospace;font-size:9px;line-height:1.3;overflow-y:auto;white-space:pre-wrap;word-wrap:break-word;user-select:text;-webkit-user-select:text}.hidden{display:none!important}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;transition-duration:.01ms!important}}
|
porterminal/static/index.html
CHANGED
|
@@ -14,23 +14,21 @@
|
|
|
14
14
|
<meta name="format-detection" content="telephone=no">
|
|
15
15
|
<title>Terminal</title>
|
|
16
16
|
|
|
17
|
-
<!-- PWA -->
|
|
18
|
-
<link rel="manifest" href="/static/manifest.json">
|
|
17
|
+
<!-- Icons (PWA disabled - not useful for tunnel-based access) -->
|
|
19
18
|
<link rel="icon" type="image/svg+xml" href="/static/icon.svg">
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
<link rel="stylesheet" crossorigin href="/static/assets/app-BQiuUo6Q.css">
|
|
19
|
+
<script type="module" crossorigin src="/static/assets/app-By4EXMHC.js"></script>
|
|
20
|
+
<link rel="stylesheet" crossorigin href="/static/assets/app-DQePboVd.css">
|
|
23
21
|
</head>
|
|
24
22
|
<body>
|
|
25
23
|
<div id="app">
|
|
26
24
|
<!-- Tab Bar with Shell Selector -->
|
|
27
25
|
<div id="tab-bar">
|
|
28
26
|
<span id="connection-dot"></span>
|
|
27
|
+
<button id="btn-textview" title="Plain Text View">TXT</button>
|
|
29
28
|
<!-- Tabs rendered by JS -->
|
|
30
29
|
<div id="shell-selector">
|
|
31
30
|
<select id="shell-select"><option>...</option></select>
|
|
32
31
|
<button id="btn-info" title="Help">ⓘ</button>
|
|
33
|
-
<button id="btn-textview" title="Plain Text View">≡</button>
|
|
34
32
|
<button id="btn-shutdown" title="Shutdown">⏻</button>
|
|
35
33
|
</div>
|
|
36
34
|
</div>
|
|
@@ -41,33 +39,22 @@
|
|
|
41
39
|
</div>
|
|
42
40
|
|
|
43
41
|
<!-- Bottom Toolbar - Two rows -->
|
|
42
|
+
<!-- Buttons with data-key are generated from config/keys.ts -->
|
|
44
43
|
<div id="toolbar">
|
|
45
|
-
<div class="toolbar-row">
|
|
44
|
+
<div class="toolbar-row" id="toolbar-row1">
|
|
46
45
|
<button class="tool-btn" id="btn-escape">Esc</button>
|
|
47
|
-
|
|
48
|
-
<button class="tool-btn arrow" data-key="ArrowDown">↓</button>
|
|
49
|
-
<button class="tool-btn arrow" data-key="ArrowUp">↑</button>
|
|
50
|
-
<button class="tool-btn arrow" data-key="ArrowRight">→</button>
|
|
51
|
-
<button class="tool-btn icon" data-key="Tab">⇥</button>
|
|
52
|
-
<button class="tool-btn" data-key="Home">Home</button>
|
|
53
|
-
<button class="tool-btn" data-key="End">End</button>
|
|
46
|
+
<!-- Generated buttons inserted here -->
|
|
54
47
|
<button class="tool-btn icon" id="btn-backspace">⌫</button>
|
|
55
|
-
<button class="tool-btn" data-key="Delete">Del</button>
|
|
56
|
-
<button class="tool-btn icon enter" data-key="Enter">↵</button>
|
|
57
48
|
</div>
|
|
58
|
-
<div class="toolbar-row">
|
|
49
|
+
<div class="toolbar-row" id="toolbar-row2">
|
|
59
50
|
<button class="tool-btn modifier" id="btn-ctrl">Ctl</button>
|
|
60
51
|
<button class="tool-btn modifier" id="btn-alt">Alt</button>
|
|
61
52
|
<button class="tool-btn modifier" id="btn-shift">Sft</button>
|
|
62
|
-
|
|
63
|
-
<button class="tool-btn danger" data-key="Ctrl+C">^C</button>
|
|
53
|
+
<!-- Generated buttons inserted here -->
|
|
64
54
|
<button class="tool-btn icon" id="btn-paste">⎘</button>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<button class="tool-btn" data-key="@">@</button>
|
|
69
|
-
<button class="tool-btn" data-key="/">/</button>
|
|
70
|
-
<button class="tool-btn" data-key="\Enter">\↵</button>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="toolbar-row hidden" id="toolbar-row3">
|
|
57
|
+
<!-- Custom buttons from config inserted here -->
|
|
71
58
|
</div>
|
|
72
59
|
</div>
|
|
73
60
|
|
|
@@ -118,6 +105,10 @@
|
|
|
118
105
|
<div class="help-title">Tabs</div>
|
|
119
106
|
<div class="help-item"><span class="help-key">Hold ×</span> Close tab</div>
|
|
120
107
|
</div>
|
|
108
|
+
<div class="help-section">
|
|
109
|
+
<div class="help-title">TXT Button</div>
|
|
110
|
+
<div class="help-item">Plain text view for easy scrolling, selection and review</div>
|
|
111
|
+
</div>
|
|
121
112
|
</div>
|
|
122
113
|
</div>
|
|
123
114
|
</div>
|
porterminal/updater.py
CHANGED
|
@@ -11,179 +11,139 @@ from urllib.request import Request, urlopen
|
|
|
11
11
|
|
|
12
12
|
from porterminal import __version__
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
# Constants
|
|
15
|
+
PACKAGE_NAME = "ptn"
|
|
15
16
|
PYPI_URL = f"https://pypi.org/pypi/{PACKAGE_NAME}/json"
|
|
16
|
-
CACHE_DIR = Path.home() / ".
|
|
17
|
+
CACHE_DIR = Path.home() / ".ptn"
|
|
17
18
|
CACHE_FILE = CACHE_DIR / "update_check.json"
|
|
18
|
-
CACHE_TTL = 86400 # 24 hours
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def
|
|
22
|
-
"""
|
|
21
|
+
def _detect_install_method() -> str:
|
|
22
|
+
"""Detect how ptn was installed: uv, pipx, or pip."""
|
|
23
|
+
executable = sys.executable
|
|
24
|
+
file_path = str(Path(__file__).resolve())
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
uv_patterns = ["/uv/tools/", "\\uv\\tools\\"]
|
|
27
|
+
if any(p in executable or p in file_path for p in uv_patterns):
|
|
28
|
+
return "uv"
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
pipx_patterns = ["/pipx/venvs/", "\\pipx\\venvs\\"]
|
|
31
|
+
if any(p in executable or p in file_path for p in pipx_patterns):
|
|
32
|
+
return "pipx"
|
|
33
|
+
|
|
34
|
+
return "pip"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _is_newer(latest: str, current: str) -> bool:
|
|
38
|
+
"""Return True if latest > current."""
|
|
39
|
+
try:
|
|
40
|
+
from packaging.version import Version
|
|
41
|
+
|
|
42
|
+
return Version(latest) > Version(current)
|
|
43
|
+
except Exception:
|
|
44
|
+
# Fallback: tuple comparison (handles 0.9 vs 0.10 correctly)
|
|
45
|
+
def to_tuple(v: str) -> tuple[int, ...]:
|
|
46
|
+
v = v.lstrip("v").split("+")[0].split(".dev")[0]
|
|
47
|
+
return tuple(int(p) for p in v.split(".")[:3] if p.isdigit())
|
|
28
48
|
|
|
29
|
-
Returns:
|
|
30
|
-
Tuple of integers for comparison (ignores pre/post/dev).
|
|
31
|
-
"""
|
|
32
|
-
version = version.lstrip("v")
|
|
33
|
-
# Extract just the release numbers (before any pre/post/dev markers)
|
|
34
|
-
base = version.split("a")[0].split("b")[0].split("rc")[0]
|
|
35
|
-
base = base.split(".dev")[0].split(".post")[0].split("+")[0]
|
|
36
|
-
parts = []
|
|
37
|
-
for p in base.split("."):
|
|
38
49
|
try:
|
|
39
|
-
|
|
50
|
+
return to_tuple(latest) > to_tuple(current)
|
|
40
51
|
except ValueError:
|
|
41
|
-
|
|
42
|
-
return tuple(parts) if parts else (0,)
|
|
43
|
-
|
|
52
|
+
return False
|
|
44
53
|
|
|
45
|
-
def get_latest_version() -> str | None:
|
|
46
|
-
"""Fetch the latest version from PyPI.
|
|
47
54
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"""
|
|
55
|
+
def _get_check_interval() -> int:
|
|
56
|
+
"""Get check interval from config."""
|
|
51
57
|
try:
|
|
52
|
-
|
|
53
|
-
with urlopen(request, timeout=5) as response:
|
|
54
|
-
data = json.loads(response.read().decode())
|
|
55
|
-
return data["info"]["version"]
|
|
56
|
-
except (URLError, json.JSONDecodeError, KeyError, TimeoutError):
|
|
57
|
-
return None
|
|
58
|
+
from porterminal.config import get_config
|
|
58
59
|
|
|
60
|
+
return get_config().update.check_interval
|
|
61
|
+
except Exception:
|
|
62
|
+
return 86400 # Default 24h
|
|
59
63
|
|
|
60
|
-
def get_cached_version() -> str | None:
|
|
61
|
-
"""Get cached latest version if still valid.
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"""
|
|
65
|
+
def _should_check() -> bool:
|
|
66
|
+
"""Check if enough time passed since last check."""
|
|
66
67
|
if not CACHE_FILE.exists():
|
|
67
|
-
return
|
|
68
|
+
return True
|
|
68
69
|
try:
|
|
69
70
|
data = json.loads(CACHE_FILE.read_text())
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
pass
|
|
74
|
-
return None
|
|
75
|
-
|
|
71
|
+
return time.time() - data.get("timestamp", 0) > _get_check_interval()
|
|
72
|
+
except (OSError, json.JSONDecodeError, KeyError):
|
|
73
|
+
return True
|
|
76
74
|
|
|
77
|
-
def cache_version(version: str) -> None:
|
|
78
|
-
"""Cache the latest version.
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"""
|
|
76
|
+
def _save_cache(version: str) -> None:
|
|
77
|
+
"""Save check result to cache."""
|
|
83
78
|
try:
|
|
84
|
-
|
|
85
|
-
CACHE_FILE.write_text(
|
|
86
|
-
json.dumps(
|
|
87
|
-
{
|
|
88
|
-
"version": version,
|
|
89
|
-
"timestamp": time.time(),
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
)
|
|
79
|
+
CACHE_FILE.parent.mkdir(parents=True, exist_ok=True)
|
|
80
|
+
CACHE_FILE.write_text(json.dumps({"version": version, "timestamp": time.time()}))
|
|
93
81
|
except OSError:
|
|
94
|
-
pass
|
|
82
|
+
pass
|
|
95
83
|
|
|
96
84
|
|
|
97
|
-
def
|
|
98
|
-
"""
|
|
85
|
+
def get_latest_version(use_cache: bool = True) -> str | None:
|
|
86
|
+
"""Fetch latest version from PyPI.
|
|
99
87
|
|
|
100
88
|
Args:
|
|
101
|
-
use_cache:
|
|
89
|
+
use_cache: Use cached result if valid.
|
|
102
90
|
|
|
103
91
|
Returns:
|
|
104
|
-
|
|
92
|
+
Latest version string or None if fetch failed.
|
|
105
93
|
"""
|
|
106
94
|
# Try cache first
|
|
107
|
-
if use_cache:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
|
|
95
|
+
if use_cache and CACHE_FILE.exists():
|
|
96
|
+
try:
|
|
97
|
+
data = json.loads(CACHE_FILE.read_text())
|
|
98
|
+
if time.time() - data.get("timestamp", 0) < _get_check_interval():
|
|
99
|
+
return data.get("version")
|
|
100
|
+
except (OSError, json.JSONDecodeError, KeyError):
|
|
101
|
+
pass
|
|
114
102
|
|
|
115
103
|
# Fetch from PyPI
|
|
116
|
-
latest = get_latest_version()
|
|
117
|
-
if latest is None:
|
|
118
|
-
return False, None
|
|
119
|
-
|
|
120
|
-
# Cache the result
|
|
121
|
-
cache_version(latest)
|
|
122
|
-
|
|
123
104
|
try:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
105
|
+
request = Request(PYPI_URL, headers={"User-Agent": f"{PACKAGE_NAME}/{__version__}"})
|
|
106
|
+
with urlopen(request, timeout=5) as response:
|
|
107
|
+
data = json.loads(response.read().decode())
|
|
108
|
+
version = data["info"]["version"]
|
|
109
|
+
_save_cache(version)
|
|
110
|
+
return version
|
|
111
|
+
except (URLError, json.JSONDecodeError, KeyError, TimeoutError, OSError):
|
|
112
|
+
return None
|
|
127
113
|
|
|
128
114
|
|
|
129
|
-
def
|
|
130
|
-
"""
|
|
115
|
+
def check_for_updates(use_cache: bool = True) -> tuple[bool, str | None]:
|
|
116
|
+
"""Check if a newer version is available.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
use_cache: Use cached version check.
|
|
131
120
|
|
|
132
121
|
Returns:
|
|
133
|
-
|
|
122
|
+
Tuple of (update_available, latest_version).
|
|
134
123
|
"""
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
uv_patterns = [
|
|
140
|
-
"/.local/share/uv/tools/",
|
|
141
|
-
"/uv/tools/",
|
|
142
|
-
"\\uv\\tools\\",
|
|
143
|
-
]
|
|
144
|
-
for pattern in uv_patterns:
|
|
145
|
-
if pattern in executable or pattern in file_path:
|
|
146
|
-
return "uv"
|
|
147
|
-
|
|
148
|
-
# Check for pipx install
|
|
149
|
-
pipx_patterns = [
|
|
150
|
-
"/pipx/venvs/",
|
|
151
|
-
"/.local/share/pipx/",
|
|
152
|
-
"/.local/pipx/",
|
|
153
|
-
"\\pipx\\venvs\\",
|
|
154
|
-
]
|
|
155
|
-
for pattern in pipx_patterns:
|
|
156
|
-
if pattern in executable or pattern in file_path:
|
|
157
|
-
return "pipx"
|
|
158
|
-
|
|
159
|
-
# Default to pip
|
|
160
|
-
return "pip"
|
|
124
|
+
latest = get_latest_version(use_cache=use_cache)
|
|
125
|
+
if latest is None:
|
|
126
|
+
return False, None
|
|
127
|
+
return _is_newer(latest, __version__), latest
|
|
161
128
|
|
|
162
129
|
|
|
163
130
|
def get_upgrade_command() -> str:
|
|
164
|
-
"""Get
|
|
165
|
-
|
|
166
|
-
Returns:
|
|
167
|
-
Shell command string to upgrade porterminal.
|
|
168
|
-
"""
|
|
169
|
-
method = detect_install_method()
|
|
131
|
+
"""Get appropriate upgrade command for the installation method."""
|
|
132
|
+
method = _detect_install_method()
|
|
170
133
|
commands = {
|
|
171
134
|
"uv": f"uv tool upgrade {PACKAGE_NAME}",
|
|
172
135
|
"pipx": f"pipx upgrade {PACKAGE_NAME}",
|
|
173
|
-
"pip": f"pip install
|
|
136
|
+
"pip": f"pip install -U {PACKAGE_NAME}",
|
|
174
137
|
}
|
|
175
138
|
return commands.get(method, commands["pip"])
|
|
176
139
|
|
|
177
140
|
|
|
178
141
|
def update_package() -> bool:
|
|
179
|
-
"""Update
|
|
142
|
+
"""Update ptn to the latest version.
|
|
180
143
|
|
|
181
144
|
Returns:
|
|
182
145
|
True if update succeeded, False otherwise.
|
|
183
146
|
"""
|
|
184
|
-
method = detect_install_method()
|
|
185
|
-
|
|
186
|
-
# Check if update is available first
|
|
187
147
|
has_update, latest = check_for_updates(use_cache=False)
|
|
188
148
|
if not has_update:
|
|
189
149
|
if latest:
|
|
@@ -192,66 +152,53 @@ def update_package() -> bool:
|
|
|
192
152
|
print("Could not check for updates (network error)")
|
|
193
153
|
return True
|
|
194
154
|
|
|
195
|
-
print(f"Updating {PACKAGE_NAME} {__version__}
|
|
155
|
+
print(f"Updating {PACKAGE_NAME} {__version__} -> {latest}")
|
|
196
156
|
|
|
197
|
-
|
|
198
|
-
if method == "uv":
|
|
199
|
-
if not shutil.which("uv"):
|
|
200
|
-
print("uv not found, falling back to pip")
|
|
201
|
-
method = "pip"
|
|
202
|
-
else:
|
|
203
|
-
cmd = ["uv", "tool", "upgrade", PACKAGE_NAME]
|
|
204
|
-
|
|
205
|
-
if method == "pipx":
|
|
206
|
-
if not shutil.which("pipx"):
|
|
207
|
-
print("pipx not found, falling back to pip")
|
|
208
|
-
method = "pip"
|
|
209
|
-
else:
|
|
210
|
-
cmd = ["pipx", "upgrade", PACKAGE_NAME]
|
|
211
|
-
|
|
212
|
-
if method == "pip":
|
|
213
|
-
cmd = [sys.executable, "-m", "pip", "install", "--upgrade", PACKAGE_NAME]
|
|
157
|
+
method = _detect_install_method()
|
|
214
158
|
|
|
215
|
-
|
|
159
|
+
# Build command
|
|
160
|
+
if method == "uv" and shutil.which("uv"):
|
|
161
|
+
cmd = ["uv", "tool", "upgrade", PACKAGE_NAME]
|
|
162
|
+
elif method == "pipx" and shutil.which("pipx"):
|
|
163
|
+
cmd = ["pipx", "upgrade", PACKAGE_NAME]
|
|
164
|
+
else:
|
|
165
|
+
cmd = [sys.executable, "-m", "pip", "install", "-U", PACKAGE_NAME]
|
|
216
166
|
|
|
167
|
+
try:
|
|
168
|
+
result = subprocess.run(cmd, timeout=120)
|
|
217
169
|
if result.returncode == 0:
|
|
218
|
-
print(f"
|
|
219
|
-
print("Restart porterminal to use the new version")
|
|
170
|
+
print(f"Updated to {latest}. Restart to use new version.")
|
|
220
171
|
return True
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return False
|
|
225
|
-
|
|
172
|
+
print(f"Update failed (exit code {result.returncode})")
|
|
173
|
+
print(f"Try: {get_upgrade_command()}")
|
|
174
|
+
return False
|
|
226
175
|
except subprocess.TimeoutExpired:
|
|
227
176
|
print("Update timed out")
|
|
228
|
-
print(f"Try
|
|
177
|
+
print(f"Try: {get_upgrade_command()}")
|
|
229
178
|
return False
|
|
230
179
|
except FileNotFoundError as e:
|
|
231
180
|
print(f"Command not found: {e}")
|
|
232
|
-
print(f"Try
|
|
181
|
+
print(f"Try: {get_upgrade_command()}")
|
|
233
182
|
return False
|
|
234
183
|
|
|
235
184
|
|
|
236
|
-
def
|
|
237
|
-
"""
|
|
185
|
+
def check_and_notify() -> None:
|
|
186
|
+
"""Check for updates and print notification if available.
|
|
238
187
|
|
|
239
|
-
|
|
240
|
-
latest: Latest available version.
|
|
188
|
+
Call at startup. Non-blocking, respects config settings, never exec's.
|
|
241
189
|
"""
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
)
|
|
257
|
-
)
|
|
190
|
+
# Check if notifications are enabled
|
|
191
|
+
try:
|
|
192
|
+
from porterminal.config import get_config
|
|
193
|
+
|
|
194
|
+
if not get_config().update.notify_on_startup:
|
|
195
|
+
return
|
|
196
|
+
except Exception:
|
|
197
|
+
pass # Default to enabled if config fails
|
|
198
|
+
|
|
199
|
+
if not _should_check():
|
|
200
|
+
return
|
|
201
|
+
|
|
202
|
+
has_update, latest = check_for_updates(use_cache=False)
|
|
203
|
+
if has_update and latest:
|
|
204
|
+
print(f"Update available: {__version__} -> {latest}. Run: {get_upgrade_command()}")
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ptn
|
|
3
|
+
Version: 0.2.5
|
|
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/"><img src="https://img.shields.io/pypi/v/ptn?style=flat-square&logo=pypi&logoColor=white&label=PyPI" alt="PyPI"></a>
|
|
48
|
+
<a href="https://pypi.org/project/ptn/"><img src="https://img.shields.io/pypi/pyversions/ptn?style=flat-square&logo=python&logoColor=white" alt="Python"></a>
|
|
49
|
+
<a href="https://pypi.org/project/ptn/"><img src="https://img.shields.io/pypi/dm/ptn?style=flat-square&label=Downloads" alt="Downloads"></a>
|
|
50
|
+
<a href="https://github.com/lyehe/porterminal/blob/main/LICENSE"><img src="https://img.shields.io/github/license/lyehe/porterminal?style=flat-square" alt="License"></a>
|
|
51
|
+
<a href="https://github.com/lyehe/porterminal/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/lyehe/porterminal/ci.yml?branch=master&style=flat-square&logo=github&label=CI" alt="CI"></a>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<b>1.</b> <code>uvx ptn</code><br>
|
|
58
|
+
<b>2.</b> Scan the QR<br>
|
|
59
|
+
<b>3.</b> Access your terminal from your phone<br>
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
<video src="assets/demo.mp4" width="600" controls></video>
|
|
64
|
+
</p>
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Why
|
|
69
|
+
|
|
70
|
+
I wanted to vibe code from bed. ngrok requires registration and the free tier sucks. Cloudflare Quick Tunnel works great but is hard to use directly on the phone. Termius works after complicated setup: port forwarding, firewall rules, key management... I just wanted something simpler: **run a command, scan a QR, start typing.**
|
|
71
|
+
|
|
72
|
+
## Features
|
|
73
|
+
|
|
74
|
+
- **One command, instant access** - No SSH, no port forwarding, no config files. Cloudflare tunnel + QR code.
|
|
75
|
+
- **Actually usable on mobile** - Essential buttons and gestures for everyday terminal use.
|
|
76
|
+
- **Multi-tab shared sessions** - Run builds in one tab, tail logs in another. Sessions persist across reconnects.
|
|
77
|
+
- **Cross-platform** - Windows (PowerShell, CMD, WSL), Linux/macOS (Bash, Zsh, Fish). Auto-detects your shells.
|
|
78
|
+
- **Update notifications** - Checks PyPI daily, notifies on startup if update available. Run `ptn -U` to update.
|
|
79
|
+
|
|
80
|
+
## Install
|
|
81
|
+
|
|
82
|
+
| Method | Install | Update |
|
|
83
|
+
|--------|---------|--------|
|
|
84
|
+
| **uvx** (no install) | `uvx ptn` | `uvx --refresh ptn` |
|
|
85
|
+
| **uv tool** | `uv tool install ptn` | `uv tool upgrade ptn` |
|
|
86
|
+
| **pipx** | `pipx install ptn` | `pipx upgrade ptn` |
|
|
87
|
+
| **pip** | `pip install ptn` | `pip install -U ptn` |
|
|
88
|
+
|
|
89
|
+
Requires Python 3.12+ and [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/) (auto-installed if missing).
|
|
90
|
+
|
|
91
|
+
## Usage
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
ptn # Start in current directory
|
|
95
|
+
ptn ~/projects/myapp # Start in specific folder
|
|
96
|
+
ptn --no-tunnel # Local network only
|
|
97
|
+
ptn -b # Run in background
|
|
98
|
+
ptn --init # Create .ptn/ptn.yaml config
|
|
99
|
+
ptn -U # Update to latest version
|
|
100
|
+
ptn --check-update # Check if update available
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Configuration
|
|
104
|
+
|
|
105
|
+
Run `ptn --init` to create a starter config, or create `ptn.yaml` manually:
|
|
106
|
+
|
|
107
|
+
```yaml
|
|
108
|
+
# Custom buttons (appear in toolbar)
|
|
109
|
+
buttons:
|
|
110
|
+
- label: "claude"
|
|
111
|
+
send:
|
|
112
|
+
- "claude"
|
|
113
|
+
- 100 # delay in ms
|
|
114
|
+
- "\r"
|
|
115
|
+
- label: "tmux"
|
|
116
|
+
send: "tmux\r"
|
|
117
|
+
|
|
118
|
+
# Update checker settings
|
|
119
|
+
update:
|
|
120
|
+
notify_on_startup: true # Show update notification
|
|
121
|
+
check_interval: 86400 # Seconds between checks (default: 24h)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Config is searched in order: `$PORTERMINAL_CONFIG_PATH`, `./ptn.yaml`, `./.ptn/ptn.yaml`, `~/.ptn/ptn.yaml`.
|
|
125
|
+
|
|
126
|
+
## Security
|
|
127
|
+
|
|
128
|
+
> **Warning:** The URL is the only authentication. Anyone with the link has full terminal access.
|
|
129
|
+
|
|
130
|
+
- Don't share the URL
|
|
131
|
+
- Stop the server when not in use (`Ctrl+C`)
|
|
132
|
+
- Use `--no-tunnel` for local network only
|
|
133
|
+
- Environment variables are sanitized (API keys, tokens stripped)
|
|
134
|
+
|
|
135
|
+
## Contributing
|
|
136
|
+
|
|
137
|
+
Issues and PRs welcome.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
git clone https://github.com/lyehe/porterminal
|
|
141
|
+
cd porterminal
|
|
142
|
+
uv sync
|
|
143
|
+
uv run ptn
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
[AGPL-3.0](LICENSE)
|