mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-16 13:08:03 +00:00
Merge branch 'devel' into 'master'
Merge in lastest devel Closes #55 and #53 See merge request oliver/ivatar!136
This commit is contained in:
20
README.md
20
README.md
@@ -1,5 +1,25 @@
|
||||
ivatar / libravatar
|
||||
===================
|
||||
|
||||
Pipeline and coverage status
|
||||
============================
|
||||
|
||||
[](https://git.linux-kernel.at/oliver/ivatar/commits/master)
|
||||
[](http://git.linux-kernel.at/oliver/ivatar/commits/master)
|
||||
|
||||
Reports / code documentation
|
||||
============================
|
||||
|
||||
- [Coverage HTML report](http://oliver.git.linux-kernel.at/ivatar)
|
||||
- [Code documentation (autogenerated, pycco)](http://oliver.git.linux-kernel.at/ivatar/pycco/)
|
||||
|
||||
Authors and contributors
|
||||
========================
|
||||
|
||||
Lead developer/Owner: Oliver Falk (aka ofalk or falko) - https://git.linux-kernel.at/oliver
|
||||
Operations: Michal Novotny (aka clime)
|
||||
QA: Tristan Le Guern (aka tleguern)
|
||||
Frontend developer: Niklas Poslovski (aka nipos)
|
||||
Organisation/Meeting moderation: Lars Kruse (aka sumpfralle)
|
||||
|
||||
Initial developer: François Marier - https://fmarier.org/
|
||||
|
||||
@@ -187,3 +187,7 @@ CACHES = {
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
# This is 5 minutes caching for generated/resized images,
|
||||
# so the sites don't hit ivatar so much
|
||||
CACHE_IMAGES_MAX_AGE = 5 * 60
|
||||
|
||||
@@ -816,12 +816,16 @@ class UploadLibravatarExportView(SuccessMessageMixin, FormView):
|
||||
|
||||
def form_valid(self, form):
|
||||
data = self.request.FILES['export_file']
|
||||
items = libravatar_read_gzdata(data.read())
|
||||
# DEBUG print(items)
|
||||
return render(self.request, 'choose_libravatar_export.html', {
|
||||
'emails': items['emails'],
|
||||
'photos': items['photos'],
|
||||
})
|
||||
try:
|
||||
items = libravatar_read_gzdata(data.read())
|
||||
# DEBUG print(items)
|
||||
return render(self.request, 'choose_libravatar_export.html', {
|
||||
'emails': items['emails'],
|
||||
'photos': items['photos'],
|
||||
})
|
||||
except Exception as e:
|
||||
messages.error(self.request, _('Unable to parse file: %s' % e))
|
||||
return HttpResponseRedirect(reverse_lazy('upload_export'))
|
||||
|
||||
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
|
||||
1
ivatar/static/css/climes.css
Normal file
1
ivatar/static/css/climes.css
Normal file
File diff suppressed because one or more lines are too long
6
ivatar/static/css/climes.less
Normal file
6
ivatar/static/css/climes.less
Normal file
@@ -0,0 +1,6 @@
|
||||
@import 'tortin.less';
|
||||
@bg-hero:#ff8800;
|
||||
|
||||
.btn {
|
||||
border-radius: 0px !important;
|
||||
}
|
||||
@@ -34,7 +34,6 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- TODO TODO TODO: I need better styling -->
|
||||
{% if result %}
|
||||
<hr/>
|
||||
<h2>The following servers will be used for your domain</h2>
|
||||
@@ -44,8 +43,8 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{% if result.avatar_server_http %}
|
||||
<a href="{{result.avatar_server_http}}">
|
||||
<h4>{{result.avatar_server_http}}</h4>
|
||||
<a href="http://{{result.avatar_server_http}}">
|
||||
<h4>http://{{result.avatar_server_http}}</h4>
|
||||
</a>
|
||||
{% if result.avatar_server_http_ipv4 %}
|
||||
<br><center>{{ result.avatar_server_http_ipv4 }}</center>
|
||||
@@ -66,8 +65,8 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
{% if result.avatar_server_https %}
|
||||
<a href="{{result.avatar_server_https}}">
|
||||
<h4>{{result.avatar_server_https}}</h4>
|
||||
<a href="https://{{result.avatar_server_https}}">
|
||||
<h4>https://{{result.avatar_server_https}}</h4>
|
||||
</a>
|
||||
{% if result.avatar_server_https_ipv4 %}
|
||||
<br><center>{{ result.avatar_server_https_ipv4 }}</center>
|
||||
|
||||
@@ -8,4 +8,5 @@ from . views import CheckView, CheckDomainView
|
||||
urlpatterns = [ # pylint: disable=invalid-name
|
||||
url('check/', CheckView.as_view(), name='tools_check'),
|
||||
url('check_domain/', CheckDomainView.as_view(), name='tools_check_domain'),
|
||||
url('check_domain$', CheckDomainView.as_view(), name='tools_check_domain'),
|
||||
]
|
||||
|
||||
@@ -22,6 +22,7 @@ import pagan
|
||||
from robohash import Robohash
|
||||
|
||||
from ivatar.settings import AVATAR_MAX_SIZE, JPEG_QUALITY, DEFAULT_AVATAR_SIZE
|
||||
from ivatar.settings import CACHE_IMAGES_MAX_AGE
|
||||
from . ivataraccount.models import ConfirmedEmail, ConfirmedOpenId
|
||||
from . ivataraccount.models import pil_format, file_format
|
||||
|
||||
@@ -147,9 +148,11 @@ class AvatarImageView(TemplateView):
|
||||
data = BytesIO()
|
||||
monsterdata.save(data, 'PNG', quality=JPEG_QUALITY)
|
||||
data.seek(0)
|
||||
return HttpResponse(
|
||||
response = HttpResponse(
|
||||
data,
|
||||
content_type='image/png')
|
||||
response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE
|
||||
return response
|
||||
|
||||
if str(default) == 'robohash':
|
||||
roboset = 'any'
|
||||
@@ -160,9 +163,11 @@ class AvatarImageView(TemplateView):
|
||||
data = BytesIO()
|
||||
robohash.img.save(data, format='png')
|
||||
data.seek(0)
|
||||
return HttpResponse(
|
||||
response = HttpResponse(
|
||||
data,
|
||||
content_type='image/png')
|
||||
response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE
|
||||
return response
|
||||
|
||||
if str(default) == 'retro':
|
||||
identicon = Identicon.render(kwargs['digest'])
|
||||
@@ -171,9 +176,11 @@ class AvatarImageView(TemplateView):
|
||||
img = img.resize((size, size), Image.ANTIALIAS)
|
||||
img.save(data, 'PNG', quality=JPEG_QUALITY)
|
||||
data.seek(0)
|
||||
return HttpResponse(
|
||||
response = HttpResponse(
|
||||
data,
|
||||
content_type='image/png')
|
||||
response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE
|
||||
return response
|
||||
|
||||
if str(default) == 'pagan':
|
||||
paganobj = pagan.Avatar(kwargs['digest'])
|
||||
@@ -181,9 +188,11 @@ class AvatarImageView(TemplateView):
|
||||
img = paganobj.img.resize((size, size), Image.ANTIALIAS)
|
||||
img.save(data, 'PNG', quality=JPEG_QUALITY)
|
||||
data.seek(0)
|
||||
return HttpResponse(
|
||||
response = HttpResponse(
|
||||
data,
|
||||
content_type='image/png')
|
||||
response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE
|
||||
return response
|
||||
|
||||
if str(default) == 'identicon':
|
||||
p = Pydenticon5()
|
||||
@@ -193,9 +202,11 @@ class AvatarImageView(TemplateView):
|
||||
data = BytesIO()
|
||||
img.save(data, 'PNG', quality=JPEG_QUALITY)
|
||||
data.seek(0)
|
||||
return HttpResponse(
|
||||
response = HttpResponse(
|
||||
data,
|
||||
content_type='image/png')
|
||||
response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE
|
||||
return response
|
||||
|
||||
if str(default) == 'mm' or str(default) == 'mp':
|
||||
# If mm is explicitly given, we need to catch that
|
||||
@@ -231,9 +242,11 @@ class AvatarImageView(TemplateView):
|
||||
obj.save()
|
||||
if imgformat == 'jpg':
|
||||
imgformat = 'jpeg'
|
||||
return HttpResponse(
|
||||
response = HttpResponse(
|
||||
data,
|
||||
content_type='image/%s' % imgformat)
|
||||
response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE
|
||||
return response
|
||||
|
||||
class GravatarProxyView(View):
|
||||
'''
|
||||
@@ -302,9 +315,11 @@ class GravatarProxyView(View):
|
||||
data = BytesIO(gravatarimagedata.read())
|
||||
img = Image.open(data)
|
||||
data.seek(0)
|
||||
return HttpResponse(
|
||||
response = HttpResponse(
|
||||
data.read(),
|
||||
content_type='image/%s' % file_format(img.format))
|
||||
response['Cache-Control'] = 'max-age=%i' % CACHE_IMAGES_MAX_AGE
|
||||
return response
|
||||
|
||||
except ValueError as exc:
|
||||
print('Value error: %s' % exc)
|
||||
|
||||
@@ -30,6 +30,10 @@ If you've got a proposal to discuss or prefer to write to us, you can join our <
|
||||
|
||||
You can also put short notices to our attention on <a href="http://identi.ca/libravatar" title="http://identi.ca/libravatar">Identica<a/> or <a href="http://twitter.com/libravatar" title="http://twitter.com/libravatar">Twitter</a>.
|
||||
|
||||
<h4>Mastodon</h4>
|
||||
|
||||
Our Mastodon profile is available on <a href="https://photog.social/@libravatar">https://photog.social/@libravatar</a>.
|
||||
|
||||
<h4>Email</h4>
|
||||
|
||||
Finally, if you need to email us: <a href="mailto:dev@libravatar.org" title="mailto:dev@libravatar.org">dev@libravatar.org</a>
|
||||
|
||||
Reference in New Issue
Block a user