Skip to content

Add admin SSHV console, tips persistence, HTTPS health, admin UX and deployment improvements - #79

Merged
gamblecodezcom merged 3 commits into
mainfrom
codex/configure-git-and-update-project-files-44kkc6
Feb 25, 2026
Merged

Add admin SSHV console, tips persistence, HTTPS health, admin UX and deployment improvements#79
gamblecodezcom merged 3 commits into
mainfrom
codex/configure-git-and-update-project-files-44kkc6

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 25, 2026

Copy link
Copy Markdown
Owner

User description

Motivation

  • Improve admin tooling (lightweight VPS console, persistent admin dashboard and admin-mode toggles) and make maintenance safer by adding persistent session/state files and strict path validation.
  • Harden deployment and runtime: support HTTPS health endpoint with allowed TLS paths, make prod runner robust to port conflicts, enforce directory permissions, and prefer systemd-based deployment over Docker.
  • Make helpful messages (tips) manageable (import/export, persistence, scheduled posting) and add basic security & licensing files.

Description

  • Environment and repo: add WEBAPP_HMAC_KEY to .env.example, update .gitignore, add LICENSE and SECURITY.md, remove Dockerfile, and update README.md to document systemd deployment.
  • Admin & runtime features in index.js: implement a lightweight admin VPS console (/sshv) with session persistence, editor mode, command execution with safety checks, session GC, and NDJSON admin event logging; add validateSafePath to restrict file access; replace health client calls to support HTTPS via isHealthHttpsConfigured/requestHealthPayload; update WebApp init-data verification to use WEBAPP_HMAC_KEY; enhance persistent user/admin menus, ephemeral promo prompts, admin-mode toggles, and many admin UX refinements; implement tips/helpful-messages import, export and persistence plus smarter scheduler selection.
  • Deployment scripts: extend deploy.sh to create data/log directories and set ownership/permissions; expand prod-run.sh to manage service user creation, secure file permissions, resolve TLS-based health URL, detect and clear port conflicts, wait for health checks, and harden the generated systemd unit (ReadWritePaths, ProtectSystem, UMask, etc.).
  • Utilities: rewrite and harden scripts/self-diagnose.sh to produce a consistent snapshot report; add helpers for atomic JSON writes and safe path handling; remove Dockerfile in favor of systemd run scripts.

Testing

  • Performed automated dependency install via npm ci as part of the deploy flow and ensured install completed without fatal errors (success).
  • Executed a non-destructive smoke load of the runtime module (`node -e

Codex Task


CodeAnt-AI Description

Add admin VPS console, persistent tips, HTTPS health checks, and safer deployment

What Changed

  • Admins can open a lightweight VPS console (/sshv) from DMs or the admin dashboard: run foreground commands, edit files in an editor mode, lock/unlock, refresh sessions, confirm dangerous commands, and have console state persisted and restored across restarts.
  • Helpful messages (tips) are stored to disk, can be imported/exported as JSON, are editable via admin commands, and the scheduler avoids reposting the same tip twice in a row and checks bot permission before posting.
  • Health endpoint can use HTTPS when TLS cert/key are provided (with allowed-path validation); health checks in the UI and admin tools will automatically use HTTPS when configured and report which protocol was used.
  • Admin UI behavior changed: "admin view" toggles only show or hide admin UI (permissions remain based on admin identity), persistent user/admin menus clean up each other, and ephemeral promo prompts auto-remove after 15s to keep chats tidy.
  • Deployment and diagnostics hardened: deploy creates data/log directories and sets ownership/permissions; systemd unit runs as a dedicated non-root user and adds stricter read/write and isolation settings; self-diagnose script now captures a consistent snapshot and produces a clearer, structured report.

Impact

✅ Persistent VPS console sessions
✅ HTTPS health checks
✅ Safer systemd deployment and file permissions

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Summary by CodeRabbit

  • Refactor
    • Eliminated redundant precheck sequences, reducing code duplication and improving maintainability without affecting system behavior.

@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Feb 25, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99bd3ea and 32844d7.

📒 Files selected for processing (1)
  • prod-run.sh
💤 Files with no reviewable changes (1)
  • prod-run.sh

📝 Walkthrough

Walkthrough

The PR removes three duplicate precheck blocks from prod-run.sh that resolved health URLs, extracted ports, and freed conflicting ports, consolidating these operations into a single precheck sequence without altering subsequent control flow.

Changes

Cohort / File(s) Summary
Duplicate precheck consolidation
prod-run.sh
Removed three identical sequences that resolved health URLs, extracted ports, and conditionally freed conflicting ports, reducing redundant precheck attempts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 Three times the code did hop,
Now duplicates must stop!
One true path cleaned and clear,
Simpler scripts bring bunny cheer!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims to add admin SSHV console, tips persistence, HTTPS health, admin UX and deployment improvements, but the raw_summary shows only removal of duplicate health check prechecks (3 removed blocks, 14 deleted lines) with no additions. The title should accurately reflect the changes in prod-run.sh: removing duplicate health URL/port resolution prechecks. Consider 'Remove duplicate health check prechecks in prod-run.sh' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/configure-git-and-update-project-files-44kkc6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Feb 25, 2026
@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Unsafe process termination
    The script kills processes that are detected as listening on a port without verifying the process identity or confirming it belongs to an unrelated service. This may terminate unrelated system services or processes. Please validate the candidate PID's command line / working directory (or listening socket owner) before sending TERM/KILL and avoid killing system processes.

  • Port-detection reliability
    is_port_listening uses multiple fallbacks (ss/netstat/proc parsing) but the /proc/net/tcp parsing logic may produce false negatives on some systems or IPv6-only listeners. Consider enhancing checks to include /proc/net/tcp6 and validate address-family and socket state explicitly.

  • Health probe mismatch
    The self-diagnose health check always probes HTTP at 127.0.0.1:${PORT}/health. If the app is configured to serve HTTPS (keys/certs present), the check will false-fail. Reuse the same health URL resolution logic as prod-run.sh (or detect HTTPS env vars) and respect TLS verification flags.

  • Copyright year/holder clarity
    The copyright line uses a single year and a single holder. Confirm the correct copyright year range and legal entity (e.g., "2024-2026" or company vs individual) to avoid ambiguity for contributors and downstream users.

  • SPDX identifier missing
    The license file does not include an SPDX short identifier which helps automated tooling and package scanners reliably detect the license. Adding "SPDX-License-Identifier: MIT" at the top is recommended.

@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@gamblecodezcom
gamblecodezcom merged commit 15bc49f into main Feb 25, 2026
3 of 5 checks passed
@gamblecodezcom
gamblecodezcom deleted the codex/configure-git-and-update-project-files-44kkc6 branch February 25, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant