Merge pull request #440 from arabcoders/dev

Update bookmarklet URL and add note on mixed content
This commit is contained in:
Abdulmohsen 2025-10-13 19:24:28 +03:00 committed by GitHub
commit f91811ad50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

5
FAQ.md
View file

@ -61,11 +61,14 @@ or the `environment:` section in `compose.yaml` file.
## Simple bookmarklet
```javascript
javascript:(() => { const url = "https://ytptube.example.org"; const preset = "default"; const mUrl = new URL(url); mUrl.pathname = "/api/history"; fetch(mUrl, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ url: document.location.href, preset: preset }) }).then(res => alert(res.ok ? "URL sent!" : "Failed to send URL.")); })()
javascript:(() => { const url = "https://ytp.example.org"; const preset = "default"; const mUrl = new URL(url);mUrl.pathname="/api/history/add";mUrl.searchParams.set("url",document.location.href);mUrl.searchParams.set("preset",preset);fetch(mUrl,{method: "GET"}).then(j => j.json()).then(json =>alert(json.message)).catch(err =>alert(err)); })()
```
Change the the variable `url` and `preset` variables to match your YTPTube instance and preset name.
> [!NOTE]
> The bookmarklet should be served from https page, otherwise, some browsers will block the request. for mixed content.
## Browser stores
- For Firefox via [Firefox Store](https://addons.mozilla.org/en-US/firefox/addon/ytptube-extension/)