feat: replace browser login with imported Reddit sessions
This commit is contained in:
1 parent
2b0545afcf
commit
c483c7b8be
76 files changed
+2048
-2828
No files matched your search
+1
-18
@@ -98,8 +98,6 @@ export const ConfigSchema = z.object({
|
||||
'justforfans.app',
|
||||
'justfor.fans',
|
||||
]),
|
||||
username: z.string().optional(),
|
||||
password: z.string().optional(),
|
||||
}),
|
||||
openrouter: z.object({
|
||||
apiKey: z.string(),
|
||||
@@ -120,9 +118,8 @@ export const ConfigSchema = z.object({
|
||||
}).default({ minDelayBetweenMessagesMs: 300000, maxMessagesPerHour: 8, jitterMs: 60000 }),
|
||||
browser: z.object({
|
||||
sessionDir: z.string().default('./data/browser-session'),
|
||||
headless: z.boolean().default(false),
|
||||
dryRun: z.boolean().default(false),
|
||||
}).default({ sessionDir: './data/browser-session', headless: false, dryRun: false }),
|
||||
}).default({ sessionDir: './data/browser-session', dryRun: false }),
|
||||
database: z.object({
|
||||
path: z.string().default('./data/reddit-bot.db'),
|
||||
}).default({ path: './data/reddit-bot.db' }),
|
||||
@@ -176,20 +173,6 @@ export function loadConfig(): Config {
|
||||
}
|
||||
rawConfig.openrouter.apiKey = process.env.OPENROUTER_API_KEY || rawConfig.openrouter.apiKey;
|
||||
|
||||
// Inject Reddit credentials from environment
|
||||
if (process.env.REDDIT_USERNAME) {
|
||||
rawConfig.reddit.username = process.env.REDDIT_USERNAME;
|
||||
}
|
||||
if (process.env.REDDIT_PASSWORD) {
|
||||
rawConfig.reddit.password = process.env.REDDIT_PASSWORD;
|
||||
}
|
||||
|
||||
// Override browser settings from environment
|
||||
if (process.env.BROWSER_HEADLESS !== undefined) {
|
||||
if (!rawConfig.browser) rawConfig.browser = {};
|
||||
rawConfig.browser.headless = process.env.BROWSER_HEADLESS === 'true';
|
||||
}
|
||||
|
||||
if (process.env.WEB_DASHBOARD_TOKEN !== undefined) {
|
||||
if (!rawConfig.web) rawConfig.web = {};
|
||||
rawConfig.web.authToken = process.env.WEB_DASHBOARD_TOKEN;
|
||||
|
||||
Reference in new issue
Block a user