Skip to content

Commit b50e343

Browse files
committed
feat: enforce f2f:// or f2fs:// protocol for F2F_APP
Reject other protocols with a clear error message pointing to the correct format.
1 parent 7a9d216 commit b50e343

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ export class Server {
147147
const f2fAppRaw = options.f2fApp || this.mightGetEnv("F2F_APP")
148148
if (f2fAppRaw) {
149149
const f2fApp = new URL(f2fAppRaw)
150+
if (f2fApp.protocol !== "f2f:" && f2fApp.protocol !== "f2fs:") {
151+
console.log(
152+
"F2F_APP must use f2f:// (http) or f2fs:// (https) protocol, e.g. f2fs://keyId:keySecret@app.first2find.nl",
153+
)
154+
process.exit(1)
155+
}
150156
if (!f2fApp.username || !f2fApp.password) {
151157
console.log(
152158
"F2F_APP must contain credentials, e.g. f2fs://keyId:keySecret@app.first2find.nl",

0 commit comments

Comments
 (0)