diff options
| -rwxr-xr-x | .gitignore | 6 | ||||
| -rw-r--r-- | .gitmodules | 4 | ||||
| -rwxr-xr-x | Dockerfile | 6 | ||||
| -rwxr-xr-x | Dockerfile_cron | 11 | ||||
| -rw-r--r-- | cron_entrypoint.sh | 6 | ||||
| -rwxr-xr-x | docker-compose.yml | 43 | ||||
| -rw-r--r-- | edaweb/app.py | 4 | ||||
| -rw-r--r-- | edaweb/database.py | 4 | ||||
| -rw-r--r-- | edaweb/services.py | 14 | ||||
| -rwxr-xr-x | edaweb/static/images/GZhgzaK.png | bin | 0 -> 124272 bytes | |||
| -rwxr-xr-x | edaweb/static/images/GegzRla.png | bin | 0 -> 44635 bytes | |||
| -rwxr-xr-x | edaweb/static/images/JwL2S2V.png | bin | 0 -> 120751 bytes | |||
| -rwxr-xr-x | edaweb/static/images/aLvcFjj.png | bin | 0 -> 23224 bytes | |||
| -rwxr-xr-x | edaweb/static/images/iKVCEoy.png | bin | 0 -> 97879 bytes | |||
| -rwxr-xr-x | edaweb/static/images/rOJXmjG.png | bin | 0 -> 101799 bytes | |||
| -rwxr-xr-x | edaweb/static/images/v2Yfoou.jpg | bin | 0 -> 165128 bytes | |||
| -rwxr-xr-x | edaweb/static/images/wxbKYVv.png | bin | 0 -> 123728 bytes | |||
| -rw-r--r-- | edaweb/static/index.md | 2 | ||||
| -rw-r--r-- | edaweb/static/robots.txt | 7 | ||||
| -rw-r--r-- | entrypoint.sh | 6 | ||||
| -rw-r--r-- | homelab-wiki/Dockerfile | 2 | ||||
| -rw-r--r-- | homelab-wiki/LocalSettings.php | 15 | ||||
| m--------- | nitter/nitter | 0 | ||||
| -rwxr-xr-x | scripts/export.sh | 2 | ||||
| -rwxr-xr-x | scripts/update.sh | 2 |
25 files changed, 91 insertions, 43 deletions
@@ -2,10 +2,10 @@ *.pub homelab-wiki/wiki.env homelab-wiki/images/* -edaweb.conf +*edaweb.conf markdowns/ -static/images/random.jpg -static/zips/*.zip +*random.jpg +*.zip .nfs* static/images/Thumbs.db nitter/nitter.conf diff --git a/.gitmodules b/.gitmodules index 1b086ba..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +0,0 @@ -[submodule "nitter/nitter"] - path = nitter/nitter - url = git@github.com:zedeus/nitter.git - branch = guest_accounts @@ -1,14 +1,12 @@ -FROM ubuntu:22.10 +FROM ubuntu:jammy-20250404 MAINTAINER Eden Attenborough "eden.attenborough@outlook.com" ENV TZ=Europe/London RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update -y -RUN apt-get install -y python3-pip python3-dev build-essential clang libffi-dev libxml2-dev libxslt-dev libjpeg-dev zlib1g-dev tmux cron +RUN apt-get install -y python3-pip python3-dev build-essential clang libffi-dev libxml2-dev libxslt-dev libjpeg-dev zlib1g-dev COPY . /app WORKDIR /app RUN pip3 install -r requirements.txt -RUN echo "*/30 * * * * root python3 /app/edaweb/cache.py > /proc/1/fd/1 2>/proc/1/fd/2" > /etc/crontab - ENTRYPOINT ["bash"] CMD ["entrypoint.sh"] diff --git a/Dockerfile_cron b/Dockerfile_cron new file mode 100755 index 0000000..dea3208 --- /dev/null +++ b/Dockerfile_cron @@ -0,0 +1,11 @@ +FROM reg.reaweb.uk/edaweb +MAINTAINER Eden Attenborough "eden.attenborough@outlook.com" +ENV TZ=Europe/London +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get update -y +RUN apt-get install -y tmux cron + +RUN echo "*/30 * * * * root python3 /app/edaweb/cache.py > /proc/1/fd/1 2>/proc/1/fd/2" > /etc/crontab + +ENTRYPOINT ["bash"] +CMD ["cron_entrypoint.sh"] diff --git a/cron_entrypoint.sh b/cron_entrypoint.sh new file mode 100644 index 0000000..2d98169 --- /dev/null +++ b/cron_entrypoint.sh @@ -0,0 +1,6 @@ +rm -rvf /app/edaweb/edaweb.conf/ +ln -s /app/edaweb.conf /app/edaweb/edaweb.conf +printenv | grep -v "no_proxy" >> /etc/environment +# tmux new-session -d -s "cron" 'cron -f || bash && bash'; +cron -f + diff --git a/docker-compose.yml b/docker-compose.yml index 3d5c58e..01bf365 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3' services: edaweb: build: @@ -7,14 +6,34 @@ services: image: reg.reaweb.uk/edaweb volumes: - /tmp/:/media/ISOs/ - - ./static/:/app/static/ + - ./edaweb/static/:/app/edaweb/static/ - ./edaweb.conf:/app/edaweb.conf - - ./edaweb-docker.pem:/keys/docker-key.pem + - edaweb-tmp:/tmp/ ports: - "6969:6969" + external_links: + - mariadb:mysql + - transmission_1:transmission + mac_address: 44:c8:09:a7:d0:93 + networks: + db-network: + rr-net: + ipv4_address: "192.168.23.13" + restart: unless-stopped + + edaweb_cron: + build: + context: . + dockerfile: Dockerfile_cron + image: reg.reaweb.uk/edaweb_cron + volumes: + - /tmp/:/media/ISOs/ + - ./edaweb/static/:/app/edaweb/static/ + - ./edaweb.conf:/app/edaweb.conf + - ./edaweb-docker.pem:/keys/docker-key.pem + - edaweb-tmp:/tmp/ networks: - db-network - - edaweb-net external_links: - mariadb:mysql restart: unless-stopped @@ -33,17 +52,19 @@ services: - "6970:80" networks: - db-network - - edaweb-net external_links: - mariadb:mysql restart: unless-stopped -networks: - edaweb-net: - external: - name: edaweb-net +volumes: + edaweb-tmp: +networks: db-network: - external: - name: mariadb + external: true + name: mariadb + + rr-net: + external: true + name: rr-net 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 Binary files differnew file mode 100755 index 0000000..c73e8b4 --- /dev/null +++ b/edaweb/static/images/GZhgzaK.png diff --git a/edaweb/static/images/GegzRla.png b/edaweb/static/images/GegzRla.png Binary files differnew file mode 100755 index 0000000..cf12555 --- /dev/null +++ b/edaweb/static/images/GegzRla.png diff --git a/edaweb/static/images/JwL2S2V.png b/edaweb/static/images/JwL2S2V.png Binary files differnew file mode 100755 index 0000000..9394c56 --- /dev/null +++ b/edaweb/static/images/JwL2S2V.png diff --git a/edaweb/static/images/aLvcFjj.png b/edaweb/static/images/aLvcFjj.png Binary files differnew file mode 100755 index 0000000..c928ba7 --- /dev/null +++ b/edaweb/static/images/aLvcFjj.png diff --git a/edaweb/static/images/iKVCEoy.png b/edaweb/static/images/iKVCEoy.png Binary files differnew file mode 100755 index 0000000..05d6d70 --- /dev/null +++ b/edaweb/static/images/iKVCEoy.png diff --git a/edaweb/static/images/rOJXmjG.png b/edaweb/static/images/rOJXmjG.png Binary files differnew file mode 100755 index 0000000..58a4ae4 --- /dev/null +++ b/edaweb/static/images/rOJXmjG.png diff --git a/edaweb/static/images/v2Yfoou.jpg b/edaweb/static/images/v2Yfoou.jpg Binary files differnew file mode 100755 index 0000000..f3a3249 --- /dev/null +++ b/edaweb/static/images/v2Yfoou.jpg diff --git a/edaweb/static/images/wxbKYVv.png b/edaweb/static/images/wxbKYVv.png Binary files differnew file mode 100755 index 0000000..75feb10 --- /dev/null +++ b/edaweb/static/images/wxbKYVv.png 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*
+
diff --git a/entrypoint.sh b/entrypoint.sh index 335ad66..f8664f0 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,5 @@ +rm -rvf /app/edaweb/edaweb.conf/ +ln -s /app/edaweb.conf /app/edaweb/edaweb.conf printenv | grep -v "no_proxy" >> /etc/environment -tmux new-session -d -s "cron" 'cron -f || bash && bash'; -python3 /app/edaweb/app.py --production
\ No newline at end of file +#tmux new-session -d -s "cron" 'cron -f || bash && bash'; +python3 /app/edaweb/app.py --production diff --git a/homelab-wiki/Dockerfile b/homelab-wiki/Dockerfile index 445bcc3..62b1f60 100644 --- a/homelab-wiki/Dockerfile +++ b/homelab-wiki/Dockerfile @@ -1,4 +1,4 @@ -FROM mediawiki:1.39.3 +FROM mediawiki:1.43.3 ENV MW_HOME=/var/www/html diff --git a/homelab-wiki/LocalSettings.php b/homelab-wiki/LocalSettings.php index e3c1d5a..e8e5eb2 100644 --- a/homelab-wiki/LocalSettings.php +++ b/homelab-wiki/LocalSettings.php @@ -30,7 +30,7 @@ $wgMetaNamespace = "Eden's_Homelab_Wiki"; $wgScriptPath = ""; ## The protocol and server name to use in fully-qualified URLs -$wgServer = "https://wiki.eda.gay"; +$wgServer = "https://homelabwiki.boymoder.blog"; ## The URL path to static resources (images, scripts, etc.) $wgResourceBasePath = $wgScriptPath; @@ -159,7 +159,6 @@ wfLoadExtension( 'ParserFunctions' ); wfLoadExtension( 'PdfHandler' ); wfLoadExtension( 'Poem' ); wfLoadExtension( 'PortableInfobox' ); -wfLoadExtension( 'Renameuser' ); wfLoadExtension( 'ReplaceText' ); wfLoadExtension( 'Scribunto' ); wfLoadExtension( 'SecureLinkFixer' ); @@ -174,7 +173,11 @@ wfLoadExtension( 'WikiEditor' ); # End of automatically generated settings. # Add more configuration options below. -$wgShowDebug = false; -$wgDevelopmentWarnings = false; -$wgShowExceptionDetails = false; -$wgDebugToolbar = false; +# $wgShowDebug = false; +# $wgDevelopmentWarnings = false; +# $wgShowExceptionDetails = false; +# $wgDebugToolbar = false; + +$wgShowExceptionDetails = true; +$wgShowDBErrorBacktrace = true; +$wgShowSQLErrors = true; diff --git a/nitter/nitter b/nitter/nitter deleted file mode 160000 -Subproject fcd74e8048362fcf8284871ee067099e8de28a8 diff --git a/scripts/export.sh b/scripts/export.sh index c65a6e9..1d17cf1 100755 --- a/scripts/export.sh +++ b/scripts/export.sh @@ -9,4 +9,4 @@ read export_name echo "Exporting blog post " $id " to " $export_name touch $export_name -sudo docker run -it --entrypoint python3 -v "$(pwd)/edaweb.conf":/app/edaweb.conf -v "$(pwd)/$export_name":/app/$export_name --network mariadb --rm reg.reaweb.uk/edaweb /app/parser.py export -i $id -u root -o $export_name +sudo docker run -it --entrypoint python3 -v "$(pwd)/edaweb.conf":/app/edaweb/edaweb.conf -v "$(pwd)/$export_name":/app/$export_name --network mariadb --rm reg.reaweb.uk/edaweb /app/edaweb/parser.py export -i $id -u root -o $export_name diff --git a/scripts/update.sh b/scripts/update.sh index b082f18..fe225cb 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -3,4 +3,4 @@ echo -n "Input blog post ID to update: " read id -sudo docker run -it --entrypoint python3 -v "$(pwd)/edaweb.conf":/app/edaweb.conf -v "$(pwd)/$1":/app/$1 --network mariadb --rm reg.reaweb.uk/edaweb /app/parser.py update -i $id -u root -m $1 +sudo docker run -it --entrypoint python3 -v "$(pwd)/edaweb.conf":/app/edaweb/edaweb.conf -v "$(pwd)/$1":/app/$1 --network mariadb --rm reg.reaweb.uk/edaweb /app/edaweb/parser.py update -i $id -u root -m $1 |
