Skip to content

Commit 438a253

Browse files
author
Tom Softreck
committed
update
1 parent 018cbeb commit 438a253

File tree

11 files changed

+67
-70
lines changed

11 files changed

+67
-70
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ publish-test: build
7272

7373
# Publish to PyPI (production)
7474
publish: check-publish
75+
@echo "Bumping patch version..."
76+
@poetry version patch
77+
@$(MAKE) build
7578
@echo "Publishing to PyPI..."
7679
@echo "WARNING: This will publish to PyPI (production). This action cannot be undone."
7780
@read -p "Are you sure you want to continue? (y/N): " confirm && [ "$$confirm" = "y" ] || [ "$$confirm" = "Y" ]

SETUP.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ webtop/
2121
│ └── static/ # Web assets
2222
│ ├── index.html
2323
│ ├── styles.css
24-
│ ├── webtop.js
24+
│ ├── webtask.js
2525
│ ├── process-data.js
2626
│ ├── file-system.js
2727
│ ├── file-icons.css
@@ -136,7 +136,7 @@ Copy each file from the artifacts to the correct location:
136136
### Web Assets
137137
- [ ] `webtop/static/index.html` - Main HTML structure
138138
- [ ] `webtop/static/styles.css` - Core styling and layout
139-
- [ ] `webtop/static/webtop.js` - Main application logic
139+
- [ ] `webtop/static/webtask.js` - Main application logic
140140
- [ ] `webtop/static/process-data.js` - Process simulation engine
141141
- [ ] `webtop/static/file-system.js` - Virtual file system
142142
- [ ] `webtop/static/file-icons.css` - File type styling
@@ -314,7 +314,7 @@ webtop --no-browser
314314

315315
### Debug Mode
316316

317-
For debugging, modify `webtop/static/webtop.js` and add:
317+
For debugging, modify `webtop/static/webtask.js` and add:
318318

