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 /ignis | |
| parent | 89d1ae0c3579112bd5ea1a868a1d95c7a75314c7 (diff) | |
| download | thatcomputerscientist-5c0b62ad493b629142f722b2f84c91071153350a.tar.xz thatcomputerscientist-5c0b62ad493b629142f722b2f84c91071153350a.zip | |
Direct Socialify Integration
Diffstat (limited to 'ignis')
| -rw-r--r-- | ignis/views.py | 19 |
1 files changed, 1 insertions, 18 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: |
