mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-22 03:05:32 +02:00
feat: Reader mode via Mozilla Readability.js
Adds an opt-in 'Reader mode' advanced option to the capture dialog. When enabled, Readability.js is injected as a browser script during SingleFile capture; it fires on single-file-on-before-capture-start, replaces the page body with the distilled article content, injects a clean typographic stylesheet, and adds a header with title/byline/site. Falls back silently if Readability fails (e.g. non-article pages). - vendor/readability/Readability.js Apache 2.0, Mozilla, v0.6.0 - singlefile.rs: embed READABILITY_JS + READER_MODE_WRAPPER_JS via include_str!; write both to temp dir when reader_mode is true; base_single_file_cmd now accepts &[&Path] for multiple --browser-script - capture.rs: CaptureConfig.reader_mode: bool - routes.rs: CaptureBody.reader_mode: Option<bool> (defaults false) - api.js: submitCapture passes reader_mode in payload - CaptureDialog.jsx: Reader mode toggle in Advanced options (off by default)
This commit is contained in:
parent
28c62ddc5a
commit
596a6d1c89
9 changed files with 2967 additions and 74 deletions
|
|
@ -650,11 +650,10 @@ async fn delete_entry_handler(
|
|||
#[derive(Debug, serde::Deserialize)]
|
||||
struct CaptureBody {
|
||||
locator: String,
|
||||
/// Optional quality cap for yt-dlp sources: `"best"` or any `"NNNp"` string
|
||||
/// (e.g. `"1080p"`, `"720p"`, `"2160p"`). Absent or `"best"` → highest available.
|
||||
quality: Option<String>,
|
||||
/// Per-capture uBlock override. Absent → use global instance setting.
|
||||
ublock_enabled: Option<bool>,
|
||||
/// Distil to article content via Readability before archiving. Absent = false.
|
||||
reader_mode: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
|
|
@ -754,6 +753,7 @@ async fn capture_handler(
|
|||
let capture_config = capture::CaptureConfig {
|
||||
cookie_rules,
|
||||
ublock_enabled: Some(effective_ublock),
|
||||
reader_mode: body.reader_mode.unwrap_or(false),
|
||||
};
|
||||
|
||||
// Spawn background capture.
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
40
crates/archivr-server/static/assets/index-Cxnyn8_x.js
Normal file
40
crates/archivr-server/static/assets/index-Cxnyn8_x.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Archivr</title>
|
||||
<script type="module" crossorigin src="/assets/index-BB_JhtCc.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-Cxnyn8_x.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-C0BIEdow.css">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue