aboutsummaryrefslogtreecommitdiffstats
path: root/edaweb
diff options
context:
space:
mode:
Diffstat (limited to 'edaweb')
-rw-r--r--edaweb/app.py4
-rw-r--r--edaweb/database.py4
-rw-r--r--edaweb/services.py14
-rwxr-xr-xedaweb/static/images/GZhgzaK.pngbin0 -> 124272 bytes
-rwxr-xr-xedaweb/static/images/GegzRla.pngbin0 -> 44635 bytes
-rwxr-xr-xedaweb/static/images/JwL2S2V.pngbin0 -> 120751 bytes
-rwxr-xr-xedaweb/static/images/aLvcFjj.pngbin0 -> 23224 bytes
-rwxr-xr-xedaweb/static/images/iKVCEoy.pngbin0 -> 97879 bytes
-rwxr-xr-xedaweb/static/images/rOJXmjG.pngbin0 -> 101799 bytes
-rwxr-xr-xedaweb/static/images/v2Yfoou.jpgbin0 -> 165128 bytes
-rwxr-xr-xedaweb/static/images/wxbKYVv.pngbin0 -> 123728 bytes
-rw-r--r--edaweb/static/index.md2
-rw-r--r--edaweb/static/robots.txt7
13 files changed, 21 insertions, 10 deletions
diff --git a/edaweb/app.py b/edaweb/app.py
index 6902fe4..436df7a 100644
--- a/edaweb/app.py
+++ b/edaweb/app.py
@@ -17,7 +17,7 @@ import io
app = flask.Flask(__name__)
CONFIG = configparser.ConfigParser(interpolation = None)
-CONFIG.read("edaweb.conf")
+CONFIG.read(os.path.join(os.path.dirname(__file__), "edaweb.conf"))
shown_images = set()
shown_sidebar_images = set()
@@ -224,7 +224,7 @@ def serve_random():
sbi = services.get_random_image(tags)
req = urllib.request.Request(sbi.imurl)
mediaContent = urllib.request.urlopen(req).read()
- with open(os.path.join("static", "images", "random.jpg"), "wb") as f:
+ with open(os.path.join(os.path.dirname(__file__), "static", "images", "random.jpg"), "wb") as f:
f.write(mediaContent)
with database.Database() as db:
diff --git a/edaweb/database.py b/edaweb/database.py
index dab56e7..49ec33c 100644
--- a/edaweb/database.py
+++ b/edaweb/database.py
@@ -44,7 +44,7 @@ class Database:
def get_header_links(self):
with self.__connection.cursor() as cursor:
- cursor.execute("SELECT name, link FROM headerLinks ORDER BY name;")
+ cursor.execute("SELECT name, link FROM headerLinks WHERE display = true ORDER BY name;")
return cursor.fetchall()
def get_image(self, imageName):
@@ -64,7 +64,7 @@ class Database:
def get_header_articles(self):
with self.__connection.cursor() as cursor:
- cursor.execute("SELECT articleName, link FROM headerArticles;")
+ cursor.execute("SELECT articleName, link FROM headerArticles WHERE display = true;")
return cursor.fetchall()
def get_all_categories(self):
diff --git a/edaweb/services.py b/edaweb/services.py
index 87af050..5506ef1 100644
--- a/edaweb/services.py
+++ b/edaweb/services.py
@@ -247,7 +247,7 @@ def parse_tweet(tweet_url):
return dt, replying_to, text, images
-def scrape_whispa(whispa_url, since):
+def scrape_whispa(whispa_url, since = None):
tree = html.fromstring(requests.get(whispa_url).content.decode())
qnas = []
# we're not doing proper HTML scraping here really... since the site uses client side rendering
@@ -257,6 +257,9 @@ def scrape_whispa(whispa_url, since):
if "receivedFeedback" in js:
# my god this is horrible...
for j in json.loads(json.loads(js[19:-1])[1][2:])[0][3]["loadedUser"]["receivedFeedback"]:
+ if j["childFeedback"] == []:
+ continue
+
dt = datetime.datetime.fromisoformat(j["childFeedback"][0]["createdAt"][:-1])
qnas.append({
@@ -336,7 +339,7 @@ def get_torrent_stats():
"Uploaded:": humanbytes(s["cumulative-stats"]["uploadedBytes"]),
"Active time:": str(datetime.timedelta(seconds = s["cumulative-stats"]["secondsActive"])),
"Files added:": s["cumulative-stats"]["filesAdded"],
- "Current upload speed": humanbytes(s["uploadSpeed"]) + "s/S",
+ "Current upload speed:": humanbytes(s["uploadSpeed"]) + "s/S",
"Current download speed:": humanbytes(s["downloadSpeed"]) + "s/S"
}
@@ -359,7 +362,8 @@ def get_recent_commits(db, max_per_repo = 3):
return sorted(out, key = lambda a: a["datetime"], reverse = True)
if __name__ == "__main__":
- import database
+ print(scrape_whispa(CONFIG.get("qnas", "url")))
+ # import database
- with database.Database() as db:
- print(json.dumps(get_recent_commits(db), indent=4))
+ # with database.Database() as db:
+ # print(json.dumps(get_recent_commits(db), indent=4))
diff --git a/edaweb/static/images/GZhgzaK.png b/edaweb/static/images/GZhgzaK.png
new file mode 100755
index 0000000..c73e8b4
--- /dev/null
+++ b/edaweb/static/images/GZhgzaK.png
Binary files differ
diff --git a/edaweb/static/images/GegzRla.png b/edaweb/static/images/GegzRla.png
new file mode 100755
index 0000000..cf12555
--- /dev/null
+++ b/edaweb/static/images/GegzRla.png
Binary files differ
diff --git a/edaweb/static/images/JwL2S2V.png b/edaweb/static/images/JwL2S2V.png
new file mode 100755
index 0000000..9394c56
--- /dev/null
+++ b/edaweb/static/images/JwL2S2V.png
Binary files differ
diff --git a/edaweb/static/images/aLvcFjj.png b/edaweb/static/images/aLvcFjj.png
new file mode 100755
index 0000000..c928ba7
--- /dev/null
+++ b/edaweb/static/images/aLvcFjj.png
Binary files differ
diff --git a/edaweb/static/images/iKVCEoy.png b/edaweb/static/images/iKVCEoy.png
new file mode 100755
index 0000000..05d6d70
--- /dev/null
+++ b/edaweb/static/images/iKVCEoy.png
Binary files differ
diff --git a/edaweb/static/images/rOJXmjG.png b/edaweb/static/images/rOJXmjG.png
new file mode 100755
index 0000000..58a4ae4
--- /dev/null
+++ b/edaweb/static/images/rOJXmjG.png
Binary files differ
diff --git a/edaweb/static/images/v2Yfoou.jpg b/edaweb/static/images/v2Yfoou.jpg
new file mode 100755
index 0000000..f3a3249
--- /dev/null
+++ b/edaweb/static/images/v2Yfoou.jpg
Binary files differ
diff --git a/edaweb/static/images/wxbKYVv.png b/edaweb/static/images/wxbKYVv.png
new file mode 100755
index 0000000..75feb10
--- /dev/null
+++ b/edaweb/static/images/wxbKYVv.png
Binary files differ
diff --git a/edaweb/static/index.md b/edaweb/static/index.md
index a676d59..e6bf91d 100644
--- a/edaweb/static/index.md
+++ b/edaweb/static/index.md
@@ -26,6 +26,8 @@ these sites are hosted on my [homelab system](https://wiki.eda.gay)
## nice websites
- [wiby.me](http://wiby.me/) - search engine for old style websites with limited javascript (my site used to be on here but it got blacklisted for some reason?)
- [dysmorph.nekoweb.org](https://dysmorph.nekoweb.org/) - a site that is very based because it looks similar
+- [transsexual.org](https://web.archive.org/web/20010802032136/http://transsexual.org/Toon.html) - awesome and relatable transsexual comics from a website that's slightly older than me
+- [norfolkchurches.co.uk](http://www.norfolkchurches.co.uk/norwichintro.htm) - site about all the churches in norwich (and norfolk!), the city that has far too many medieval churches than it knows what to do with. this site is preciesly what the internet should be, the muted ramblings of someone with an expert knowledge on his preferred niche interest. without any javascript. nice if, like me, you have a middling interest in theology
- [boymoder.network](https://boymoder.network/) - website for boymoder awareness
- [4chan.org/lgbt/](https://boards.4channel.org/lgbt/) - but dont blame me if u catch brainworms
- [https://www.math.uni-bielefeld.de/~sillke/Twister/fun/elevator-fun90.html](https://www.math.uni-bielefeld.de/~sillke/Twister/fun/elevator-fun90.html) any website with a URL like this is gonna be good
diff --git a/edaweb/static/robots.txt b/edaweb/static/robots.txt
index c2aab7e..04154e9 100644
--- a/edaweb/static/robots.txt
+++ b/edaweb/static/robots.txt
@@ -1,2 +1,7 @@
User-agent: *
-Disallow: / \ No newline at end of file
+Allow: /
+User-agent: Googlebot-Image
+Disallow: *
+User-agent: *
+Disallow: /random*
+