diff --git a/src/digimarks/bookmarks_service.py b/src/digimarks/bookmarks_service.py index 0d02875..6fa6814 100644 --- a/src/digimarks/bookmarks_service.py +++ b/src/digimarks/bookmarks_service.py @@ -39,6 +39,7 @@ async def set_information_from_source(bookmark: Bookmark, request: Request) -> B str(bookmark.url), headers={'User-Agent': DIGIMARKS_USER_AGENT} ) bookmark.http_status = result.status_code + logger.info('HTTP status code %s for %s', bookmark.http_status, bookmark.url) except httpx.HTTPError as err: # For example, "MissingSchema: Invalid URL 'abc': No schema supplied. Perhaps you meant http://abc?" logger.error('Exception when trying to retrieve title for %s. Error: %s', bookmark.url, str(err)) @@ -60,8 +61,8 @@ async def set_information_from_source(bookmark: Bookmark, request: Request) -> B # with open(filename, 'wb') as out_file: # shutil.copyfileobj(response.raw, out_file) - # Extraction was successful - logger.info('Extracting information was successful') + # Extraction was successful + logger.info('Extracting information was successful') return bookmark diff --git a/src/digimarks/static/js/digimarks.js b/src/digimarks/static/js/digimarks.js index 17866ee..58c56db 100644 --- a/src/digimarks/static/js/digimarks.js +++ b/src/digimarks/static/js/digimarks.js @@ -219,12 +219,13 @@ document.addEventListener('alpine:init', () => { 'title': '', 'note': '', 'tags': '', + 'http_status': 0, 'strip_params': false } }, async startAddingBookmark() { /* Open 'add bookmark' page */ - console.log('Start adding bookmark'); + console.log('Open "add bookmark" modal'); this.resetEditBookmark(); // this.show_bookmark_details = true; const editFormDialog = document.getElementById("editFormDialog"); @@ -254,20 +255,19 @@ document.addEventListener('alpine:init', () => { console.log('Got response'); console.log(response); console.log(data); - if (data.ok) { + if (response.ok) { this.bookmarkToEdit.url_hash = data.url_hash; this.bookmarkToEdit.url = data.url; this.bookmarkToEdit.title = data.title; this.bookmarkToEdit.note = data.note; this.bookmarkToEdit.tags = data.tags; + this.bookmarkToEdit.http_status = data.http_status; } else { console.log('Error occurred'); this.bookmarkToEditError = data.detail; } - // this.bookmarkToEditError = 'lolwut'; } catch (error) { - // enter your logic for when there is an error (ex. error toast) - + // enter logic for when there is an error (ex. error toast) console.log('error occurred'); console.log(error); this.bookmarkToEditError = error.detail; diff --git a/src/digimarks/templates/user_index.html b/src/digimarks/templates/user_index.html index d8ce269..dba9566 100644 --- a/src/digimarks/templates/user_index.html +++ b/src/digimarks/templates/user_index.html @@ -192,6 +192,10 @@ +

+