Browse Source

fix the add links form

Nick Sweeting 5 years ago
parent
commit
ae208435c9

+ 1 - 1
archivebox/cli/logging.py

@@ -191,7 +191,7 @@ def log_deduping_finished(num_new_links: int):
 
 
 
 
 def log_crawl_started(new_links):
 def log_crawl_started(new_links):
-    print('{lightblue}[*] Starting crawl of {} sites 1 hop out from starting point{reset}'.format(len(new_links), **ANSI))
+    print('{lightred}[*] Starting crawl of {} sites 1 hop out from starting point{reset}'.format(len(new_links), **ANSI))
 
 
 ### Indexing Stage
 ### Indexing Stage
 
 

+ 1 - 1
archivebox/core/admin.py

@@ -49,7 +49,7 @@ class SnapshotAdmin(admin.ModelAdmin):
             '<a href="/{}/{}">📼 </a> '
             '<a href="/{}/{}">📼 </a> '
             '<a href="/{}/{}">📦 </a> '
             '<a href="/{}/{}">📦 </a> '
             '<a href="/{}/{}">🏛 </a> '
             '<a href="/{}/{}">🏛 </a> '
-            '</span>'
+            '</span><br/>'
             '<a href="/{}">{}</a>',
             '<a href="/{}">{}</a>',
             obj.archive_path, canon['wget_path'] or '',
             obj.archive_path, canon['wget_path'] or '',
             obj.archive_path, canon['pdf_path'],
             obj.archive_path, canon['pdf_path'],

+ 5 - 2
archivebox/core/forms.py

@@ -1,7 +1,10 @@
 from django import forms
 from django import forms
 
 
-CHOICES = (('url', 'URL'), ('feed', 'Feed'))
+CHOICES = (
+    ('0', 'depth=0 (archive just this url)'),
+    ('1', 'depth=1 (archive this url and all sites one link away)'),
+)
 
 
 class AddLinkForm(forms.Form):
 class AddLinkForm(forms.Form):
     url = forms.URLField()
     url = forms.URLField()
-    source = forms.ChoiceField(choices=CHOICES, widget=forms.RadioSelect, initial='url')
+    depth = forms.ChoiceField(choices=CHOICES, widget=forms.RadioSelect, initial='0')

+ 2 - 2
archivebox/core/views.py

@@ -66,9 +66,9 @@ class AddLinks(View):
         if form.is_valid():
         if form.is_valid():
             url = form.cleaned_data["url"]
             url = form.cleaned_data["url"]
             print(f'[+] Adding URL: {url}')
             print(f'[+] Adding URL: {url}')
-            depth = 0 if form.cleaned_data["source"] == "url" else 1
+            depth = 0 if form.cleaned_data["depth"] == "0" else 0
             input_kwargs = {
             input_kwargs = {
-                "url": url,
+                "urls": url,
                 "depth": depth,
                 "depth": depth,
                 "update_all": False,
                 "update_all": False,
                 "out_dir": OUTPUT_DIR,
                 "out_dir": OUTPUT_DIR,

+ 0 - 1
archivebox/extractors/git.py

@@ -56,7 +56,6 @@ def save_git(link: Link, out_dir: Optional[str]=None, timeout: int=TIMEOUT) -> A
     cmd = [
     cmd = [
         GIT_BINARY,
         GIT_BINARY,
         'clone',
         'clone',
-        # '--mirror',
         '--recursive',
         '--recursive',
         *([] if CHECK_SSL_VALIDITY else ['-c', 'http.sslVerify=false']),
         *([] if CHECK_SSL_VALIDITY else ['-c', 'http.sslVerify=false']),
         without_query(without_fragment(link.url)),
         without_query(without_fragment(link.url)),

+ 1 - 1
archivebox/themes/default/add_links.html

@@ -212,7 +212,7 @@
             </form>
             </form>
         </center>
         </center>
 
 
-        <a href="{% url 'admin:core_snapshot_changelist' %}">Go back to Snapshot list</a>
+        <a href="{% url 'admin:core_snapshot_changelist' %}">Go back to Main Index</a>
         
         
     </body>
     </body>
 </html>
 </html>