Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
path: |
dist/mailpress.exe
dist/print-files.ps1
dist/install-task.ps1
dist/config.example.json
dist/mailpress.ico

- name: release (on tag)
if: startsWith(github.ref, 'refs/tags/v')
Expand All @@ -47,7 +47,7 @@ jobs:
files: |
dist/mailpress.exe
dist/print-files.ps1
dist/install-task.ps1
dist/config.example.json
dist/mailpress.ico
draft: false
generate_release_notes: true
180 changes: 0 additions & 180 deletions FINDINGS.md

This file was deleted.

24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ wired Windows printer. Runs as a Scheduled Task on the office PC.

## Install (the easy way)

1. Download `mailpress.exe`, `print-files.ps1`, `install-task.ps1`, and
`config.example.json` from the latest [GitHub Release][releases]. Put
them all in the same folder, e.g. `C:\mailpress\`.
1. Download `mailpress.exe`, `print-files.ps1`, and `config.example.json`
from the latest [GitHub Release][releases] (or the artifact of a
`build on windows` workflow run). Put them all in the same folder,
e.g. `C:\mailpress\`.
2. Double-click `mailpress.exe`. The setup wizard runs the first time
there's no config: it lists installed printers, walks you through the
Google OAuth client creation, runs the consent flow in your browser,
does a test print, and installs itself as a Scheduled Task.
picks a polling interval, does a test print, and installs itself as a
Scheduled Task.
3. Done. Send a test email to the office inbox and confirm it prints.

[releases]: https://github.com/turetsky/mailpress/releases
Expand All @@ -21,12 +23,18 @@ OAuth client itself — the wizard prints the exact links and steps.

## Install from source (no .exe)

Useful if Node 18+ is already on the office PC and you want to skip the
download dance.

```
git clone https://github.com/turetsky/mailpress.git
git clone https://github.com/Turetsky/mailpress.git
cd mailpress
node cli.mjs # launches the wizard if no config
```

The Scheduled Task installed by the wizard will point at `node cli.mjs`
in this case, so the source tree has to stay where you cloned it.

## Commands

```
Expand Down Expand Up @@ -111,7 +119,7 @@ cli.mjs # entry point — arg parsing, routing, top-level catch
lib/
config.mjs # load/save/validate config.local.json
log.mjs # leveled console + file logger
prompt.mjs # readline wrapper (ask/confirm/choose)
prompt.mjs # readline wrapper + polling-interval picker
gmail.mjs # OAuth refresh + Gmail API client + MIME helpers
printer.mjs # Windows printer enumeration + printing + test print
oauth.mjs # interactive OAuth consent flow
Expand All @@ -120,10 +128,8 @@ lib/
doctor.mjs # diagnostic mode
wizard.mjs # first-run interactive setup
test.mjs # post-install test menu (--test)
index.mjs # back-compat shim → poll.mjs
consent.mjs # back-compat shim → oauth.mjs
print-files.ps1 # PowerShell helper: print one or more files
install-task.ps1 # legacy: install Scheduled Task from source
config.example.json # template — copy to config.local.json
assets/
icon.svg # source icon (envelope on slant + speed lines)
icon.ico # multi-size .ico embedded into mailpress.exe
Expand Down
13 changes: 11 additions & 2 deletions cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ async function main() {
validateConfig(cfg).length > 0 ||
!new GmailClient(cfg, { log }).hasToken();
if (needsWizard) {
// Scheduled Task / cron / piped invocations have no TTY. Refuse
// to launch the interactive wizard in that case — it would hang
// forever waiting for stdin. Exit 2 so the operator can spot
// the failure in the task history.
if (!process.stdin.isTTY) {
log.error("config is missing or invalid, and there is no terminal to run the wizard in.");
log.error("Run `mailpress --setup` from a console to configure.");
return 2;
}
const { runWizard } = await import("./lib/wizard.mjs");
await runWizard({ log });
try { cfg = loadConfig(); }
Expand All @@ -144,8 +153,8 @@ async function main() {
} catch (e) {
log.fatal(e);
process.stderr.write(`\nFatal: ${e.message}\nSee log: ${logPath}\n`);
// Exit 2 means "re-run --setup or --consent"; preserved from the original
// index.mjs so Scheduled Task / monitoring scripts can distinguish.
// Exit 2 means "re-run --setup or --consent" so Scheduled Task /
// monitoring scripts can distinguish auth failure from generic crashes.
const { GmailAuthError } = await import("./lib/gmail.mjs");
if (e instanceof GmailAuthError && e.fatal) return 2;
return 1;
Expand Down
39 changes: 0 additions & 39 deletions consent.mjs

This file was deleted.

49 changes: 0 additions & 49 deletions index.mjs

This file was deleted.

Loading
Loading