summaryrefslogtreecommitdiff
path: root/make_bookmarklet/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'make_bookmarklet/index.php')
-rw-r--r--make_bookmarklet/index.php36
1 files changed, 0 insertions, 36 deletions
diff --git a/make_bookmarklet/index.php b/make_bookmarklet/index.php
deleted file mode 100644
index 67dea14..0000000
--- a/make_bookmarklet/index.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-error_reporting(E_ALL);
-
-$config = require_once(__DIR__.'/../config.php');
-
-$booklet = <<< EOF_JS
-javascript: (() => {
- async function bookmarkPage(page) {
- const response = await fetch('{$config['site']}/add/', {
- method: 'POST',
- mode: 'cors',
- cache: 'no-cache',
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Authorization': 'Bearer {$config['bearer_token']}',
- },
- redirect: 'follow',
- referrerPolicy: 'no-referrer',
- body: page
- });
- return response;
- }
-
- bookmarkPage(`url=\${encodeURIComponent(window.location.href)}`)
- .then(data => {
- if (data.status === 201) {
- alert('Page bookmarked');
- } else {
- alert(`Failed with status \${data.status} \${data.statusText}`);
- }
- });
-})();
-EOF_JS;
-
-echo $booklet;