fetch2gmail 1.0.3__tar.gz → 1.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fetch2gmail-1.0.3/src/fetch2gmail.egg-info → fetch2gmail-1.0.5}/PKG-INFO +26 -3
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/README.md +25 -2
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/pyproject.toml +1 -1
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5/src/fetch2gmail.egg-info}/PKG-INFO +26 -3
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/web_ui.py +47 -8
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/LICENSE +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/setup.cfg +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetch2gmail.egg-info/SOURCES.txt +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetch2gmail.egg-info/dependency_links.txt +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetch2gmail.egg-info/entry_points.txt +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetch2gmail.egg-info/requires.txt +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetch2gmail.egg-info/top_level.txt +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/__init__.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/auth_server.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/auth_ui.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/cli.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/config.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/env_file.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/gmail_client.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/imap_client.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/log_buffer.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/run.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/state.py +0 -0
- {fetch2gmail-1.0.3 → fetch2gmail-1.0.5}/src/fetcher/ui_auth.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fetch2gmail
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: Self-hosted email fetcher: IMAP to Gmail API import with idempotent state tracking
|
|
5
5
|
Author: Fetch2Gmail Contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -240,9 +240,32 @@ All app files live in **one directory**: **config.json**, **credentials.json**,
|
|
|
240
240
|
| `fetch2gmail run` | Run one fetch cycle. |
|
|
241
241
|
| `fetch2gmail run --dry-run` | Connect to ISP and show what would be imported; no Gmail import, no delete. |
|
|
242
242
|
|
|
243
|
-
### Uninstall
|
|
243
|
+
### Uninstall
|
|
244
244
|
|
|
245
|
-
After copying **credentials.json** and **token.json** to the server,
|
|
245
|
+
**Machine used only to get the token (no system service):** After copying **credentials.json** and **token.json** to the server, remove the app: `pipx uninstall fetch2gmail`. Reinstall with `pipx install fetch2gmail` if you need to run `fetch2gmail auth` again later.
|
|
246
|
+
|
|
247
|
+
**Machine where the app runs (system service + app):** To remove everything so you can reinstall or run from source and see your changes:
|
|
248
|
+
|
|
249
|
+
1. **Stop and disable the systemd service, then remove the unit file:**
|
|
250
|
+
```bash
|
|
251
|
+
sudo systemctl stop fetch2gmail
|
|
252
|
+
sudo systemctl disable fetch2gmail
|
|
253
|
+
sudo rm /etc/systemd/system/fetch2gmail.service
|
|
254
|
+
sudo systemctl daemon-reload
|
|
255
|
+
```
|
|
256
|
+
(To confirm the service is gone: `systemctl status fetch2gmail` should report "not found".)
|
|
257
|
+
|
|
258
|
+
2. **Uninstall the app:**
|
|
259
|
+
- **If you installed with pipx:** `pipx uninstall fetch2gmail`
|
|
260
|
+
- **If you installed from source in a venv:** deactivate the venv (`deactivate`) and delete the project directory (e.g. `rm -rf ~/fetch2gmail`), or just use a different terminal and run from your dev clone with `pip install -e .` so the installed copy is no longer used.
|
|
261
|
+
|
|
262
|
+
3. **Optionally remove the data directory** (config, credentials, token, state, UI password file):
|
|
263
|
+
```bash
|
|
264
|
+
rm -rf /opt/fetch2gmail
|
|
265
|
+
```
|
|
266
|
+
Use the path you used as the data directory (e.g. `/opt/fetch2gmail` or `~/fetch2gmail`). Only do this if you no longer need the config or token; back them up first if you might reuse them.
|
|
267
|
+
|
|
268
|
+
**To test local changes:** Uninstall the system copy (steps 1 and 2 above), then from your git clone run `python3 -m venv .venv`, `source .venv/bin/activate`, `pip install -e .`. Use that terminal to run `fetch2gmail serve` (or reinstall the system service later with `fetch2gmail install-service` and point it at your data directory).
|
|
246
269
|
|
|
247
270
|
---
|
|
248
271
|
|
|
@@ -209,9 +209,32 @@ All app files live in **one directory**: **config.json**, **credentials.json**,
|
|
|
209
209
|
| `fetch2gmail run` | Run one fetch cycle. |
|
|
210
210
|
| `fetch2gmail run --dry-run` | Connect to ISP and show what would be imported; no Gmail import, no delete. |
|
|
211
211
|
|
|
212
|
-
### Uninstall
|
|
212
|
+
### Uninstall
|
|
213
213
|
|
|
214
|
-
After copying **credentials.json** and **token.json** to the server,
|
|
214
|
+
**Machine used only to get the token (no system service):** After copying **credentials.json** and **token.json** to the server, remove the app: `pipx uninstall fetch2gmail`. Reinstall with `pipx install fetch2gmail` if you need to run `fetch2gmail auth` again later.
|
|
215
|
+
|
|
216
|
+
**Machine where the app runs (system service + app):** To remove everything so you can reinstall or run from source and see your changes:
|
|
217
|
+
|
|
218
|
+
1. **Stop and disable the systemd service, then remove the unit file:**
|
|
219
|
+
```bash
|
|
220
|
+
sudo systemctl stop fetch2gmail
|
|
221
|
+
sudo systemctl disable fetch2gmail
|
|
222
|
+
sudo rm /etc/systemd/system/fetch2gmail.service
|
|
223
|
+
sudo systemctl daemon-reload
|
|
224
|
+
```
|
|
225
|
+
(To confirm the service is gone: `systemctl status fetch2gmail` should report "not found".)
|
|
226
|
+
|
|
227
|
+
2. **Uninstall the app:**
|
|
228
|
+
- **If you installed with pipx:** `pipx uninstall fetch2gmail`
|
|
229
|
+
- **If you installed from source in a venv:** deactivate the venv (`deactivate`) and delete the project directory (e.g. `rm -rf ~/fetch2gmail`), or just use a different terminal and run from your dev clone with `pip install -e .` so the installed copy is no longer used.
|
|
230
|
+
|
|
231
|
+
3. **Optionally remove the data directory** (config, credentials, token, state, UI password file):
|
|
232
|
+
```bash
|
|
233
|
+
rm -rf /opt/fetch2gmail
|
|
234
|
+
```
|
|
235
|
+
Use the path you used as the data directory (e.g. `/opt/fetch2gmail` or `~/fetch2gmail`). Only do this if you no longer need the config or token; back them up first if you might reuse them.
|
|
236
|
+
|
|
237
|
+
**To test local changes:** Uninstall the system copy (steps 1 and 2 above), then from your git clone run `python3 -m venv .venv`, `source .venv/bin/activate`, `pip install -e .`. Use that terminal to run `fetch2gmail serve` (or reinstall the system service later with `fetch2gmail install-service` and point it at your data directory).
|
|
215
238
|
|
|
216
239
|
---
|
|
217
240
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fetch2gmail
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: Self-hosted email fetcher: IMAP to Gmail API import with idempotent state tracking
|
|
5
5
|
Author: Fetch2Gmail Contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -240,9 +240,32 @@ All app files live in **one directory**: **config.json**, **credentials.json**,
|
|
|
240
240
|
| `fetch2gmail run` | Run one fetch cycle. |
|
|
241
241
|
| `fetch2gmail run --dry-run` | Connect to ISP and show what would be imported; no Gmail import, no delete. |
|
|
242
242
|
|
|
243
|
-
### Uninstall
|
|
243
|
+
### Uninstall
|
|
244
244
|
|
|
245
|
-
After copying **credentials.json** and **token.json** to the server,
|
|
245
|
+
**Machine used only to get the token (no system service):** After copying **credentials.json** and **token.json** to the server, remove the app: `pipx uninstall fetch2gmail`. Reinstall with `pipx install fetch2gmail` if you need to run `fetch2gmail auth` again later.
|
|
246
|
+
|
|
247
|
+
**Machine where the app runs (system service + app):** To remove everything so you can reinstall or run from source and see your changes:
|
|
248
|
+
|
|
249
|
+
1. **Stop and disable the systemd service, then remove the unit file:**
|
|
250
|
+
```bash
|
|
251
|
+
sudo systemctl stop fetch2gmail
|
|
252
|
+
sudo systemctl disable fetch2gmail
|
|
253
|
+
sudo rm /etc/systemd/system/fetch2gmail.service
|
|
254
|
+
sudo systemctl daemon-reload
|
|
255
|
+
```
|
|
256
|
+
(To confirm the service is gone: `systemctl status fetch2gmail` should report "not found".)
|
|
257
|
+
|
|
258
|
+
2. **Uninstall the app:**
|
|
259
|
+
- **If you installed with pipx:** `pipx uninstall fetch2gmail`
|
|
260
|
+
- **If you installed from source in a venv:** deactivate the venv (`deactivate`) and delete the project directory (e.g. `rm -rf ~/fetch2gmail`), or just use a different terminal and run from your dev clone with `pip install -e .` so the installed copy is no longer used.
|
|
261
|
+
|
|
262
|
+
3. **Optionally remove the data directory** (config, credentials, token, state, UI password file):
|
|
263
|
+
```bash
|
|
264
|
+
rm -rf /opt/fetch2gmail
|
|
265
|
+
```
|
|
266
|
+
Use the path you used as the data directory (e.g. `/opt/fetch2gmail` or `~/fetch2gmail`). Only do this if you no longer need the config or token; back them up first if you might reuse them.
|
|
267
|
+
|
|
268
|
+
**To test local changes:** Uninstall the system copy (steps 1 and 2 above), then from your git clone run `python3 -m venv .venv`, `source .venv/bin/activate`, `pip install -e .`. Use that terminal to run `fetch2gmail serve` (or reinstall the system service later with `fetch2gmail install-service` and point it at your data directory).
|
|
246
269
|
|
|
247
270
|
---
|
|
248
271
|
|
|
@@ -186,6 +186,7 @@ class ConfigResponse(BaseModel):
|
|
|
186
186
|
state_db_path: str
|
|
187
187
|
gmail_connected: bool
|
|
188
188
|
imap_password_set: bool
|
|
189
|
+
config_exists: bool = True # False when config.json not created yet (show setup wizard)
|
|
189
190
|
|
|
190
191
|
|
|
191
192
|
@app.get("/static/app.js", response_model=None)
|
|
@@ -227,16 +228,21 @@ def api_auth_required() -> dict[str, Any]:
|
|
|
227
228
|
|
|
228
229
|
@app.get("/api/auth/session")
|
|
229
230
|
def api_auth_session(request: Request) -> dict[str, bool]:
|
|
230
|
-
"""Whether the current request is logged in
|
|
231
|
+
"""Whether the current request is logged in; ui_password_mode=True when .ui_auth is used (hide Log out)."""
|
|
231
232
|
cfg_dir = _config_dir_safe()
|
|
232
233
|
if load_ui_auth(cfg_dir):
|
|
233
|
-
return {"logged_in": True}
|
|
234
|
-
return {"logged_in": verify_request(request, cfg_dir, _config_exists())}
|
|
234
|
+
return {"logged_in": True, "ui_password_mode": True}
|
|
235
|
+
return {"logged_in": verify_request(request, cfg_dir, _config_exists()), "ui_password_mode": False}
|
|
235
236
|
|
|
236
237
|
|
|
237
238
|
@app.post("/api/logout")
|
|
238
239
|
def api_logout():
|
|
239
|
-
|
|
240
|
+
"""Clear session and redirect. Log out button is hidden when .ui_auth is used (Basic Auth cannot be cleared from the page)."""
|
|
241
|
+
cfg_dir = _config_dir_safe()
|
|
242
|
+
if load_ui_auth(cfg_dir):
|
|
243
|
+
resp = RedirectResponse(url="/", status_code=302)
|
|
244
|
+
else:
|
|
245
|
+
resp = RedirectResponse(url="/login", status_code=302)
|
|
240
246
|
clear_session_cookie(resp)
|
|
241
247
|
return resp
|
|
242
248
|
|
|
@@ -305,15 +311,42 @@ def api_gmail_email(request: Request) -> dict[str, str | None]:
|
|
|
305
311
|
return {"email": _gmail_email()}
|
|
306
312
|
|
|
307
313
|
|
|
314
|
+
def _default_config_response() -> ConfigResponse:
|
|
315
|
+
"""Return empty config when config.json does not exist yet (avoids 404, show setup wizard)."""
|
|
316
|
+
return ConfigResponse(
|
|
317
|
+
imap=ImapConfigSafe(
|
|
318
|
+
host="",
|
|
319
|
+
port=993,
|
|
320
|
+
username="",
|
|
321
|
+
mailbox="INBOX",
|
|
322
|
+
use_ssl=True,
|
|
323
|
+
delete_after_import=True,
|
|
324
|
+
),
|
|
325
|
+
gmail=GmailConfigSafe(
|
|
326
|
+
use_label=False,
|
|
327
|
+
label="ISP Mail",
|
|
328
|
+
credentials_path="credentials.json",
|
|
329
|
+
token_path="token.json",
|
|
330
|
+
),
|
|
331
|
+
ui=UIConfigSafe(host="127.0.0.1", port=8765),
|
|
332
|
+
poll_interval_minutes=5,
|
|
333
|
+
state_db_path="state.db",
|
|
334
|
+
gmail_connected=_gmail_connected(),
|
|
335
|
+
imap_password_set=False,
|
|
336
|
+
config_exists=False,
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
|
|
308
340
|
@app.get("/api/config", response_model=ConfigResponse)
|
|
309
341
|
def api_config(request: Request) -> ConfigResponse:
|
|
310
342
|
"""Return non-sensitive config for display/editing (no password resolution)."""
|
|
311
343
|
if not _require_auth(request):
|
|
312
344
|
raise HTTPException(status_code=401, detail="Not authenticated")
|
|
345
|
+
path = _get_config_path()
|
|
346
|
+
if not path.exists():
|
|
347
|
+
return _default_config_response()
|
|
313
348
|
try:
|
|
314
|
-
cfg = load_config(
|
|
315
|
-
except FileNotFoundError:
|
|
316
|
-
raise HTTPException(status_code=404, detail="config.json not found")
|
|
349
|
+
cfg = load_config(path, resolve_password=False)
|
|
317
350
|
except ValueError as e:
|
|
318
351
|
raise HTTPException(status_code=400, detail=str(e))
|
|
319
352
|
imap = cfg.get("imap") or {}
|
|
@@ -345,6 +378,7 @@ def api_config(request: Request) -> ConfigResponse:
|
|
|
345
378
|
state_db_path=str(state.get("db_path", "state.db")),
|
|
346
379
|
gmail_connected=_gmail_connected(),
|
|
347
380
|
imap_password_set=_imap_password_set(),
|
|
381
|
+
config_exists=True,
|
|
348
382
|
)
|
|
349
383
|
|
|
350
384
|
|
|
@@ -688,7 +722,7 @@ _APP_JS = r"""
|
|
|
688
722
|
document.getElementById('landing').style.display = 'block';
|
|
689
723
|
return;
|
|
690
724
|
}
|
|
691
|
-
document.getElementById('logoutSpan').style.display = 'inline';
|
|
725
|
+
if (!session.ui_password_mode) document.getElementById('logoutSpan').style.display = 'inline';
|
|
692
726
|
loadConfig().then(function(c) { if (c) { loadStatus(); loadLogs(); } });
|
|
693
727
|
}).catch(function() {
|
|
694
728
|
document.getElementById('loadingMsg').style.display = 'none';
|
|
@@ -707,6 +741,11 @@ _APP_JS = r"""
|
|
|
707
741
|
function loadConfig() {
|
|
708
742
|
return api('/api/config').then(function(c) {
|
|
709
743
|
hideLoading();
|
|
744
|
+
if (!c.config_exists) {
|
|
745
|
+
document.getElementById('dashboard').style.display = 'none';
|
|
746
|
+
document.getElementById('setupWizard').style.display = 'block';
|
|
747
|
+
return null;
|
|
748
|
+
}
|
|
710
749
|
document.getElementById('setupWizard').style.display = 'none';
|
|
711
750
|
document.getElementById('dashboard').style.display = 'block';
|
|
712
751
|
document.getElementById('imap_host').value = c.imap.host;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|