mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-08 03:08:29 +02:00
Archive snapshots of websites locally (#672)
* Add basic HTML snapshots * Implement asset list * Add snapshot creation tests * Add deletion tests * Show file size * Remove snapshots * Create new snapshots * Switch to single-file * CSS tweak * Remove auto refresh * Show delete link when there is no file yet * Add current date to display name * Add flag for snapshot support * Add option for disabling automatic snapshots * Make snapshots sharable * Document image variants * Update README.md * Add migrations * Fix tests
This commit is contained in:
@@ -31,6 +31,7 @@ class SettingsGeneralViewTestCase(TestCase, BookmarkFactoryMixin):
|
||||
"enable_sharing": False,
|
||||
"enable_public_sharing": False,
|
||||
"enable_favicons": False,
|
||||
"enable_automatic_html_snapshots": True,
|
||||
"tag_search": UserProfile.TAG_SEARCH_STRICT,
|
||||
"display_url": False,
|
||||
"display_view_bookmark_action": True,
|
||||
@@ -69,6 +70,7 @@ class SettingsGeneralViewTestCase(TestCase, BookmarkFactoryMixin):
|
||||
"enable_sharing": True,
|
||||
"enable_public_sharing": True,
|
||||
"enable_favicons": True,
|
||||
"enable_automatic_html_snapshots": False,
|
||||
"tag_search": UserProfile.TAG_SEARCH_LAX,
|
||||
"display_url": True,
|
||||
"display_view_bookmark_action": False,
|
||||
@@ -110,6 +112,10 @@ class SettingsGeneralViewTestCase(TestCase, BookmarkFactoryMixin):
|
||||
self.assertEqual(
|
||||
self.user.profile.enable_favicons, form_data["enable_favicons"]
|
||||
)
|
||||
self.assertEqual(
|
||||
self.user.profile.enable_automatic_html_snapshots,
|
||||
form_data["enable_automatic_html_snapshots"],
|
||||
)
|
||||
self.assertEqual(self.user.profile.tag_search, form_data["tag_search"])
|
||||
self.assertEqual(self.user.profile.display_url, form_data["display_url"])
|
||||
self.assertEqual(
|
||||
@@ -285,6 +291,35 @@ class SettingsGeneralViewTestCase(TestCase, BookmarkFactoryMixin):
|
||||
count=0,
|
||||
)
|
||||
|
||||
def test_automatic_html_snapshots_should_be_hidden_when_snapshots_not_supported(
|
||||
self,
|
||||
):
|
||||
response = self.client.get(reverse("bookmarks:settings.general"))
|
||||
html = response.content.decode()
|
||||
|
||||
self.assertInHTML(
|
||||
"""
|
||||
<input type="checkbox" name="enable_automatic_html_snapshots" id="id_enable_automatic_html_snapshots" checked="">
|
||||
""",
|
||||
html,
|
||||
count=0,
|
||||
)
|
||||
|
||||
@override_settings(LD_ENABLE_SNAPSHOTS=True)
|
||||
def test_automatic_html_snapshots_should_be_visible_when_snapshots_supported(
|
||||
self,
|
||||
):
|
||||
response = self.client.get(reverse("bookmarks:settings.general"))
|
||||
html = response.content.decode()
|
||||
|
||||
self.assertInHTML(
|
||||
"""
|
||||
<input type="checkbox" name="enable_automatic_html_snapshots" id="id_enable_automatic_html_snapshots" checked="">
|
||||
""",
|
||||
html,
|
||||
count=1,
|
||||
)
|
||||
|
||||
def test_about_shows_version_info(self):
|
||||
response = self.client.get(reverse("bookmarks:settings.general"))
|
||||
html = response.content.decode()
|
||||
|
Reference in New Issue
Block a user