319319
```javascript
320320
// Add at the top of WebTop class constructor

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@
360360
${process.command}
361361
</div>
362362
<div>
363-
<button class="kill-btn" onclick="webTop.killProcess(${process.pid})">
363+
<button class="kill-btn" onclick="webtask.killProcess(${process.pid})">
364364
KILL
365365
</button>
366366
</div>
@@ -431,7 +431,7 @@
431431
}
432432

433433
// Initialize webtop
434-
const webTop = new WebTop();
434+
const webtask = new WebTop();
435435
</script>
436436
</body>
437437
</html>

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "webtask"
3-
version = "2.0.0"
3+
version = "2.0.4"
44
description = "A modern, web-based system monitor inspired by htop with file browser and process transparency"
55
authors = ["Tom Sapletta <[email protected]>"]
66
readme = "README.md"

webtask/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99

1010
from .main import main
1111

12-
__all__ = ["main"]
12+
__all__ = ["main"]

webtask/main.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from .server import webtaskServer
99

1010

11-
def main():
12-
"""Main entry point for WebTop"""
11+
def main() -> None:
12+
"""Main entry point for webtask"""
1313
parser = argparse.ArgumentParser(
14-
description="WebTop - A web-based system monitor inspired by htop"
14+
description="webtask - A web-based system monitor inspired by htop"
1515
)
1616
parser.add_argument(
1717
"--host",
@@ -32,25 +32,23 @@ def main():
3232
parser.add_argument(
3333
"--version",
3434
action="version",
35-
version=f"WebTop {__import__('webtop').__version__}"
35+
version="webtask 2.0.1"
3636
)
37-
3837
args = parser.parse_args()
39-
4038
try:
41-
server = WebTopServer(
39+
server = webtaskServer(
4240
host=args.host,
4341
port=args.port,
4442
open_browser=not args.no_browser
4543
)
4644
server.run()
4745
except KeyboardInterrupt:
48-
print("\n👋 WebTop stopped by user")
46+
print("\n👋 webtask stopped by user")
4947
sys.exit(0)
5048
except Exception as e:
51-
print(f"❌ Error starting WebTop: {e}")
49+
print(f"❌ Error starting webtask: {e}")
5250
sys.exit(1)
5351

5452

5553
if __name__ == "__main__":
56-
main()
54+
main()

webtask/server.py

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,65 @@
22
webtask HTTP Server
33
"""
44

5-
import os
65
import webbrowser
76
import threading
8-
import time
97
from http.server import HTTPServer, SimpleHTTPRequestHandler
108
from pathlib import Path
9+
from typing import Any, Tuple, Optional, Type, TypeVar
1110

1211

13-
class webtaskHandler(SimpleHTTPRequestHandler):
14-
"""Custom HTTP handler for WebTop"""
12+
_RequestHandlerT = TypeVar('_RequestHandlerT', bound=SimpleHTTPRequestHandler)
1513

16-
def __init__(self, *args, **kwargs):
17-
# Set the directory to serve files from
14+
15+
class WebTaskHandler(SimpleHTTPRequestHandler):
16+
"""Custom HTTP handler for webtask"""
17+
def __init__(self, *args: Any, **kwargs: Any) -> None:
1818
static_dir = Path(__file__).parent / "static"
1919
super().__init__(*args, directory=str(static_dir), **kwargs)
2020

21-
def end_headers(self):
22-
# Add custom headers
23-
self.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
21+
def end_headers(self) -> None:
22+
self.send_header(
23+
'Cache-Control',
24+
'no-cache, no-store, must-revalidate'
25+
)
2426
self.send_header('Pragma', 'no-cache')
2527
self.send_header('Expires', '0')
2628
super().end_headers()
2729

28-
def log_message(self, format, *args):
29-
# Suppress default logging for cleaner output
30+
def log_message(self, format: str, *args: Any) -> None:
3031
pass
3132

3233

33-
class WebTopServer:
34-
"""WebTop server wrapper"""
35-
36-
def __init__(self, host="localhost", port=8000, open_browser=True):
34+
class webtaskServer:
35+
"""webtask server wrapper"""
36+
def __init__(self, host: str = "localhost", port: int = 8000, open_browser: bool = True) -> None:
3737
self.host = host
3838
self.port = port
3939
self.open_browser = open_browser
4040
self.server = None
4141

42-
def run(self):
43-
"""Start the WebTop server"""
42+
def run(self) -> None:
4443
try:
45-
self.server = HTTPServer((self.host, self.port), WebTopHandler)
44+
self.server = HTTPServer((self.host, self.port), WebTaskHandler)
4645
url = f"http://{self.host}:{self.port}"
47-
48-
print(f"🚀 Starting WebTop server at {url}")
49-
print("📊 WebTop is running! Press Ctrl+C to stop.")
50-
46+
print(f"🚀 Starting webtask server at {url}")
47+
print("📊 webtask is running! Press Ctrl+C to stop.")
5148
if self.open_browser:
52-
# Open browser after a small delay
5349
threading.Timer(1.0, lambda: webbrowser.open(url)).start()
54-
5550
self.server.serve_forever()
56-
5751
except OSError as e:
58-
if e.errno == 48: # Address already in use
59-
print(f"❌ Port {self.port} is already in use. Try a different port with --port")
52+
if hasattr(e, 'errno') and e.errno in (48, 98):
53+
print(
54+
f"❌ Port {self.port} is already in use. "
55+
"Try a different port with --port"
56+
)
6057
else:
6158
raise
6259
except KeyboardInterrupt:
6360
self.stop()
6461

65-
def stop(self):
66-
"""Stop the server"""
62+
def stop(self) -> None:
6763
if self.server:
68-
print("\n🛑 Stopping WebTop server...")
64+
print("\n🛑 Stopping webtask server...")
6965
self.server.shutdown()
70-
self.server.server_close()
66+
self.server.server_close()

webtask/static/file-system.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,8 @@ module.exports = app;`,
494494
"jest": "^29.5.0",
495495
"eslint": "^8.41.0"
496496
},
497-
"keywords": ["node", "express", "api", "webtop"],
498-
"author": "WebTop Demo",
497+
"keywords": ["node", "express", "api", "webtask"],
498+
"author": "WebTask Demo",
499499
"license": "MIT"
500500
}`,
501501
mime_type: 'application/json'
@@ -773,7 +773,7 @@ function ports() {
773773
netstat -tulpn | grep LISTEN
774774
}
775775
776-
echo "Welcome to WebTop Demo System!"`,
776+
echo "Welcome to WebTask Demo System!"`,
777777
mime_type: 'text/plain'
778778
}
779779
}

webtask/static/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<div class="modal-content">
107107
<div class="modal-header">
108108
<h3>File Browser - <span id="current-path">/</span></h3>
109-
<button class="close-btn" onclick="webTop.closeFileBrowser()">&times;</button>
109+
<button class="close-btn" onclick="webtask.closeFileBrowser()">&times;</button>
110110
</div>
111111
<div class="modal-body">
112112
<div class="file-browser">
@@ -122,7 +122,7 @@ <h3>File Browser - <span id="current-path">/</span></h3>
122122
<div class="modal-content">
123123
<div class="modal-header">
124124
<h3>Process Details - PID <span id="details-pid"></span></h3>
125-
<button class="close-btn" onclick="webTop.closeProcessDetails()">&times;</button>
125+
<button class="close-btn" onclick="webtask.closeProcessDetails()">&times;</button>
126126
</div>
127127
<div class="modal-body">
128128
<div class="process-details" id="process-details-content"></div>
@@ -135,7 +135,7 @@ <h3>Process Details - PID <span id="details-pid"></span></h3>
135135
<div class="preview-content">
136136
<div class="preview-header">
137137
<span id="preview-title">File Preview</span>
138-
<button class="close-btn" onclick="webTop.closePreview()">&times;</button>
138+
<button class="close-btn" onclick="webtask.closePreview()">&times;</button>
139139
</div>
140140
<div class="preview-body" id="preview-body"></div>
141141
</div>
@@ -147,6 +147,6 @@ <h3>Process Details - PID <span id="details-pid"></span></h3>
147147
Last update: <span id="last-update">never</span>
148148
</div>
149149

150-
<script src="webtop.js"></script>
150+
<script src="webtask.js"></script>
151151
</body>
152152
</html>

webtask/static/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "WebTop System Monitor",
3-
"short_name": "WebTop",
2+
"name": "WebTask System Monitor",
3+
"short_name": "WebTask",
44
"description": "A web-based system monitor inspired by htop",
55
"start_url": "/",
66
"display": "standalone",

0 commit comments

Comments
 (0)