mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-06 07:47:53 +10:00
improve plugin tests and config
This commit is contained in:
21
archivebox/plugins/staticfile/config.json
Normal file
21
archivebox/plugins/staticfile/config.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required_plugins": ["chrome"],
|
||||
"properties": {
|
||||
"STATICFILE_ENABLED": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-aliases": ["SAVE_STATICFILE", "USE_STATICFILE"],
|
||||
"description": "Enable static file detection"
|
||||
},
|
||||
"STATICFILE_TIMEOUT": {
|
||||
"type": "integer",
|
||||
"default": 30,
|
||||
"minimum": 5,
|
||||
"x-fallback": "TIMEOUT",
|
||||
"description": "Timeout for static file detection in seconds"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,9 +382,9 @@ async function main() {
|
||||
|
||||
originalUrl = url;
|
||||
|
||||
if (!getEnvBool('SAVE_STATICFILE', true)) {
|
||||
console.error('Skipping (SAVE_STATICFILE=False)');
|
||||
console.log(JSON.stringify({type: 'ArchiveResult', status: 'skipped', output_str: 'SAVE_STATICFILE=False'}));
|
||||
if (!getEnvBool('STATICFILE_ENABLED', true)) {
|
||||
console.error('Skipping (STATICFILE_ENABLED=False)');
|
||||
console.log(JSON.stringify({type: 'ArchiveResult', status: 'skipped', output_str: 'STATICFILE_ENABLED=False'}));
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
1
archivebox/plugins/staticfile/templates/icon.html
Normal file
1
archivebox/plugins/staticfile/templates/icon.html
Normal file
@@ -0,0 +1 @@
|
||||
📎
|
||||
24
archivebox/plugins/staticfile/templates/thumbnail.html
Normal file
24
archivebox/plugins/staticfile/templates/thumbnail.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!-- Staticfile thumbnail - preview of the static file -->
|
||||
<div class="extractor-thumbnail staticfile-thumbnail" style="width: 100%; height: 100px; overflow: hidden; background: #f5f5f5;">
|
||||
{% if output_path %}
|
||||
{% if output_path|lower|slice:"-4:" == ".pdf" or "application/pdf" in output_path %}
|
||||
<embed src="{{ output_path }}#toolbar=0&navpanes=0&scrollbar=0&page=1&view=FitH"
|
||||
type="application/pdf"
|
||||
style="width: 100%; height: 200px; margin-top: -20px; pointer-events: none;">
|
||||
{% elif output_path|lower|slice:"-4:" in ".jpg.png.gif.svg.bmp.webp.avif.heic" or output_path|lower|slice:"-5:" == ".jpeg" %}
|
||||
<img src="{{ output_path }}"
|
||||
style="width: 100%; height: 100%; object-fit: cover;"
|
||||
loading="lazy">
|
||||
{% elif output_path|lower|slice:"-4:" in ".mp4.webm.mov.avi.mkv" or output_path|lower|slice:"-5:" == ".mpeg" %}
|
||||
<video src="{{ output_path }}"
|
||||
style="width: 100%; height: 100%; object-fit: cover;"
|
||||
preload="metadata"
|
||||
muted></video>
|
||||
{% else %}
|
||||
<iframe src="{{ output_path }}"
|
||||
style="width: 100%; height: 100%; border: none; pointer-events: none;"
|
||||
loading="lazy"
|
||||
sandbox="allow-same-origin"></iframe>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
Reference in New Issue
Block a user