From fd80fe6313f20ba6a4222fe7410d4bc052596f24 Mon Sep 17 00:00:00 2001 From: pqpetq <104282463+pqpetq@users.noreply.github.com> Date: Sun, 24 Apr 2022 09:22:12 -0400 Subject: [PATCH] fixes and additions (#230) * Update posts.py * Update readme.md * Update requirements.txt * Update requirements.txt Co-authored-by: Aevann1 <59999695+Aevann1@users.noreply.github.com> --- files/routes/posts.py | 15 +++++++++++---- readme.md | 8 +++++--- requirements.txt | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 2b341115d..7a03acacc 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1302,11 +1302,14 @@ def submit_post(v, sub=None): if post.url.startswith('https://old.reddit.com/r/'): rev = post.url.replace('https://old.reddit.com/', '') rev = f"* [unddit.com](https://unddit.com/{rev})\n" + elif post.url.startswith("https://old.reddit.com/u/"): + rev = post.url.replace('https://old.reddit.com/u/', '') + rev = f"* [camas.github.io](https://camas.github.io/reddit-search/#\u007b\"author\":\"{rev}\",\"resultSize\":100\u007d)\n" else: rev = '' newposturl = post.url if newposturl.startswith('/'): newposturl = f"{SITE_FULL}{newposturl}" - body += f"Snapshots:\n\n{rev}* [archive.org](https://web.archive.org/{newposturl})\n* [archive.ph](https://archive.ph/?url={quote(newposturl)}&run=1) (click to archive)\n\n" + body += f"Snapshots:\n\n{rev}* [archive.org](https://web.archive.org/{newposturl})\n* [archive.ph](https://archive.ph/?url={quote(newposturl)}&run=1) (click to archive)\n* [ghostarchive.org](https://ghostarchive.org/search?term={quote(newposturl)}) (click to archive)\n\n" gevent.spawn(archiveorg, newposturl) captured = [] @@ -1322,10 +1325,14 @@ def submit_post(v, sub=None): if f'**[{title}]({href})**:\n\n' not in body: body += f'**[{title}]({href})**:\n\n' - if href.startswith('https://old.reddit.com/'): + if href.startswith('https://old.reddit.com/r/'): body += f'* [unddit.com](https://unddit.com/{href.replace("https://old.reddit.com/", "")})\n' + if href.startswith('https://old.reddit.com/u/'): + rev = post.url.replace('https://old.reddit.com/u/', '') + body += f"* [camas.github.io](https://camas.github.io/reddit-search/#\u007b\"author\":\"{rev}\",\"resultSize\":100\u007d)\n" body += f'* [archive.org](https://web.archive.org/{href})\n' - body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)\n\n' + body += f'* [archive.ph](https://archive.ph/?url={quote(href)}&run=1) (click to archive)\n' + body += f'* [ghostarchive.org](https://ghostarchive.org/search?term={quote(href)}) (click to archive)\n\n' gevent.spawn(archiveorg, href) body_html = sanitize(body) @@ -1531,4 +1538,4 @@ def get_post_title(v): title = soup.find('title') if not title: abort(400) - return {"url": url, "title": title.string} \ No newline at end of file + return {"url": url, "title": title.string} diff --git a/readme.md b/readme.md index 0e03bbfa4..9e1e1bdcd 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,9 @@ This code runs https://rdrama.net and https://pcmemes.net [Docker installation](https://docs.docker.com/get-docker/) -2- Run the following commands in the terminal: +2 - If hosting on localhost and/or without HTTPS, change```"SESSION_COOKIE_SECURE"``` in ```__main__.py``` to "False" + +3- Run the following commands in the terminal: ``` git clone https://github.com/Aevann1/rDrama/ @@ -16,6 +18,6 @@ cd rDrama docker-compose up ``` -3- That's it! Visit `localhost` in your browser. +4- That's it! Visit `localhost` in your browser. -4- Optional: to change the domain from "localhost" to something else and configure the site settings, as well as integrate it with the external services the website uses, please edit the variables in the `env` file and then restart the docker container. \ No newline at end of file +5- Optional: to change the domain from "localhost" to something else and configure the site settings, as well as integrate it with the external services the website uses, please edit the variables in the `env` file and then restart the docker container. diff --git a/requirements.txt b/requirements.txt index 72acaa12c..bf19a09f5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,4 +25,4 @@ pusher_push_notifications pyenchant youtube-dl yattag -webptools \ No newline at end of file +webptools