Skip to content

Commit 976a1e0

Browse files
committed
Port v3.1 scheduling + OS autostart onto multi_account
- Adopt main's headless CLI runner (AutoRewarder_CLI.py) and OS autostart (HKCU Run on Windows, .desktop on Linux), dropping the in-process daemon scheduler and the standalone windows_startup module. - Per-account schedule schema: advancedScheduling, runDuration, queriesPerHour, queries_pc, queries_mobile. Legacy keys (time/window_hours/queries) are ignored on read. - Settings modal: accordion schedule cards (one expanded at a time) with live inline summary; advancedScheduling sub-toggle gates the duration and rate fields. - settings_manager: atomic write retries on transient Windows PermissionError; read paths tolerate recovery-write failures. - Bump CURRENT_VERSION to v3.1 and the brand sub-header to match. Keeps multi-account architecture, redesigned UI, PC/Mobile run split and per-account schedules from multi_account.
1 parent 7d03594 commit 976a1e0

11 files changed

Lines changed: 906 additions & 583 deletions

AutoRewarder.py

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,59 @@
1-
"""
2-
Main entry point for the AutoRewarder application.
3-
4-
This script initializes the core AutoRewarderAPI and launches the desktop
5-
graphical user interface (GUI) using pywebview.
6-
7-
Usage:
8-
Run this file directly to start the application:
9-
python AutoRewarder.py
10-
"""
11-
12-
import os
13-
import webview
14-
15-
from src.api import AutoRewarderAPI
16-
from src.config import GUI_DIR, ASSETS_DIR
17-
18-
# Entry point of the application
19-
if __name__ == "__main__":
20-
api = AutoRewarderAPI()
21-
window = webview.create_window(
22-
title="AutoRewarder",
23-
url=os.path.join(GUI_DIR, "index.html"),
24-
js_api=api,
25-
width=640,
26-
height=680,
27-
resizable=False,
28-
background_color="#0b0d12",
29-
)
30-
api.set_window(window) # pass window reference to AutoRewarderAPI for logging
31-
webview.start(icon=os.path.join(ASSETS_DIR, "icon.ico"))
1+
"""
2+
Main entry point for the AutoRewarder application.
3+
4+
By default this script launches the desktop GUI (pywebview). When invoked
5+
with the `--headless` flag — typically by the OS-level autostart entry
6+
that the "Start with Windows/Linux" toggle installs — it delegates to
7+
`AutoRewarder_CLI.main()`, which drives scheduled runs for every enabled
8+
account without bringing up a window.
9+
10+
Usage:
11+
# GUI:
12+
python AutoRewarder.py
13+
14+
# Headless / scheduled:
15+
python AutoRewarder.py --headless [--account <id-or-label>]
16+
"""
17+
18+
import argparse
19+
import os
20+
import sys
21+
22+
if __name__ == "__main__":
23+
parser = argparse.ArgumentParser(add_help=False)
24+
parser.add_argument(
25+
"--headless", action="store_true", help="Run in headless/background mode"
26+
)
27+
args, _ = parser.parse_known_args()
28+
29+
# Delegate to the CLI runner when --headless is set. Any remaining args
30+
# (e.g., --account, --pc, --mobile) stay in sys.argv so the CLI parser
31+
# can consume them.
32+
if args.headless:
33+
if "--headless" in sys.argv:
34+
sys.argv.remove("--headless")
35+
36+
from AutoRewarder_CLI import main as headless_main
37+
38+
headless_main()
39+
sys.exit(0)
40+
41+
# GUI path — import webview + the API lazily so the headless path doesn't
42+
# pay for the pywebview import cost.
43+
import webview
44+
45+
from src.api import AutoRewarderAPI
46+
from src.config import GUI_DIR, ASSETS_DIR
47+
48+
api = AutoRewarderAPI()
49+
window = webview.create_window(
50+
title="AutoRewarder",
51+
url=os.path.join(GUI_DIR, "index.html"),
52+
js_api=api,
53+
width=640,
54+
height=680,
55+
resizable=False,
56+
background_color="#0b0d12",
57+
)
58+
api.set_window(window) # pass window reference to AutoRewarderAPI for logging
59+
webview.start(icon=os.path.join(ASSETS_DIR, "icon.ico"))

0 commit comments

Comments
 (0)