Skip to content

Add admin VPS console (/sshv), admin-mode UX, tips persistence, HTTPS health & deployment updates - #73

Merged
gamblecodezcom merged 2 commits into
mainfrom
codex/configure-git-and-update-project-files-py465r
Feb 25, 2026
Merged

Add admin VPS console (/sshv), admin-mode UX, tips persistence, HTTPS health & deployment updates#73
gamblecodezcom merged 2 commits into
mainfrom
codex/configure-git-and-update-project-files-py465r

Conversation

@gamblecodezcom

@gamblecodezcom gamblecodezcom commented Feb 25, 2026

Copy link
Copy Markdown
Owner

User description

Motivation

  • Improve admin tooling by adding a lightweight VPS console for remote diagnostics and repairs and make admin UI more explicit and safe.
  • Harden file/path handling and persist new runtime artifacts (tips, SSHV sessions, admin events) to prevent data loss and enable safer restarts.
  • Support HTTPS health endpoint when TLS certs are provided and standardize the production deployment experience (systemd, prod-run adjustments, .env guidance).

Description

  • Implement a new admin VPS console feature (/sshv) with session persistence, editor mode, command execution (safe guards), lock/refresh/exit controls, session GC, and associated callback handlers and UI.
  • Add admin-mode/view toggles and persistent admin/user menus so admins can switch visible admin UI without changing identity-based permissions, plus multiple admin UX improvements (menu labels, help pages, and command exposures).
  • Improve tips/helpful messages system with import/export via JSON, persistence to data/helpful_messages.json, a rotation policy avoiding immediate repeats, permission checks before posting to target group, and scheduler restart on config changes.
  • Harden filesystem access with validateSafePath and use it for all data reads/writes and static asset loads, plus safer atomic writes via temp files.
  • Replace internal health server to optionally serve HTTPS when HTTPS_KEY_PATH/HTTPS_CERT_PATH are configured (with allowed-path checks) and add requestHealthPayload helper used by admin health-check commands.
  • Persist and load SSHV sessions and admin event/log files; add helpful startup warnings and deferred dispatch to admins.
  • Repo and deployment changes: add LICENSE and SECURITY.md, update .env.example to document WEBAPP_HMAC_KEY, update .gitignore, remove the old Dockerfile, update README.md deployment section, and harden prod-run.sh and runewager.service to create runtime files, set proper service user, and tighten service file protections.

Testing

  • Syntax checks for shell scripts were run via bash -n prod-run.sh deploy.sh and passed.
  • Module load smoke test was executed under CI mode with CI=true node index.js to validate the runtime file loads without side effects and it completed successfully.
  • Basic runtime smoke assertions exercised: health payload request path (requestHealthPayload) and tips scheduler startup were exercised in a local CI-style run and returned without errors.

Codex Task


CodeAnt-AI Description

Add admin VPS console, persistent tips, HTTPS health, safer file handling, and admin-view UX

What Changed

  • Administrators can open a lightweight VPS console via /sshv or the Admin Dashboard to run foreground shell commands, edit files, lock/refresh/exit sessions, and have sessions persisted across restarts; expired sessions are automatically cleaned.
  • Admin mode now controls admin UI visibility (enable/disable admin view) rather than changing identity-based permissions; persistent admin and user menus switch cleanly when toggled.
  • Helpful messages (tips) are persisted to disk, can be imported/exported via JSON, avoid immediate repeats, and posting to the target group is skipped when the bot lacks send permissions.
  • Health endpoint can use HTTPS when TLS cert/key paths are configured (with allowed-path checks); admin health checks use the configured protocol and fall back to HTTP if TLS is unavailable.
  • File/path access and runtime state persistence are hardened: data files are validated to stay inside allowed directories and writes use atomic temp-file replacement; runtime files and logs are created at deployment/startup.
  • Several command texts and help pages updated to reflect the new admin-view behavior; unknown slash commands are now detected and return a clear usage hint.

Impact

✅ Admins can run remote diagnostics without SSH access
✅ Clearer admin UI visibility toggles
✅ Health checks work over HTTPS when certs are provided

💡 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.

@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

Warning

Rate limit exceeded

@gamblecodezcom has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 23 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a57f2ca and e6d28f8.

📒 Files selected for processing (10)
  • .env.example
  • .gitignore
  • Dockerfile
  • LICENSE
  • README.md
  • SECURITY.md
  • deploy.sh
  • index.js
  • prod-run.sh
  • runewager.service
✨ Finishing Touches
🧪 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-py465r

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.

@gamblecodezcom
gamblecodezcom merged commit 00cb5cc into main Feb 25, 2026
1 check passed
@gamblecodezcom
gamblecodezcom deleted the codex/configure-git-and-update-project-files-py465r branch February 25, 2026 02:38
@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

  • File ownership & permissions
    mkdir/touch will create files with the deploy user's default ownership and umask (often root when run via CI or sudo), which can make files unreadable/unwritable by the service user or world-readable exposing sensitive session/admin data. Ensure directories/files are created with restrictive permissions and correct owner/group matching the runtime service user.

  • Empty JSON initialization
    The deploy creates data files with touch, leaving sshv-sessions.json empty. If the app expects valid JSON on startup this can cause parse errors. Create a valid initial JSON value (e.g. [] or {}) and write it atomically to avoid partially written files being observed by the running service.

  • File permissions
    Sensitive runtime artifacts (admin-events.log, sshv-sessions.json, main/error logs) are created with a plain touch call which relies on the current umask and user. On many systems this yields world-readable files (0644). These files may contain sensitive admin data or session tokens — ensure they are created with restrictive permissions and owned by the service user, or the app will inadvertently expose secrets.

  • Service user existence
    The service template sets User=runewager/Group=runewager. If this system user/group doesn't exist on the host, service enable/start will fail. The deployment flow/README should document creating the system user or the installer should create it prior to enabling the service.

  • Logrotate ownership
    The logrotate config uses the numeric UID/GID from the deploy user (id -u/id -g). If the intended service user is runewager (or another system user), rotated files may get wrong ownership. Ensure the UID/GID in create 0640 matches the actual service user that writes the logs.

  • Copyright accuracy
    Verify the copyright year and copyright holder ("Runewager") are correct and intentional for all contributors and the project. If contributors or a different legal entity own the work, update the holder line accordingly or consider a year range.

  • SPDX identifier
    The LICENSE file contains the full MIT text but is missing an SPDX short identifier (e.g. "SPDX-License-Identifier: MIT") which helps automated tooling and package managers detect the license reliably.

@codeant-ai

codeant-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

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