From 80d9e02ea47bfb783cc2033162ae9231551e5654 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Tue, 9 Nov 2021 20:47:01 +0000 Subject: Delete files that are no longer needed --- make_bookmarklet/index.php | 36 --------------------------------- public/read/index.php | 33 ------------------------------ scripts/email_bookmarks.php | 49 --------------------------------------------- 3 files changed, 118 deletions(-) delete mode 100644 make_bookmarklet/index.php delete mode 100644 public/read/index.php delete mode 100644 scripts/email_bookmarks.php 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 @@ - { - 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; diff --git a/public/read/index.php b/public/read/index.php deleted file mode 100644 index 74bb4ed..0000000 --- a/public/read/index.php +++ /dev/null @@ -1,33 +0,0 @@ - $config['max_url_length']) { - respondAndExit(400, 'Bad Request'); -} - -$urls = file($config['path_to_file'], FILE_IGNORE_NEW_LINES); - -// Remove requested url from list if present. -$remaingUrls = array_diff($urls, [$requestedUrl]); - -// Count will not have changed if requested url doesn't exist in the list. -if (count($remaingUrls) === count($urls)) { - respondAndExit(404, 'Not Found'); -} - -if (!file_put_contents($config['path_to_file'], implode("\n", $remaingUrls)."\n")) { - respondAndExit(500, 'Internal Server Error'); -} - -respondAndExit(308, 'Permanent Redirect', ["Location: $requestedUrl"]); diff --git a/scripts/email_bookmarks.php b/scripts/email_bookmarks.php deleted file mode 100644 index 9a63d94..0000000 --- a/scripts/email_bookmarks.php +++ /dev/null @@ -1,49 +0,0 @@ - $email['from'], - 'MIME-Version' => '1.0', - 'Content-Type' => 'text/html; charset=UTF-8', - ] -); - -function buildMessage(array $urls, string $site): string -{ - $urls = array_map(function ($url) use ($site) { - return sprintf( - '
  • %s
  • ', - $site, - urlencode($url), - htmlentities($url) - ); - }, $urls); - - $urls = sprintf('
      %s
    ', implode('', $urls)); - - return <<< EOF_HTML - - -

    Below are today's bookmarks for reading.

    - $urls - - -EOF_HTML; -} -- cgit v1.2.3-13-gbd6f