cptr 0.0.1__tar.gz
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.
- cptr-0.0.1/.gitignore +29 -0
- cptr-0.0.1/.python-version +1 -0
- cptr-0.0.1/LICENSE +19 -0
- cptr-0.0.1/PKG-INFO +27 -0
- cptr-0.0.1/README.md +0 -0
- cptr-0.0.1/cptr/__init__.py +1 -0
- cptr-0.0.1/cptr/app.py +42 -0
- cptr-0.0.1/cptr/cli.py +30 -0
- cptr-0.0.1/cptr/frontend/.gitignore +23 -0
- cptr-0.0.1/cptr/frontend/.npmrc +1 -0
- cptr-0.0.1/cptr/frontend/README.md +42 -0
- cptr-0.0.1/cptr/frontend/package-lock.json +2106 -0
- cptr-0.0.1/cptr/frontend/package.json +44 -0
- cptr-0.0.1/cptr/frontend/src/app.css +114 -0
- cptr-0.0.1/cptr/frontend/src/app.d.ts +13 -0
- cptr-0.0.1/cptr/frontend/src/app.html +12 -0
- cptr-0.0.1/cptr/frontend/src/lib/assets/favicon.svg +1 -0
- cptr-0.0.1/cptr/frontend/src/lib/components/DirectoryPicker.svelte +276 -0
- cptr-0.0.1/cptr/frontend/src/lib/components/FileBrowser.svelte +142 -0
- cptr-0.0.1/cptr/frontend/src/lib/components/FileEditor.svelte +275 -0
- cptr-0.0.1/cptr/frontend/src/lib/components/PathBar.svelte +152 -0
- cptr-0.0.1/cptr/frontend/src/lib/components/Sidebar.svelte +216 -0
- cptr-0.0.1/cptr/frontend/src/lib/components/Terminal.svelte +147 -0
- cptr-0.0.1/cptr/frontend/src/lib/components/TerminalDrawer.svelte +175 -0
- cptr-0.0.1/cptr/frontend/src/lib/components/TopBar.svelte +42 -0
- cptr-0.0.1/cptr/frontend/src/lib/index.ts +1 -0
- cptr-0.0.1/cptr/frontend/src/lib/stores.ts +141 -0
- cptr-0.0.1/cptr/frontend/src/routes/+layout.svelte +31 -0
- cptr-0.0.1/cptr/frontend/src/routes/+layout.ts +3 -0
- cptr-0.0.1/cptr/frontend/src/routes/+page.svelte +13 -0
- cptr-0.0.1/cptr/frontend/static/robots.txt +3 -0
- cptr-0.0.1/cptr/frontend/svelte.config.js +19 -0
- cptr-0.0.1/cptr/frontend/tsconfig.json +20 -0
- cptr-0.0.1/cptr/frontend/vite.config.ts +16 -0
- cptr-0.0.1/cptr/routers/__init__.py +6 -0
- cptr-0.0.1/cptr/routers/files.py +206 -0
- cptr-0.0.1/cptr/routers/terminal.py +98 -0
- cptr-0.0.1/cptr/utils/__init__.py +1 -0
- cptr-0.0.1/cptr/utils/terminal.py +149 -0
- cptr-0.0.1/dev.sh +2 -0
- cptr-0.0.1/pyproject.toml +22 -0
cptr-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
*.egg
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
.venv/
|
|
10
|
+
.env
|
|
11
|
+
|
|
12
|
+
# Frontend
|
|
13
|
+
computr/frontend/node_modules/
|
|
14
|
+
computr/frontend/build/
|
|
15
|
+
computr/frontend/.svelte-kit/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.vscode/
|
|
19
|
+
.idea/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
*~
|
|
23
|
+
|
|
24
|
+
# OS
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
27
|
+
|
|
28
|
+
# uv
|
|
29
|
+
uv.lock
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.9
|
cptr-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Open Use License
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Open WebUI Pte. Ltd.
|
|
4
|
+
|
|
5
|
+
This software is licensed under the Open Use License, which incorporates the
|
|
6
|
+
Elastic License 2.0 ("ELv2") in full with the additional condition set forth
|
|
7
|
+
below. In the event of any conflict between the additional condition and ELv2,
|
|
8
|
+
the additional condition shall control.
|
|
9
|
+
|
|
10
|
+
The full text of ELv2 is available at:
|
|
11
|
+
https://www.elastic.co/licensing/elastic-license
|
|
12
|
+
|
|
13
|
+
Attribution Preservation
|
|
14
|
+
|
|
15
|
+
You may not remove, modify, obscure, replace, or supplement any attribution
|
|
16
|
+
elements of the software in any deployment, distribution, or derivative work.
|
|
17
|
+
Attribution elements are any elements identifying the origin of the software,
|
|
18
|
+
such as logos, icons, visual marks, the product name, copyright notices,
|
|
19
|
+
attribution statements, and about screens or version information.
|
cptr-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cptr
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Your computer, from anywhere - code, manage, and control your machine from the web.
|
|
5
|
+
License: Open Use License
|
|
6
|
+
|
|
7
|
+
Copyright © 2025 Open WebUI Pte. Ltd.
|
|
8
|
+
|
|
9
|
+
This software is licensed under the Open Use License, which incorporates the
|
|
10
|
+
Elastic License 2.0 ("ELv2") in full with the additional condition set forth
|
|
11
|
+
below. In the event of any conflict between the additional condition and ELv2,
|
|
12
|
+
the additional condition shall control.
|
|
13
|
+
|
|
14
|
+
The full text of ELv2 is available at:
|
|
15
|
+
https://www.elastic.co/licensing/elastic-license
|
|
16
|
+
|
|
17
|
+
Attribution Preservation
|
|
18
|
+
|
|
19
|
+
You may not remove, modify, obscure, replace, or supplement any attribution
|
|
20
|
+
elements of the software in any deployment, distribution, or derivative work.
|
|
21
|
+
Attribution elements are any elements identifying the origin of the software,
|
|
22
|
+
such as logos, icons, visual marks, the product name, copyright notices,
|
|
23
|
+
attribution statements, and about screens or version information.
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Requires-Dist: click>=8.1
|
|
27
|
+
Requires-Dist: fastapi[standard]>=0.128.8
|
cptr-0.0.1/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""cptr - your computer, from anywhere."""
|
cptr-0.0.1/cptr/app.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from fastapi import FastAPI, Request
|
|
4
|
+
from fastapi.responses import FileResponse
|
|
5
|
+
from fastapi.staticfiles import StaticFiles
|
|
6
|
+
|
|
7
|
+
from cptr.routers import files_router, terminal_router
|
|
8
|
+
|
|
9
|
+
app = FastAPI()
|
|
10
|
+
|
|
11
|
+
FRONTEND_BUILD_DIR = Path(__file__).parent / "frontend" / "build"
|
|
12
|
+
|
|
13
|
+
# API routers - must be registered before the SPA catch-all
|
|
14
|
+
app.include_router(files_router)
|
|
15
|
+
app.include_router(terminal_router)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@app.get("/api/health")
|
|
19
|
+
async def health():
|
|
20
|
+
return {"status": "ok"}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# Serve the built frontend - ships inside the package
|
|
24
|
+
if FRONTEND_BUILD_DIR.exists():
|
|
25
|
+
|
|
26
|
+
# Serve static assets (JS, CSS, images, etc.)
|
|
27
|
+
app.mount(
|
|
28
|
+
"/_app",
|
|
29
|
+
StaticFiles(directory=str(FRONTEND_BUILD_DIR / "_app")),
|
|
30
|
+
name="frontend-assets",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# SPA catch-all: serve index.html for all non-API routes
|
|
34
|
+
# so client-side routing works on any path
|
|
35
|
+
@app.get("/{full_path:path}")
|
|
36
|
+
async def serve_spa(request: Request, full_path: str):
|
|
37
|
+
# Try to serve the exact file first (e.g. robots.txt, favicon)
|
|
38
|
+
file_path = FRONTEND_BUILD_DIR / full_path
|
|
39
|
+
if full_path and file_path.is_file():
|
|
40
|
+
return FileResponse(file_path)
|
|
41
|
+
# Otherwise return index.html and let SvelteKit router handle it
|
|
42
|
+
return FileResponse(FRONTEND_BUILD_DIR / "index.html")
|
cptr-0.0.1/cptr/cli.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import uvicorn
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
@click.group()
|
|
6
|
+
def cli():
|
|
7
|
+
"""cptr - your computer, from anywhere."""
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@cli.command()
|
|
12
|
+
@click.option("--host", default="0.0.0.0", help="Host to bind to.")
|
|
13
|
+
@click.option("--port", default=8000, type=int, help="Port to bind to.")
|
|
14
|
+
@click.option("--reload", is_flag=True, default=False, help="Enable auto-reload.")
|
|
15
|
+
def run(host: str, port: int, reload: bool):
|
|
16
|
+
"""Start the cptr server."""
|
|
17
|
+
uvicorn.run(
|
|
18
|
+
"cptr.app:app",
|
|
19
|
+
host=host,
|
|
20
|
+
port=port,
|
|
21
|
+
reload=reload,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main():
|
|
26
|
+
cli()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
main()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
node_modules
|
|
2
|
+
|
|
3
|
+
# Output
|
|
4
|
+
.output
|
|
5
|
+
.vercel
|
|
6
|
+
.netlify
|
|
7
|
+
.wrangler
|
|
8
|
+
/.svelte-kit
|
|
9
|
+
/build
|
|
10
|
+
|
|
11
|
+
# OS
|
|
12
|
+
.DS_Store
|
|
13
|
+
Thumbs.db
|
|
14
|
+
|
|
15
|
+
# Env
|
|
16
|
+
.env
|
|
17
|
+
.env.*
|
|
18
|
+
!.env.example
|
|
19
|
+
!.env.test
|
|
20
|
+
|
|
21
|
+
# Vite
|
|
22
|
+
vite.config.js.timestamp-*
|
|
23
|
+
vite.config.ts.timestamp-*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
engine-strict=true
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# sv
|
|
2
|
+
|
|
3
|
+
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
|
|
4
|
+
|
|
5
|
+
## Creating a project
|
|
6
|
+
|
|
7
|
+
If you're seeing this, you've probably already done this step. Congrats!
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
# create a new project
|
|
11
|
+
npx sv create my-app
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
To recreate this project with the same configuration:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
# recreate this project
|
|
18
|
+
npx sv@0.15.1 create --template minimal --types ts --no-install frontend
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Developing
|
|
22
|
+
|
|
23
|
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm run dev
|
|
27
|
+
|
|
28
|
+
# or start the server and open the app in a new browser tab
|
|
29
|
+
npm run dev -- --open
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Building
|
|
33
|
+
|
|
34
|
+
To create a production version of your app:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm run build
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You can preview the production build with `npm run preview`.
|
|
41
|
+
|
|
42
|
+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|