141 lines
No EOL
3.9 KiB
Markdown
141 lines
No EOL
3.9 KiB
Markdown
# Web OSCAR Chat
|
||
|
||
A small browser chat client for [Open OSCAR Server](https://github.com/mk6i/open-oscar-server). It provides a simple web UI for basic AIM/ICQ-style messaging using a Node.js/Express backend.
|
||
|
||
> **Status:** early project. Review configuration and security before exposing it to the public.
|
||
|
||
## Features
|
||
|
||
- Sign in with an existing OSCAR screen name/password
|
||
- 1:1 instant messages
|
||
- Buddy list/presence (when provided by server/Web API)
|
||
- Add buddy
|
||
- Group chat join/send/leave via TOC
|
||
- Chat invites (Join/Ignore) via TOC
|
||
- Real-time updates via SSE
|
||
- TOC connection status indicator
|
||
|
||
## Not supported
|
||
|
||
This is not a full OSCAR client. Not yet supported: offline messages, file transfer, buddy icons, away/profile/status messages, typing notifications, blocking/warning management, chat moderation/admin, account registration, encryption, and full user directory/search.
|
||
|
||
## Requirements
|
||
|
||
- Node.js **20.19+**
|
||
- npm
|
||
- A running [Open OSCAR Server](https://github.com/mk6i/open-oscar-server)
|
||
- Access to the server’s Web API and/or TOC listener
|
||
|
||
## Quick start
|
||
|
||
```bash
|
||
git clone https://git.claytonia.net/Clarth/oscar-web.git
|
||
cd oscar-web
|
||
npm install
|
||
cp .env.example .env
|
||
# edit .env
|
||
npm run dev
|
||
```
|
||
|
||
Open `http://localhost:3000` (or your configured `PORT`).
|
||
|
||
For a normal run:
|
||
|
||
```bash
|
||
npm start
|
||
```
|
||
|
||
## Configuration
|
||
|
||
Copy `.env.example` to `.env` and set values for your environment.
|
||
|
||
| Variable | Description | Default |
|
||
|---|---|---|
|
||
| `WEBAPI_HOST` | Open OSCAR Web API host | `127.0.0.1` |
|
||
| `WEBAPI_PORT` | Open OSCAR Web API port | `8081` |
|
||
| `TOC_HOST` | TOC host for IM/chat/invites | unset |
|
||
| `TOC_PORT` | TOC port | `9898` |
|
||
| `MANAGEMENT_HOST` | Management API host (optional user search) | `127.0.0.1` |
|
||
| `MANAGEMENT_PORT` | Management API port | `8080` |
|
||
| `PORT` | Port this app listens on | `3000` |
|
||
| `LISTEN_HOST` | Address this app binds to | `127.0.0.1` |
|
||
| `TRUST_PROXY` | Number of proxy hops in front of app | `1` |
|
||
| `COOKIE_SECURE` | Session cookie secure mode: `auto`, `true`, `false` | `auto` |
|
||
| `SESSION_MAX_AGE_HOURS` | Session lifetime in hours | `24` |
|
||
| `DEV_ID` | Optional Web API devId/key if your server requires it | unset |
|
||
| `SESSION_SECRET` | Long random secret for cookie signing | required |
|
||
|
||
## Deployment (public / reverse proxy)
|
||
|
||
This app is intended to run behind HTTPS nginx.
|
||
|
||
### 1. App environment
|
||
|
||
Set these for public deployment:
|
||
|
||
```env
|
||
LISTEN_HOST=127.0.0.1
|
||
PORT=3000
|
||
TRUST_PROXY=1
|
||
COOKIE_SECURE=true
|
||
SESSION_SECRET=replace-with-a-long-random-secret
|
||
```
|
||
|
||
Protect `.env`:
|
||
|
||
```bash
|
||
chmod 600 .env
|
||
```
|
||
|
||
Run as a dedicated non-root user.
|
||
|
||
### 2. Nginx
|
||
|
||
- Redirect HTTP to HTTPS
|
||
- Use a valid TLS certificate
|
||
- Set HSTS
|
||
- Forward `X-Forwarded-*` headers
|
||
- Disable buffering for SSE (`/api/events`)
|
||
|
||
Example location for SSE:
|
||
|
||
```nginx
|
||
location /api/events {
|
||
proxy_pass http://127.0.0.1:3000;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header Connection '';
|
||
proxy_buffering off;
|
||
proxy_cache off;
|
||
proxy_read_timeout 1h;
|
||
}
|
||
```
|
||
|
||
For all other routes, proxy normally to `http://127.0.0.1:3000`.
|
||
|
||
### 3. Firewall / process
|
||
|
||
- Do **not** expose port `3000` publicly; bind to `127.0.0.1`.
|
||
- Run with a process manager (e.g. systemd) and restart on failure.
|
||
- Sessions are stored in memory: restart logs users out and the app should run as a single process.
|
||
|
||
## Security notes
|
||
|
||
The app includes basic hardening (Helmet/CSP, rate limits, JSON-only mutating API checks, Origin checks, input limits, fetch timeouts), but you should still:
|
||
|
||
- Use HTTPS only
|
||
- Keep Node/npm dependencies updated (`npm audit`)
|
||
- Monitor logs and auth failures
|
||
- Review before exposing to untrusted users
|
||
|
||
## Development
|
||
|
||
- Backend: Node.js, Express, ES modules
|
||
- Frontend: plain HTML/CSS/JavaScript (no build step)
|
||
- Real-time events: SSE (`/api/events`)
|
||
|
||
## License
|
||
|
||
Add a license file before distributing publicly. |