many fixes and updates

This commit is contained in:
Joey Kimsey
2024-12-20 05:53:57 -05:00
parent e7ec79e727
commit 1496b855db
62 changed files with 1211 additions and 438 deletions

View File

@ -0,0 +1,64 @@
<div class="col-10 offset-md-1 context-main-bg p-4 my-5">
<legend class="text-center">Mobile Bookmarklet</legend>
<hr>
<div class="col-8 offset-2 ">
<div class="h5">
<p>
You can quickly and easily add bookmarks to your AllTheBookmarks account from any mobile device.
Since you can't use extensions on mobile, you can log in from your mobile device and visit this page.
</p>
<p>
Below is a code snippet that you can copy, then create a new bookmark on your mobile device as you would normally.
Before saving the bookmark, change the name to something simple like "ATB Bookmarker" and paste thiis code as the url.
</p>
<p>
Once you have the bookmarklet saved, you can simply go to your mobile bookmarks while on a page and this snippet will grab the info you need and add it to you account.
</p>
</div>
<div class="">
<pre lang="javascript">
javascript:(function() {
const apiKey = localStorage.getItem('notAnAuthToken');
const apiUrl = localStorage.getItem('api_url');
const name = prompt("Enter a name for the bookmark:");
const notes = prompt("Enter any notes (optional):");
const color = prompt("Enter a color (optional):");
const privacy = prompt("Enter privacy level (e.g., public/private):");
const folder = prompt("Enter a folder (optional):");
const url = window.location.href;
if (!apiKey) {
alert("You must sign in to obtain an auth token.");
return;
}
if (!name) {
alert("Name is required.");
return;
}
fetch(apiUrl + 'api/bookmarks/create', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify({ name, url, notes, color, privacy, folder })
})
.then(response => {
if (response.ok) {
alert("Bookmark saved successfully!");
} else {
alert("Failed to save bookmark. Please check your API key.");
}
})
.catch(error => {
console.error(error);
alert("An unknown error occurred while saving the bookmark.");
});
})();
</pre>
</div>
</div>
</div>