Skip to content

Commit

Permalink
Raise quality of globaleaks logo visualization on scaling
Browse files Browse the repository at this point in the history
  • Loading branch information
evilaliv3 committed Jul 14, 2020
1 parent a5bbc03 commit f6774d3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 0 additions & 1 deletion backend/globaleaks/handlers/admin/tenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def db_initialize_tenant(session, tenant, mode):

if mode == 'default':
file_descs = [
('logo', 'data/logo.png'),
('favicon', 'data/favicon.ico')
]

Expand Down
4 changes: 4 additions & 0 deletions backend/globaleaks/handlers/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ def get(self, name):
x = yield tw(db_get_file, 1, name)

self.request.setHeader(b'Content-Type', appfiles[name])

if not x and name == 'logo':
x = b'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='

x = base64.b64decode(x)
returnValue(x)
else:
Expand Down
4 changes: 2 additions & 2 deletions backend/globaleaks/handlers/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def db_serialize_node(session, tid, language):
ret_dict['languages_enabled'] = models.EnabledLanguage.list(session, tid) if node_dict['wizard_done'] else list(LANGUAGES_SUPPORTED_CODES)
ret_dict['languages_supported'] = LANGUAGES_SUPPORTED

records = session.query(models.File.id, models.File.data).filter(models.File.tid == tid, models.File.id.in_(['css', 'script']))
records = session.query(models.File.id, models.File.data).filter(models.File.tid == tid, models.File.id.in_(['css', 'logo', 'script']))
for x in records:
ret_dict[x[0]] = True

Expand All @@ -187,7 +187,7 @@ def db_serialize_node(session, tid, language):
ret_dict['disclaimer_title'] = root_tenant_l10n.get_val('disclaimer_title', language)
ret_dict['disclaimer_text'] = root_tenant_l10n.get_val('disclaimer_text', language)

records = session.query(models.File.id, models.File.data).filter(models.File.tid == 1, models.File.id.in_(['css', 'script']))
records = session.query(models.File.id, models.File.data).filter(models.File.tid == 1, models.File.id.in_(['css', 'logo', 'script']))
for x in records:
if not ret_dict.get(x[0]):
ret_dict[x[0]] = True
Expand Down
5 changes: 5 additions & 0 deletions client/app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ table {
vertical-align: middle;
}

.default-logo {
height: 3rem;
width: 3rem;
}

[dir="ltr"] #LogoBox {
margin: 0 1rem 0 0;
}
Expand Down
2 changes: 1 addition & 1 deletion client/app/views/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="HeaderBox">
<div class="row clearfix">
<div class="col-md-8 float-left">
<span id="LogoBox" data-ng-click="setHomepage()"><img class="img-fluid" alt="project logo" src="s/logo" /></span><span id="TitleBox">{{pt}}</span>
<span id="LogoBox" data-ng-click="setHomepage()"><img data-ng-if="!public.node.logo" class="default-logo" alt="globaleaks logo" src="data/logo.png" /><img data-ng-if="public.node.logo" class="img-fluid'" alt="project logo" src="s/logo" /></span><span id="TitleBox">{{pt}}</span>
</div>
<div class="col-md-4 float-right">
<span id="UserBox" class="float-right" data-ng-include="'views/partials/user.html'"></span>
Expand Down

0 comments on commit f6774d3

Please sign in to comment.