mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-16 08:04:26 -04:00
move config into dedicated global app
This commit is contained in:
parent
ee7f73bd7b
commit
3e5b6ddeae
79 changed files with 494 additions and 525 deletions
|
@ -1,6 +1,5 @@
|
|||
__package__ = 'archivebox.index'
|
||||
|
||||
import archivebox
|
||||
from pathlib import Path
|
||||
from datetime import datetime, timezone
|
||||
from collections import defaultdict
|
||||
|
@ -19,10 +18,11 @@ from ..util import (
|
|||
htmlencode,
|
||||
urldecode,
|
||||
)
|
||||
from ..config import (
|
||||
from archivebox.config.legacy import (
|
||||
SAVE_ARCHIVE_DOT_ORG,
|
||||
PREVIEW_ORIGINALS,
|
||||
)
|
||||
from archivebox.config import CONSTANTS, DATA_DIR, VERSION, SHELL_CONFIG, SERVER_CONFIG
|
||||
|
||||
MAIN_INDEX_TEMPLATE = 'static_index.html'
|
||||
MINIMAL_INDEX_TEMPLATE = 'minimal_index.html'
|
||||
|
@ -33,11 +33,9 @@ TITLE_LOADING_MSG = 'Not yet archived...'
|
|||
### Main Links Index
|
||||
|
||||
@enforce_types
|
||||
def parse_html_main_index(out_dir: Path=archivebox.DATA_DIR) -> Iterator[str]:
|
||||
def parse_html_main_index(out_dir: Path=DATA_DIR) -> Iterator[str]:
|
||||
"""parse an archive index html file and return the list of urls"""
|
||||
|
||||
from plugins_sys.config.constants import CONSTANTS
|
||||
|
||||
index_path = Path(out_dir) / CONSTANTS.HTML_INDEX_FILENAME
|
||||
if index_path.exists():
|
||||
with open(index_path, 'r', encoding='utf-8') as f:
|
||||
|
@ -58,11 +56,9 @@ def generate_index_from_links(links: List[Link], with_headers: bool):
|
|||
def main_index_template(links: List[Link], template: str=MAIN_INDEX_TEMPLATE) -> str:
|
||||
"""render the template for the entire main index"""
|
||||
|
||||
from plugins_sys.config.apps import SHELL_CONFIG, SERVER_CONFIG
|
||||
|
||||
return render_django_template(template, {
|
||||
'version': archivebox.VERSION,
|
||||
'git_sha': SHELL_CONFIG.COMMIT_HASH or archivebox.VERSION,
|
||||
'version': VERSION,
|
||||
'git_sha': SHELL_CONFIG.COMMIT_HASH or VERSION,
|
||||
'num_links': str(len(links)),
|
||||
'date_updated': datetime.now(timezone.utc).strftime('%Y-%m-%d'),
|
||||
'time_updated': datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M'),
|
||||
|
@ -75,7 +71,6 @@ def main_index_template(links: List[Link], template: str=MAIN_INDEX_TEMPLATE) ->
|
|||
|
||||
@enforce_types
|
||||
def write_html_link_details(link: Link, out_dir: Optional[str]=None) -> None:
|
||||
from plugins_sys.config.constants import CONSTANTS
|
||||
out_dir = out_dir or link.link_dir
|
||||
|
||||
rendered_html = link_details_template(link)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue