mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-15 23:54:27 -04:00
fix: Restore html functionality
This commit is contained in:
parent
ce5979de45
commit
e403d07a88
3 changed files with 12 additions and 8 deletions
|
@ -308,7 +308,7 @@ def write_snapshot_details(snapshot: List[Model], out_dir: Optional[str]=None, s
|
||||||
out_dir = out_dir or snapshot.snapshot_dir
|
out_dir = out_dir or snapshot.snapshot_dir
|
||||||
|
|
||||||
write_json_snapshot_details(snapshot, out_dir=out_dir)
|
write_json_snapshot_details(snapshot, out_dir=out_dir)
|
||||||
#write_html_snapshot_details(snapshot, out_dir=out_dir) TODO: Refactor html code too
|
write_html_snapshot_details(snapshot, out_dir=out_dir)
|
||||||
if not skip_sql_index:
|
if not skip_sql_index:
|
||||||
write_sql_snapshot_details(snapshot)
|
write_sql_snapshot_details(snapshot)
|
||||||
|
|
||||||
|
|
|
@ -75,19 +75,23 @@ def main_index_template(snapshots: List[Model], template: str=MAIN_INDEX_TEMPLAT
|
||||||
def write_html_snapshot_details(snapshot: Model, out_dir: Optional[str]=None) -> None:
|
def write_html_snapshot_details(snapshot: Model, out_dir: Optional[str]=None) -> None:
|
||||||
out_dir = out_dir or snapshot.snapshot_dir
|
out_dir = out_dir or snapshot.snapshot_dir
|
||||||
|
|
||||||
rendered_html = link_details_template(link)
|
rendered_html = snapshot_details_template(snapshot)
|
||||||
atomic_write(str(Path(out_dir) / HTML_INDEX_FILENAME), rendered_html)
|
atomic_write(str(Path(out_dir) / HTML_INDEX_FILENAME), rendered_html)
|
||||||
|
|
||||||
|
|
||||||
@enforce_types
|
@enforce_types
|
||||||
def link_details_template(snapshot: Model) -> str:
|
def snapshot_details_template(snapshot: Model) -> str:
|
||||||
|
|
||||||
from ..extractors.wget import wget_output_path
|
from ..extractors.wget import wget_output_path
|
||||||
|
|
||||||
snapshot._asdict()
|
tags = snapshot.tags.all()
|
||||||
|
if len(tags) > 0:
|
||||||
|
tags = ",".join(list(tags.values_list("name", flat=True)))
|
||||||
|
else:
|
||||||
|
tags = "untagged"
|
||||||
|
|
||||||
return render_django_template(LINK_DETAILS_TEMPLATE, {
|
return render_django_template(LINK_DETAILS_TEMPLATE, {
|
||||||
**snapshot._asdict(),
|
**snapshot.as_json(),
|
||||||
**snapshot.canonical_outputs(),
|
**snapshot.canonical_outputs(),
|
||||||
'title': htmlencode(
|
'title': htmlencode(
|
||||||
snapshot.title
|
snapshot.title
|
||||||
|
@ -99,7 +103,7 @@ def link_details_template(snapshot: Model) -> str:
|
||||||
or (snapshot.domain if snapshot.is_archived else '')
|
or (snapshot.domain if snapshot.is_archived else '')
|
||||||
) or 'about:blank',
|
) or 'about:blank',
|
||||||
'extension': snapshot.extension or 'html',
|
'extension': snapshot.extension or 'html',
|
||||||
'tags': snapshot.tags.all() or 'untagged', #TODO: Return a proper comma separated list. Leaving it like this for now to revisit when fixing tags
|
'tags': tags,
|
||||||
'size': printable_filesize(snapshot.archive_size) if snapshot.archive_size else 'pending',
|
'size': printable_filesize(snapshot.archive_size) if snapshot.archive_size else 'pending',
|
||||||
'status': 'archived' if snapshot.is_archived else 'not yet archived',
|
'status': 'archived' if snapshot.is_archived else 'not yet archived',
|
||||||
'status_color': 'success' if snapshot.is_archived else 'danger',
|
'status_color': 'success' if snapshot.is_archived else 'danger',
|
||||||
|
|
|
@ -233,7 +233,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<link rel="stylesheet" href="../../static/bootstrap.min.css">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue