mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon into main
commit
66ca660006
91
daemon.py
91
daemon.py
|
|
@ -1697,7 +1697,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self._write(msg.encode('utf-8'))
|
||||
return
|
||||
|
||||
if self.path.startswith('/about'):
|
||||
if self.path.endswith('/about'):
|
||||
if callingDomain.endswith('.onion'):
|
||||
msg = \
|
||||
htmlAbout(self.server.baseDir, 'http',
|
||||
|
|
@ -1840,36 +1840,6 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
self._benchmarkGETtimings(GETstartTime, GETtimings, 16)
|
||||
|
||||
# login screen background image
|
||||
if self.path == '/login-background.png':
|
||||
mediaFilename = \
|
||||
self.server.baseDir + '/accounts/login-background.png'
|
||||
if os.path.isfile(mediaFilename):
|
||||
if self._etag_exists(mediaFilename):
|
||||
# The file has not changed
|
||||
self._304()
|
||||
return
|
||||
|
||||
tries = 0
|
||||
mediaBinary = None
|
||||
while tries < 5:
|
||||
try:
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
break
|
||||
except Exception as e:
|
||||
print(e)
|
||||
time.sleep(1)
|
||||
tries += 1
|
||||
if mediaBinary:
|
||||
self._set_headers_etag(mediaFilename, 'image/png',
|
||||
mediaBinary, cookie,
|
||||
callingDomain)
|
||||
self._write(mediaBinary)
|
||||
return
|
||||
self._404()
|
||||
return
|
||||
|
||||
# QR code for account handle
|
||||
if '/users/' in self.path and \
|
||||
self.path.endswith('/qrcode.png'):
|
||||
|
|
@ -1941,33 +1911,40 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
self._benchmarkGETtimings(GETstartTime, GETtimings, 17)
|
||||
|
||||
# follow screen background image
|
||||
if self.path == '/follow-background.png':
|
||||
mediaFilename = \
|
||||
self.server.baseDir + '/accounts/follow-background.png'
|
||||
if os.path.isfile(mediaFilename):
|
||||
if self._etag_exists(mediaFilename):
|
||||
# The file has not changed
|
||||
self._304()
|
||||
return
|
||||
if '-background.' in self.path:
|
||||
for ext in ('webp', 'gif', 'jpg', 'png'):
|
||||
for bg in ('follow', 'options', 'login'):
|
||||
# follow screen background image
|
||||
if self.path.endswith('/' + bg + '-background.' + ext):
|
||||
bgFilename = \
|
||||
self.server.baseDir + '/accounts/' + \
|
||||
bg + '-background.' + ext
|
||||
if os.path.isfile(bgFilename):
|
||||
if self._etag_exists(bgFilename):
|
||||
# The file has not changed
|
||||
self._304()
|
||||
return
|
||||
|
||||
tries = 0
|
||||
mediaBinary = None
|
||||
while tries < 5:
|
||||
try:
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
break
|
||||
except Exception as e:
|
||||
print(e)
|
||||
time.sleep(1)
|
||||
tries += 1
|
||||
if mediaBinary:
|
||||
self._set_headers_etag(mediaFilename, 'image/png',
|
||||
mediaBinary, cookie,
|
||||
callingDomain)
|
||||
self._write(mediaBinary)
|
||||
return
|
||||
tries = 0
|
||||
bgBinary = None
|
||||
while tries < 5:
|
||||
try:
|
||||
with open(bgFilename, 'rb') as avFile:
|
||||
bgBinary = avFile.read()
|
||||
break
|
||||
except Exception as e:
|
||||
print(e)
|
||||
time.sleep(1)
|
||||
tries += 1
|
||||
if bgBinary:
|
||||
if ext == 'jpg':
|
||||
ext = 'jpeg'
|
||||
self._set_headers_etag(bgFilename,
|
||||
'image/' + ext,
|
||||
bgBinary, cookie,
|
||||
callingDomain)
|
||||
self._write(bgBinary)
|
||||
return
|
||||
self._404()
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,12 @@ a:link {
|
|||
}
|
||||
|
||||
.follow {
|
||||
background-image: url("follow-background.png");
|
||||
background-image: url("follow-background.jpg");
|
||||
background-size: cover;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
height: 100%;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,12 @@ body, html {
|
|||
background-color: var(--main-bg-color);
|
||||
color: var(--main-fg-color);
|
||||
|
||||
background-image: url("/login-background.png");
|
||||
background-image: url("/login-background.jpg");
|
||||
background-size: cover;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
height: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
max-width: 60%;
|
||||
|
|
@ -125,7 +130,12 @@ span.psw {
|
|||
background-color: var(--main-bg-color);
|
||||
color: var(--main-fg-color);
|
||||
|
||||
background-image: url("/login-background.png");
|
||||
background-image: url("/login-background.jpg");
|
||||
background-size: cover;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
height: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
max-width: 60%;
|
||||
|
|
@ -168,7 +178,12 @@ span.psw {
|
|||
background-color: var(--main-bg-color);
|
||||
color: var(--main-fg-color);
|
||||
|
||||
background-image: url("/login-background.png");
|
||||
background-image: url("/login-background.jpg");
|
||||
background-size: cover;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
height: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
max-width: 95%;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,232 @@
|
|||
@charset "UTF-8";
|
||||
|
||||
:root {
|
||||
--main-bg-color: #282c37;
|
||||
--link-bg-color: #282c37;
|
||||
--main-fg-color: #dddddd;
|
||||
--main-link-color: #999;
|
||||
--main-visited-color: #888;
|
||||
--border-color: #505050;
|
||||
--font-size-header: 18px;
|
||||
--font-color-header: #ccc;
|
||||
--font-size: 40px;
|
||||
--font-size2: 24px;
|
||||
--font-size3: 38px;
|
||||
--font-size4: 22px;
|
||||
--font-size5: 20px;
|
||||
--text-entry-foreground: #ccc;
|
||||
--text-entry-background: #111;
|
||||
--time-color: #aaa;
|
||||
--button-text: #FFFFFF;
|
||||
--button-background: #999;
|
||||
--button-selected: #666;
|
||||
--hashtag-margin: 2%;
|
||||
--hashtag-vertical-spacing1: 50px;
|
||||
--hashtag-vertical-spacing2: 100px;
|
||||
--hashtag-vertical-spacing3: 100px;
|
||||
--hashtag-vertical-spacing4: 150px;
|
||||
--hashtag-size1: 30px;
|
||||
--hashtag-size2: 40px;
|
||||
--follow-text-size1: 24px;
|
||||
--follow-text-size2: 40px;
|
||||
--follow-text-entry-width: 90%;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Bedstead';
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
font-display: block;
|
||||
src: url('./fonts/bedstead.otf') format('opentype');
|
||||
}
|
||||
|
||||
body, html {
|
||||
background-image: url("options-background.jpg");
|
||||
background-size: cover;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
background-color: var(--main-bg-color);
|
||||
color: var(--main-fg-color);
|
||||
|
||||
height: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
max-width: 100%;
|
||||
min-width: 600px;
|
||||
margin: 5% auto;
|
||||
}
|
||||
|
||||
a, u {
|
||||
color: var(--main-fg-color);
|
||||
}
|
||||
|
||||
a:visited{
|
||||
color: var(--main-visited-color);
|
||||
background: var(--link-bg-color);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color: var(--main-link-color);
|
||||
background: var(--link-bg-color);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.follow {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
background-color: var(--main-bg-color);
|
||||
}
|
||||
|
||||
.followAvatar {
|
||||
margin: 0% 0;
|
||||
}
|
||||
|
||||
.followAvatar img {
|
||||
border-radius: 10%;
|
||||
width: 20%;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.followText {
|
||||
font-size: var(--font-size);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.imText {
|
||||
font-size: var(--font-size4);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: var(--main-link-color);
|
||||
background: var(--link-bg-color);
|
||||
}
|
||||
|
||||
.pgp {
|
||||
font-size: var(--font-size5);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: var(--main-link-color);
|
||||
background: var(--link-bg-color);
|
||||
font-family: 'monospace';
|
||||
}
|
||||
|
||||
.button {
|
||||
border-radius: 4px;
|
||||
background-color: var(--button-background);
|
||||
border: none;
|
||||
color: var(--button-text);
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
font-size: var(--font-size);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
width: 20%;
|
||||
max-width: 200px;
|
||||
min-width: 100px;
|
||||
cursor: pointer;
|
||||
margin: 30px;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
background-color: #555;
|
||||
color: white;
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
width: var(--follow-text-entry-width);
|
||||
clear: both;
|
||||
font-size: var(--font-size);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
text-align: center;
|
||||
color: var(--text-entry-foreground);
|
||||
background-color: var(--text-entry-background);
|
||||
}
|
||||
|
||||
.options {
|
||||
font-size: var(--font-size);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.options img {
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 400px) {
|
||||
.followText {
|
||||
font-size: var(--follow-text-size1);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
input[type=text] {
|
||||
width: var(--follow-text-entry-width);
|
||||
clear: both;
|
||||
font-size: 24px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
text-align: center;
|
||||
color: var(--text-entry-foreground);
|
||||
background-color: var(--text-entry-background);
|
||||
}
|
||||
.button {
|
||||
border-radius: 4px;
|
||||
background-color: var(--button-background);
|
||||
border: none;
|
||||
color: var(--button-text);
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
font-size: 24px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
width: 20%;
|
||||
max-width: 200px;
|
||||
min-width: 100px;
|
||||
cursor: pointer;
|
||||
margin: 30px;
|
||||
}
|
||||
input[type=checkbox]
|
||||
{
|
||||
-ms-transform: scale(2);
|
||||
-moz-transform: scale(2);
|
||||
-webkit-transform: scale(2);
|
||||
-o-transform: scale(2);
|
||||
transform: scale(2);
|
||||
padding: 10px;
|
||||
margin: 20px 30px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1000px) {
|
||||
.followText {
|
||||
font-size: var(--follow-text-size2);
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
input[type=text] {
|
||||
width: var(--follow-text-entry-width);
|
||||
clear: both;
|
||||
font-size: 40px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
text-align: center;
|
||||
color: var(--text-entry-foreground);
|
||||
background-color: var(--text-entry-background);
|
||||
}
|
||||
.button {
|
||||
border-radius: 4px;
|
||||
background-color: var(--button-background);
|
||||
border: none;
|
||||
color: var(--button-text);
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
font-size: 40px;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
width: 20%;
|
||||
max-width: 200px;
|
||||
min-width: 100px;
|
||||
cursor: pointer;
|
||||
margin: 30px;
|
||||
}
|
||||
input[type=checkbox]
|
||||
{
|
||||
-ms-transform: scale(4);
|
||||
-moz-transform: scale(4);
|
||||
-webkit-transform: scale(4);
|
||||
-o-transform: scale(4);
|
||||
transform: scale(4);
|
||||
padding: 20px;
|
||||
margin: 30px 40px;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
186
theme.py
186
theme.py
|
|
@ -14,7 +14,8 @@ from shutil import copyfile
|
|||
|
||||
def getThemeFiles() -> []:
|
||||
return ('epicyon.css', 'login.css', 'follow.css',
|
||||
'suspended.css', 'calendar.css', 'blog.css')
|
||||
'suspended.css', 'calendar.css', 'blog.css',
|
||||
'options.css')
|
||||
|
||||
|
||||
def getThemesList() -> []:
|
||||
|
|
@ -88,7 +89,8 @@ def setCSSparam(css: str, param: str, value: str) -> str:
|
|||
return newcss.strip()
|
||||
|
||||
|
||||
def setThemeFromDict(baseDir: str, name: str, themeParams: {}) -> None:
|
||||
def setThemeFromDict(baseDir: str, name: str,
|
||||
themeParams: {}, bgParams: {}) -> None:
|
||||
"""Uses a dictionary to set a theme
|
||||
"""
|
||||
if name:
|
||||
|
|
@ -108,6 +110,29 @@ def setThemeFromDict(baseDir: str, name: str, themeParams: {}) -> None:
|
|||
with open(filename, 'w+') as cssfile:
|
||||
cssfile.write(css)
|
||||
|
||||
if bgParams.get('login'):
|
||||
setBackgroundFormat(baseDir, name, 'login', bgParams['login'])
|
||||
if bgParams.get('follow'):
|
||||
setBackgroundFormat(baseDir, name, 'login', bgParams['follow'])
|
||||
if bgParams.get('options'):
|
||||
setBackgroundFormat(baseDir, name, 'login', bgParams['options'])
|
||||
|
||||
|
||||
def setBackgroundFormat(baseDir: str, name: str,
|
||||
backgroundType: str, extension: str) -> None:
|
||||
"""Sets the background file extension
|
||||
"""
|
||||
if extension == 'jpg':
|
||||
return
|
||||
cssFilename = baseDir + '/' + backgroundType + '.css'
|
||||
if not os.path.isfile(cssFilename):
|
||||
return
|
||||
with open(cssFilename, 'r') as cssfile:
|
||||
css = cssfile.read()
|
||||
css = css.replace('background.jpg', 'background.' + extension)
|
||||
with open(cssFilename, 'w+') as cssfile2:
|
||||
cssfile2.write(css)
|
||||
|
||||
|
||||
def enableGrayscale(baseDir: str) -> None:
|
||||
"""Enables grayscale for the current theme
|
||||
|
|
@ -192,17 +217,24 @@ def setCustomFont(baseDir: str):
|
|||
|
||||
|
||||
def setThemeDefault(baseDir: str):
|
||||
name = 'default'
|
||||
removeTheme(baseDir)
|
||||
setThemeInConfig(baseDir, 'default')
|
||||
setThemeInConfig(baseDir, name)
|
||||
themeParams = {
|
||||
"dummyValue": "1234"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'default', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeBlue(baseDir: str):
|
||||
name = 'blue'
|
||||
removeTheme(baseDir)
|
||||
setThemeInConfig(baseDir, 'blue')
|
||||
setThemeInConfig(baseDir, name)
|
||||
themeParams = {
|
||||
"font-size-header": "22px",
|
||||
"font-size-header-mobile": "32px",
|
||||
|
|
@ -225,12 +257,18 @@ def setThemeBlue(baseDir: str):
|
|||
"*font-family": "'Domestic_Manners'",
|
||||
"*src": "url('./fonts/Domestic_Manners.woff2') format('woff2')"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'blue', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeNight(baseDir: str):
|
||||
name = 'night'
|
||||
removeTheme(baseDir)
|
||||
setThemeInConfig(baseDir, 'night')
|
||||
setThemeInConfig(baseDir, name)
|
||||
fontStr = \
|
||||
"url('./fonts/CheGuevaraTextSans-Regular.woff2') format('woff2')"
|
||||
themeParams = {
|
||||
|
|
@ -263,12 +301,18 @@ def setThemeNight(baseDir: str):
|
|||
"*font-family": "'CheGuevaraTextSans-Regular'",
|
||||
"*src": fontStr
|
||||
}
|
||||
setThemeFromDict(baseDir, 'night', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeStarlight(baseDir: str):
|
||||
name = 'starlight'
|
||||
removeTheme(baseDir)
|
||||
setThemeInConfig(baseDir, 'starlight')
|
||||
setThemeInConfig(baseDir, name)
|
||||
themeParams = {
|
||||
"font-size-button-mobile": "36px",
|
||||
"font-size": "32px",
|
||||
|
|
@ -310,12 +354,18 @@ def setThemeStarlight(baseDir: str):
|
|||
"*font-family": "'bgrove'",
|
||||
"*src": "url('fonts/bgrove.woff2') format('woff2')"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'starlight', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeHenge(baseDir: str):
|
||||
name = 'henge'
|
||||
removeTheme(baseDir)
|
||||
setThemeInConfig(baseDir, 'henge')
|
||||
setThemeInConfig(baseDir, name)
|
||||
themeParams = {
|
||||
"font-size-button-mobile": "36px",
|
||||
"font-size": "32px",
|
||||
|
|
@ -354,12 +404,18 @@ def setThemeHenge(baseDir: str):
|
|||
"*font-family": "'bgrove'",
|
||||
"*src": "url('fonts/bgrove.woff2') format('woff2')"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'henge', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeZen(baseDir: str):
|
||||
name = 'zen'
|
||||
removeTheme(baseDir)
|
||||
setThemeInConfig(baseDir, 'zen')
|
||||
setThemeInConfig(baseDir, name)
|
||||
themeParams = {
|
||||
"main-bg-color": "#5c4e41",
|
||||
"text-entry-background": "#5c4e41",
|
||||
|
|
@ -378,10 +434,16 @@ def setThemeZen(baseDir: str):
|
|||
"dropdown-bg-color": "#504e41",
|
||||
"dropdown-bg-color-hover": "#444"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'zen', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeHighVis(baseDir: str):
|
||||
name = 'highvis'
|
||||
themeParams = {
|
||||
"font-size-header": "22px",
|
||||
"font-size-header-mobile": "32px",
|
||||
|
|
@ -398,10 +460,16 @@ def setThemeHighVis(baseDir: str):
|
|||
"*font-family": "'LinBiolinum_Rah'",
|
||||
"*src": "url('./fonts/LinBiolinum_Rah.woff2') format('woff2')"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'highvis', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeLCD(baseDir: str):
|
||||
name = 'lcd'
|
||||
themeParams = {
|
||||
"main-bg-color": "#9fb42b",
|
||||
"link-bg-color": "#33390d",
|
||||
|
|
@ -454,10 +522,16 @@ def setThemeLCD(baseDir: str):
|
|||
"*font-family": "'LcdSolid'",
|
||||
"*src": "url('./fonts/LcdSolid.woff2') format('woff2')"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'lcd', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemePurple(baseDir: str):
|
||||
name = 'purple'
|
||||
fontStr = \
|
||||
"url('./fonts/CheGuevaraTextSans-Regular.woff2') format('woff2')"
|
||||
themeParams = {
|
||||
|
|
@ -497,10 +571,16 @@ def setThemePurple(baseDir: str):
|
|||
"*font-family": "'CheGuevaraTextSans-Regular'",
|
||||
"*src": fontStr
|
||||
}
|
||||
setThemeFromDict(baseDir, 'purple', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeHacker(baseDir: str):
|
||||
name = 'hacker'
|
||||
themeParams = {
|
||||
"main-bg-color": "black",
|
||||
"link-bg-color": "black",
|
||||
|
|
@ -536,10 +616,16 @@ def setThemeHacker(baseDir: str):
|
|||
"event-color": "#00ff00",
|
||||
"image-corners": "0%"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'hacker', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeLight(baseDir: str):
|
||||
name = 'light'
|
||||
themeParams = {
|
||||
"font-size-button-mobile": "36px",
|
||||
"font-size": "32px",
|
||||
|
|
@ -582,7 +668,12 @@ def setThemeLight(baseDir: str):
|
|||
"*font-family": "'ElectrumADFExp-Regular'",
|
||||
"*src": "url('./fonts/ElectrumADFExp-Regular.otf') format('opentype')"
|
||||
}
|
||||
setThemeFromDict(baseDir, 'light', themeParams)
|
||||
bgParams = {
|
||||
"login": 'jpg',
|
||||
"follow": 'jpg',
|
||||
"options": 'jpg'
|
||||
}
|
||||
setThemeFromDict(baseDir, name, themeParams, bgParams)
|
||||
|
||||
|
||||
def setThemeImages(baseDir: str, name: str) -> None:
|
||||
|
|
@ -605,18 +696,53 @@ def setThemeImages(baseDir: str, name: str) -> None:
|
|||
baseDir + '/img/banner_' + themeNameLower + '.png'
|
||||
searchBannerFilename = \
|
||||
baseDir + '/img/search_banner_' + themeNameLower + '.png'
|
||||
if os.path.isfile(profileImageFilename) and \
|
||||
os.path.isfile(bannerFilename):
|
||||
for subdir, dirs, files in os.walk(baseDir +
|
||||
'/accounts'):
|
||||
for acct in dirs:
|
||||
if '@' not in acct:
|
||||
continue
|
||||
if 'inbox@' in acct:
|
||||
continue
|
||||
accountDir = \
|
||||
os.path.join(baseDir + '/accounts', acct)
|
||||
|
||||
backgroundNames = ('login', 'shares', 'delete', 'follow',
|
||||
'options', 'block', 'search', 'calendar')
|
||||
extensions = ('webp', 'gif', 'jpg', 'png')
|
||||
|
||||
for subdir, dirs, files in os.walk(baseDir + '/accounts'):
|
||||
for acct in dirs:
|
||||
if '@' not in acct:
|
||||
continue
|
||||
if 'inbox@' in acct:
|
||||
continue
|
||||
accountDir = \
|
||||
os.path.join(baseDir + '/accounts', acct)
|
||||
|
||||
for backgroundType in backgroundNames:
|
||||
for ext in extensions:
|
||||
if themeNameLower == 'default':
|
||||
backgroundImageFilename = \
|
||||
baseDir + '/img/' + backgroundType + \
|
||||
'-background.' + ext
|
||||
else:
|
||||
backgroundImageFilename = \
|
||||
baseDir + '/img/' + backgroundType + \
|
||||
'_background_' + themeNameLower + '.' + ext
|
||||
|
||||
if os.path.isfile(backgroundImageFilename):
|
||||
try:
|
||||
copyfile(backgroundImageFilename,
|
||||
baseDir + '/accounts/' + backgroundType +
|
||||
'-background.' + ext)
|
||||
continue
|
||||
except BaseException:
|
||||
pass
|
||||
# background image was not found
|
||||
# so remove any existing file
|
||||
if os.path.isfile(baseDir + '/accounts/' +
|
||||
backgroundType +
|
||||
'-background.' + ext):
|
||||
try:
|
||||
os.remove(baseDir + '/accounts/' +
|
||||
backgroundType +
|
||||
'-background.' + ext)
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
if os.path.isfile(profileImageFilename) and \
|
||||
os.path.isfile(bannerFilename):
|
||||
try:
|
||||
copyfile(profileImageFilename,
|
||||
accountDir + '/image.png')
|
||||
|
|
|
|||
134
webinterface.py
134
webinterface.py
|
|
@ -1580,10 +1580,11 @@ def htmlLogin(translate: {}, baseDir: str, autocomplete=True) -> str:
|
|||
if not loginImageFilename:
|
||||
loginImageFilename = baseDir + '/accounts/' + loginImage
|
||||
copyfile(baseDir + '/img/login.png', loginImageFilename)
|
||||
if os.path.isfile(baseDir + '/img/login-background.png'):
|
||||
if not os.path.isfile(baseDir + '/accounts/login-background.png'):
|
||||
copyfile(baseDir + '/img/login-background.png',
|
||||
baseDir + '/accounts/login-background.png')
|
||||
|
||||
if os.path.isfile(baseDir + '/accounts/login-background-custom.jpg'):
|
||||
if not os.path.isfile(baseDir + '/accounts/login-background.jpg'):
|
||||
copyfile(baseDir + '/accounts/login-background-custom.jpg',
|
||||
baseDir + '/accounts/login-background.jpg')
|
||||
|
||||
if accounts > 0:
|
||||
loginText = \
|
||||
|
|
@ -1661,7 +1662,7 @@ def htmlLogin(translate: {}, baseDir: str, autocomplete=True) -> str:
|
|||
' <input type="password" ' + autocompleteStr + \
|
||||
' placeholder="' + translate['Enter Password'] + \
|
||||
'" name="password" required>'
|
||||
loginForm += registerButtonStr + loginButtonStr
|
||||
loginForm += loginButtonStr + registerButtonStr
|
||||
loginForm += ' </div>'
|
||||
loginForm += '</form>'
|
||||
loginForm += \
|
||||
|
|
@ -1680,10 +1681,11 @@ def htmlTermsOfService(baseDir: str, httpPrefix: str, domainFull: str) -> str:
|
|||
if not os.path.isfile(baseDir + '/accounts/tos.txt'):
|
||||
copyfile(baseDir + '/default_tos.txt',
|
||||
baseDir + '/accounts/tos.txt')
|
||||
if os.path.isfile(baseDir + '/img/login-background.png'):
|
||||
if not os.path.isfile(baseDir + '/accounts/login-background.png'):
|
||||
copyfile(baseDir + '/img/login-background.png',
|
||||
baseDir + '/accounts/login-background.png')
|
||||
|
||||
if os.path.isfile(baseDir + '/accounts/login-background-custom.jpg'):
|
||||
if not os.path.isfile(baseDir + '/accounts/login-background.jpg'):
|
||||
copyfile(baseDir + '/accounts/login-background-custom.jpg',
|
||||
baseDir + '/accounts/login-background.jpg')
|
||||
|
||||
TOSText = 'Terms of Service go here.'
|
||||
if os.path.isfile(baseDir + '/accounts/tos.txt'):
|
||||
|
|
@ -1720,35 +1722,35 @@ def htmlAbout(baseDir: str, httpPrefix: str,
|
|||
if not os.path.isfile(baseDir + '/accounts/about.txt'):
|
||||
copyfile(baseDir + '/default_about.txt',
|
||||
baseDir + '/accounts/about.txt')
|
||||
if os.path.isfile(baseDir + '/img/login-background.png'):
|
||||
if not os.path.isfile(baseDir + '/accounts/login-background.png'):
|
||||
copyfile(baseDir + '/img/login-background.png',
|
||||
baseDir + '/accounts/login-background.png')
|
||||
|
||||
if os.path.isfile(baseDir + '/accounts/login-background-custom.jpg'):
|
||||
if not os.path.isfile(baseDir + '/accounts/login-background.jpg'):
|
||||
copyfile(baseDir + '/accounts/login-background-custom.jpg',
|
||||
baseDir + '/accounts/login-background.jpg')
|
||||
|
||||
aboutText = 'Information about this instance goes here.'
|
||||
if os.path.isfile(baseDir + '/accounts/about.txt'):
|
||||
with open(baseDir + '/accounts/about.txt', 'r') as file:
|
||||
aboutText = file.read()
|
||||
with open(baseDir + '/accounts/about.txt', 'r') as aboutFile:
|
||||
aboutText = aboutFile.read()
|
||||
|
||||
aboutForm = ''
|
||||
cssFilename = baseDir + '/epicyon-profile.css'
|
||||
if os.path.isfile(baseDir + '/epicyon.css'):
|
||||
cssFilename = baseDir + '/epicyon.css'
|
||||
with open(cssFilename, 'r') as cssFile:
|
||||
termsCSS = cssFile.read()
|
||||
aboutCSS = cssFile.read()
|
||||
if httpPrefix != 'http':
|
||||
termsCSS = termsCSS.replace('https://',
|
||||
aboutCSS = aboutCSS.replace('https://',
|
||||
httpPrefix + '://')
|
||||
|
||||
aboutForm = htmlHeader(cssFilename, termsCSS)
|
||||
aboutForm = htmlHeader(cssFilename, aboutCSS)
|
||||
aboutForm += '<div class="container">' + aboutText + '</div>'
|
||||
if onionDomain:
|
||||
aboutForm += \
|
||||
'<div class="container"><center><p class="administeredby">' + \
|
||||
'http://' + onionDomain + '</p></center></div>'
|
||||
if adminNickname:
|
||||
adminActor = \
|
||||
httpPrefix + '://' + domainFull + '/users/' + adminNickname
|
||||
adminActor = '/users/' + adminNickname
|
||||
aboutForm += \
|
||||
'<div class="container"><center>' + \
|
||||
'<p class="administeredby">Administered by <a href="' + \
|
||||
|
|
@ -5340,10 +5342,10 @@ def htmlFollowConfirm(translate: {}, baseDir: str,
|
|||
"""
|
||||
followDomain, port = getDomainFromActor(followActor)
|
||||
|
||||
if os.path.isfile(baseDir + '/img/follow-background.png'):
|
||||
if not os.path.isfile(baseDir + '/accounts/follow-background.png'):
|
||||
copyfile(baseDir + '/img/follow-background.png',
|
||||
baseDir + '/accounts/follow-background.png')
|
||||
if os.path.isfile(baseDir + '/accounts/follow-background-custom.jpg'):
|
||||
if not os.path.isfile(baseDir + '/accounts/follow-background.jpg'):
|
||||
copyfile(baseDir + '/accounts/follow-background-custom.jpg',
|
||||
baseDir + '/accounts/follow-background.jpg')
|
||||
|
||||
cssFilename = baseDir + '/epicyon-follow.css'
|
||||
if os.path.isfile(baseDir + '/follow.css'):
|
||||
|
|
@ -5385,10 +5387,10 @@ def htmlUnfollowConfirm(translate: {}, baseDir: str,
|
|||
"""
|
||||
followDomain, port = getDomainFromActor(followActor)
|
||||
|
||||
if os.path.isfile(baseDir + '/img/follow-background.png'):
|
||||
if not os.path.isfile(baseDir + '/accounts/follow-background.png'):
|
||||
copyfile(baseDir + '/img/follow-background.png',
|
||||
baseDir + '/accounts/follow-background.png')
|
||||
if os.path.isfile(baseDir + '/accounts/follow-background-custom.jpg'):
|
||||
if not os.path.isfile(baseDir + '/accounts/follow-background.jpg'):
|
||||
copyfile(baseDir + '/accounts/follow-background-custom.jpg',
|
||||
baseDir + '/accounts/follow-background.jpg')
|
||||
|
||||
cssFilename = baseDir + '/epicyon-follow.css'
|
||||
if os.path.isfile(baseDir + '/follow.css'):
|
||||
|
|
@ -5445,10 +5447,10 @@ def htmlPersonOptions(translate: {}, baseDir: str,
|
|||
if optionsPort != 80 and optionsPort != 443:
|
||||
optionsDomainFull = optionsDomain + ':' + str(optionsPort)
|
||||
|
||||
if os.path.isfile(baseDir + '/img/options-background.png'):
|
||||
if not os.path.isfile(baseDir + '/accounts/options-background.png'):
|
||||
copyfile(baseDir + '/img/options-background.png',
|
||||
baseDir + '/accounts/options-background.png')
|
||||
if os.path.isfile(baseDir + '/accounts/options-background-custom.jpg'):
|
||||
if not os.path.isfile(baseDir + '/accounts/options-background.jpg'):
|
||||
copyfile(baseDir + '/accounts/options-background.jpg',
|
||||
baseDir + '/accounts/options-background.jpg')
|
||||
|
||||
followStr = 'Follow'
|
||||
blockStr = 'Block'
|
||||
|
|
@ -5478,9 +5480,9 @@ def htmlPersonOptions(translate: {}, baseDir: str,
|
|||
optionsLinkStr = \
|
||||
' <input type="hidden" name="postUrl" value="' + \
|
||||
optionsLink + '">'
|
||||
cssFilename = baseDir + '/epicyon-follow.css'
|
||||
if os.path.isfile(baseDir + '/follow.css'):
|
||||
cssFilename = baseDir + '/follow.css'
|
||||
cssFilename = baseDir + '/epicyon-options.css'
|
||||
if os.path.isfile(baseDir + '/options.css'):
|
||||
cssFilename = baseDir + '/options.css'
|
||||
with open(cssFilename, 'r') as cssFile:
|
||||
profileStyle = cssFile.read()
|
||||
profileStyle = \
|
||||
|
|
@ -5501,61 +5503,63 @@ def htmlPersonOptions(translate: {}, baseDir: str,
|
|||
translate['Donate'] + '</button></a>'
|
||||
|
||||
optionsStr = htmlHeader(cssFilename, profileStyle)
|
||||
optionsStr += '<div class="options">'
|
||||
optionsStr += ' <div class="optionsAvatar">'
|
||||
optionsStr += ' <center>'
|
||||
optionsStr += ' <a href="' + optionsActor + '">'
|
||||
optionsStr += ' <img loading="lazy" src="' + optionsProfileUrl + '"/></a>'
|
||||
optionsStr += '<div class="options">\n'
|
||||
optionsStr += ' <div class="optionsAvatar">\n'
|
||||
optionsStr += ' <center>\n'
|
||||
optionsStr += ' <a href="' + optionsActor + '">\n'
|
||||
optionsStr += ' <img loading="lazy" src="' + optionsProfileUrl + \
|
||||
'"/></a>\n'
|
||||
optionsStr += \
|
||||
' <p class="optionsText">' + translate['Options for'] + \
|
||||
' @' + getNicknameFromActor(optionsActor) + '@' + \
|
||||
optionsDomain + '</p>'
|
||||
optionsDomain + '</p>\n'
|
||||
if emailAddress:
|
||||
optionsStr += \
|
||||
'<p class="imText">' + translate['Email'] + \
|
||||
': <a href="mailto:' + \
|
||||
emailAddress + '">' + emailAddress + '</a></p>'
|
||||
emailAddress + '">' + emailAddress + '</a></p>\n'
|
||||
if xmppAddress:
|
||||
optionsStr += \
|
||||
'<p class="imText">' + translate['XMPP'] + \
|
||||
': <a href="xmpp:' + xmppAddress + '">' + xmppAddress + '</a></p>'
|
||||
': <a href="xmpp:' + xmppAddress + '">' + \
|
||||
xmppAddress + '</a></p>\n'
|
||||
if matrixAddress:
|
||||
optionsStr += \
|
||||
'<p class="imText">' + translate['Matrix'] + ': ' + \
|
||||
matrixAddress + '</p>'
|
||||
matrixAddress + '</p>\n'
|
||||
if ssbAddress:
|
||||
optionsStr += \
|
||||
'<p class="imText">SSB: ' + ssbAddress + '</p>'
|
||||
'<p class="imText">SSB: ' + ssbAddress + '</p>\n'
|
||||
if blogAddress:
|
||||
optionsStr += \
|
||||
'<p class="imText">Blog: <a href="' + blogAddress + '">' + \
|
||||
blogAddress + '</a></p>'
|
||||
blogAddress + '</a></p>\n'
|
||||
if toxAddress:
|
||||
optionsStr += \
|
||||
'<p class="imText">Tox: ' + toxAddress + '</p>'
|
||||
'<p class="imText">Tox: ' + toxAddress + '</p>\n'
|
||||
if PGPfingerprint:
|
||||
optionsStr += '<p class="pgp">PGP: ' + \
|
||||
PGPfingerprint.replace('\n', '<br>') + '</p>'
|
||||
PGPfingerprint.replace('\n', '<br>') + '</p>\n'
|
||||
if PGPpubKey:
|
||||
optionsStr += '<p class="pgp">' + \
|
||||
PGPpubKey.replace('\n', '<br>') + '</p>'
|
||||
PGPpubKey.replace('\n', '<br>') + '</p>\n'
|
||||
optionsStr += ' <form method="POST" action="' + \
|
||||
originPathStr + '/personoptions">'
|
||||
originPathStr + '/personoptions">\n'
|
||||
optionsStr += ' <input type="hidden" name="pageNumber" value="' + \
|
||||
str(pageNumber) + '">'
|
||||
str(pageNumber) + '">\n'
|
||||
optionsStr += ' <input type="hidden" name="actor" value="' + \
|
||||
optionsActor + '">'
|
||||
optionsActor + '">\n'
|
||||
optionsStr += ' <input type="hidden" name="avatarUrl" value="' + \
|
||||
optionsProfileUrl + '">'
|
||||
optionsProfileUrl + '">\n'
|
||||
if optionsNickname:
|
||||
handle = optionsNickname + '@' + optionsDomainFull
|
||||
petname = getPetName(baseDir, nickname, domain, handle)
|
||||
optionsStr += \
|
||||
translate['Petname'] + ': ' + \
|
||||
'<input type="text" name="optionpetname" value="' + \
|
||||
petname + '">' \
|
||||
petname + '">\n' \
|
||||
'<button type="submit" class="button" name="submitPetname">' + \
|
||||
translate['Submit'] + '</button><br>'
|
||||
translate['Submit'] + '</button><br>\n'
|
||||
|
||||
if isFollowingActor(baseDir, nickname, domain, optionsActor):
|
||||
if receivingCalendarEvents(baseDir, nickname, domain,
|
||||
|
|
@ -5579,28 +5583,28 @@ def htmlPersonOptions(translate: {}, baseDir: str,
|
|||
optionsStr += optionsLinkStr
|
||||
optionsStr += \
|
||||
' <button type="submit" class="button" name="submitView">' + \
|
||||
translate['View'] + '</button>'
|
||||
translate['View'] + '</button>\n'
|
||||
optionsStr += donateStr
|
||||
optionsStr += \
|
||||
' <button type="submit" class="button" name="submit' + \
|
||||
followStr + '">' + translate[followStr] + '</button>'
|
||||
followStr + '">' + translate[followStr] + '</button>\n'
|
||||
optionsStr += \
|
||||
' <button type="submit" class="button" name="submit' + \
|
||||
blockStr + '">' + translate[blockStr] + '</button>'
|
||||
blockStr + '">' + translate[blockStr] + '</button>\n'
|
||||
optionsStr += \
|
||||
' <button type="submit" class="button" name="submitDM">' + \
|
||||
translate['DM'] + '</button>'
|
||||
translate['DM'] + '</button>\n'
|
||||
optionsStr += \
|
||||
' <button type="submit" class="button" name="submit' + \
|
||||
snoozeButtonStr + '">' + translate[snoozeButtonStr] + '</button>'
|
||||
snoozeButtonStr + '">' + translate[snoozeButtonStr] + '</button>\n'
|
||||
optionsStr += \
|
||||
' <button type="submit" class="button" name="submitReport">' + \
|
||||
translate['Report'] + '</button>'
|
||||
translate['Report'] + '</button>\n'
|
||||
|
||||
optionsStr += ' </form>'
|
||||
optionsStr += '</center>'
|
||||
optionsStr += '</div>'
|
||||
optionsStr += '</div>'
|
||||
optionsStr += ' </form>\n'
|
||||
optionsStr += '</center>\n'
|
||||
optionsStr += '</div>\n'
|
||||
optionsStr += '</div>\n'
|
||||
optionsStr += htmlFooter()
|
||||
return optionsStr
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue