diff options
| author | Bobby <[email protected]> | 2024-02-11 21:59:21 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-02-11 21:59:21 -0500 |
| commit | 5c0b62ad493b629142f722b2f84c91071153350a (patch) | |
| tree | 63ebfd0404162cc32be81f4efd42136d7a711f96 | |
| parent | 89d1ae0c3579112bd5ea1a868a1d95c7a75314c7 (diff) | |
| download | thatcomputerscientist-5c0b62ad493b629142f722b2f84c91071153350a.tar.xz thatcomputerscientist-5c0b62ad493b629142f722b2f84c91071153350a.zip | |
Direct Socialify Integration
| -rw-r--r-- | ignis/views.py | 19 | ||||
| -rw-r--r-- | templates/dev_status/repo.html | 4 |
2 files changed, 3 insertions, 20 deletions
diff --git a/ignis/views.py b/ignis/views.py index 32c060e7..d6bd7faf 100644 --- a/ignis/views.py +++ b/ignis/views.py @@ -1,6 +1,6 @@ import json from io import BytesIO -import os + import requests from captcha.image import ImageCaptcha from django.core.files.base import ContentFile @@ -184,28 +184,11 @@ def socialify(request): url = 'https://socialify.thatcomputerscientist.com/{}/png?description={}&font={}&forks={}&issues={}&language={}&language2={}&name={}&owner=1&pattern={}&pulls={}&stargazers={}&theme={}'.format(repo, description, font, forks, issues, language_1, language_2, name, pattern, pulls, stargazers, theme) - image_unique_name = url.replace('https://socialify.thatcomputerscientist.com/', '').replace('/', '_') - image_path = 'images/repo_socialify_cache' - image_path = '{}/{}.png'.format(image_path, image_unique_name) - - if repo.split('/')[0] == 'luciferreeves': - if os.path.exists(image_path): - with open(image_path, 'rb') as f: - image = f.read() - return HttpResponse(image, content_type='image/png') - req = requests.get(url) image = req.content status = req.status_code if status == 200: - if not os.path.exists('images/repo_socialify_cache'): - os.makedirs('images/repo_socialify_cache') - - with open(image_path, 'wb') as f: - if repo.split('/')[0] == 'luciferreeves': - f.write(image) - return HttpResponse(image, content_type='image/png') else: with open('static/images/site/utgi.gif', 'rb') as f: diff --git a/templates/dev_status/repo.html b/templates/dev_status/repo.html index 7769b03f..59ca7b0d 100644 --- a/templates/dev_status/repo.html +++ b/templates/dev_status/repo.html @@ -1,7 +1,7 @@ {% extends 'blog/partials/base.html' %} {% block content %} {% load static %} <img - style="width: 730px" - src="{% url 'ignis:socialify' %}?repo=luciferreeves/{{repo}}&theme=Dark&font=Koho&pattern=Floating%20Cogs&name=1&description=0&language_1=1&language_2=1&stargazers=1&forks=1&issues=1&pulls=1" + style="width: 730px; display: block; margin: 40px auto 20px auto" + src="https://socialify.thatcomputerscientist.com/luciferreeves/{{repo}}/png?font=KoHo&forks=1&issues=1&language=1&language2=1&pattern=Circuit%20Board&pulls=1&stargazers=1&theme=Dark" alt="Socialify" /> {% if parent is not None %} |
