Welcome screen

main
Bob Mottram 2021-02-24 18:44:26 +00:00
parent 6a93f8d9a8
commit 53774bed1b
17 changed files with 324 additions and 15 deletions

233
epicyon-welcome.css 100644
View File

@ -0,0 +1,233 @@
@chaste "UTF-8";
:root {
--welcome-bg-color: #282c37;
--link-bg-color: #282c37;
--welcome-fg-color: #dddddd;
--main-link-color: #999;
--main-visited-color: #888;
--border-color: #505050;
--border-width: 2px;
--font-size-header: 18px;
--font-color-header: #ccc;
--welcome-font-size: 22px;
--welcome-font-size-mobile: 40px;
--text-entry-foreground: #ccc;
--text-entry-background: #111;
--time-color: #aaa;
--button-text: #FFFFFF;
--button-background: #999;
--button-selected: #666;
--form-border-radius: 30px;
--focus-color: white;
--line-spacing: 130%;
--welcome-logo-width: 20%;
--main-link-color-hover: #bbb;
--rendering: normal;
}
@font-face {
font-family: 'Bedstead';
font-style: italic;
font-weight: normal;
font-display: block;
src: url('./fonts/bedstead.otf') format('opentype');
}
@font-face {
font-family: 'Bedstead';
font-style: normal;
font-weight: normal;
font-display: block;
src: url('./fonts/bedstead.otf') format('opentype');
}
body, html {
background-color: var(--welcome-bg-color);
color: var(--welcome-fg-color);
background-image: url("/welcome-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%;
min-width: 600px;
margin: 0 auto;
font-size: var(--welcome-font-size);
line-height: var(--line-spacing);
image-rendering: var(--rendering);
}
a, u {
color: var(--welcome-fg-color);
}
a:visited{
color: var(--main-visited-color);
background: var(--link-bg-color);
font-weight: normal;
text-decoration: none;
}
a:link {
color: var(--main-link-color);
background: var(--link-bg-color);
font-weight: normal;
text-decoration: none;
}
a:link:hover {
color: var(--main-link-color-hover);
}
a:visited:hover {
color: var(--main-link-color-hover);
}
a:focus {
border: 2px solid var(--focus-color);
}
form {
border: var(--border-width) solid var(--border-color);
border-radius: var(--form-border-radius);
}
.transparent {
color: transparent;
background: transparent;
font-size: 0px;
line-height: 0px;
height: 0px;
}
button {
background-color: var(--button-background);
color: var(--button-text);
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
font-size: var(--welcome-font-size);
font-family: Arial, Helvetica, sans-serif;
}
.welcome-text {
font-size: var(--welcome-font-size);
font-family: Arial, Helvetica, sans-serif;
}
button:hover {
opacity: 0.8;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
.imgcontainer img {
width: var(--welcome-logo-width);
}
img.avatar {
width: 40%;
border-radius: 50%;
}
.container {
padding: 16px;
}
.container.next {
float: right;
}
span.psw {
float: right;
padding-top: 16px;
}
@media screen and (min-width: 400px) {
body, html {
background-color: var(--welcome-bg-color);
color: var(--welcome-fg-color);
height: 100%;
font-family: Arial, Helvetica, sans-serif;
max-width: 60%;
min-width: 600px;
margin: 0 auto;
font-size: var(--welcome-font-size);
font-family: Arial, Helvetica, sans-serif;
position: relative;
}
.welcome-text {
font-size: var(--welcome-font-size);
font-family: Arial, Helvetica, sans-serif;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
font-size: var(--welcome-font-size);
font-family: Arial, Helvetica, sans-serif;
}
button {
background-color: var(--button-background);
color: var(--button-text);
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
font-size: var(--welcome-font-size);
font-family: Arial, Helvetica, sans-serif;
}
}
@media screen and (max-width: 1000px) {
body, html {
background-color: var(--welcome-bg-color);
color: var(--welcome-fg-color);
height: 100%;
font-family: Arial, Helvetica, sans-serif;
max-width: 95%;
min-width: 600px;
margin: 0 auto;
font-size: var(--welcome-font-size-mobile);
font-family: Arial, Helvetica, sans-serif;
position: relative;
}
.welcome-text {
font-size: var(--welcome-font-size-mobile);
font-family: Arial, Helvetica, sans-serif;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
font-size: var(--welcome-font-size-mobile);
font-family: Arial, Helvetica, sans-serif;
}
button {
background-color: var(--button-background);
color: var(--button-text);
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
font-size: var(--welcome-font-size-mobile);
font-family: Arial, Helvetica, sans-serif;
}
}

View File

@ -371,5 +371,6 @@
"Featured writer": "كاتب متميز",
"Broch mode": "وضع الكتيب",
"Pixel": "بكسل",
"DM bounce": "يتم قبول الرسائل فقط من الحسابات المتبعة"
"DM bounce": "يتم قبول الرسائل فقط من الحسابات المتبعة",
"Next": "التالي"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Escriptor destacat",
"Broch mode": "Mode Broch",
"Pixel": "Pixel",
"DM bounce": "Els missatges només saccepten des dels comptes seguits"
"DM bounce": "Els missatges només saccepten des dels comptes seguits",
"Next": "Pròxim"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Awdur dan sylw",
"Broch mode": "Modd Broch",
"Pixel": "Pixel",
"DM bounce": "Dim ond o gyfrifon a ddilynir y derbynnir negeseuon"
"DM bounce": "Dim ond o gyfrifon a ddilynir y derbynnir negeseuon",
"Next": "Nesaf"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Ausgewählter Schriftsteller",
"Broch mode": "Broch-Modus",
"Pixel": "Pixel",
"DM bounce": "Nachrichten werden nur von folgenden Konten akzeptiert"
"DM bounce": "Nachrichten werden nur von folgenden Konten akzeptiert",
"Next": "Nächster"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Featured writer",
"Broch mode": "Broch mode",
"Pixel": "Pixel",
"DM bounce": "Messages are only accepted from followed accounts"
"DM bounce": "Messages are only accepted from followed accounts",
"Next": "Next"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Escritora destacada",
"Broch mode": "Modo broche",
"Pixel": "Pixel",
"DM bounce": "Solo se aceptan mensajes de cuentas seguidas"
"DM bounce": "Solo se aceptan mensajes de cuentas seguidas",
"Next": "Próxima"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Écrivain en vedette",
"Broch mode": "Mode Broch",
"Pixel": "Pixel",
"DM bounce": "Les messages ne sont acceptés que des comptes suivis"
"DM bounce": "Les messages ne sont acceptés que des comptes suivis",
"Next": "Suivante"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Scríbhneoir mór le rá",
"Broch mode": "Modh broch",
"Pixel": "Pixel",
"DM bounce": "Ní ghlactar le teachtaireachtaí ach ó chuntais a leanann"
"DM bounce": "Ní ghlactar le teachtaireachtaí ach ó chuntais a leanann",
"Next": "Ar Aghaidh"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "फीचर्ड लेखक",
"Broch mode": "ब्रोच मोड",
"Pixel": "पिक्सेल",
"DM bounce": "संदेश केवल अनुसरण किए गए खातों से स्वीकार किए जाते हैं"
"DM bounce": "संदेश केवल अनुसरण किए गए खातों से स्वीकार किए जाते हैं",
"Next": "अगला"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Scrittore in primo piano",
"Broch mode": "Modalità Broch",
"Pixel": "Pixel",
"DM bounce": "I messaggi sono accettati solo dagli account seguiti"
"DM bounce": "I messaggi sono accettati solo dagli account seguiti",
"Next": "Il prossimo"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "注目の作家",
"Broch mode": "ブロッホモード",
"Pixel": "ピクセル",
"DM bounce": "メッセージはフォローされているアカウントからのみ受け付けられます"
"DM bounce": "メッセージはフォローされているアカウントからのみ受け付けられます",
"Next": "次"
}

View File

@ -367,5 +367,6 @@
"Featured writer": "Featured writer",
"Broch mode": "Broch mode",
"Pixel": "Pixel",
"DM bounce": "Messages are only accepted from followed accounts"
"DM bounce": "Messages are only accepted from followed accounts",
"Next": "Next"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Escritor em destaque",
"Broch mode": "Modo broch",
"Pixel": "Pixel",
"DM bounce": "Mensagens são aceitas apenas de contas seguidas"
"DM bounce": "Mensagens são aceitas apenas de contas seguidas",
"Next": "Próxima"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "Избранный писатель",
"Broch mode": "Брош режим",
"Pixel": "Пиксель",
"DM bounce": "Сообщения принимаются только от следующих аккаунтов"
"DM bounce": "Сообщения принимаются только от следующих аккаунтов",
"Next": "Следующий"
}

View File

@ -371,5 +371,6 @@
"Featured writer": "特色作家",
"Broch mode": "断点模式",
"Pixel": "像素点",
"DM bounce": "仅接受来自后续帐户的邮件"
"DM bounce": "仅接受来自后续帐户的邮件",
"Next": "下一个"
}

61
webapp_welcome.py 100644
View File

@ -0,0 +1,61 @@
__filename__ = "webapp_welcome.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.2.0"
__maintainer__ = "Bob Mottram"
__email__ = "bob@freedombone.net"
__status__ = "Production"
import os
from shutil import copyfile
from utils import getConfigParam
from webapp_utils import htmlHeaderWithExternalStyle
from webapp_utils import htmlFooter
def welcomeScreenShown(baseDir: str, nickname: str, domain: str):
"""Indicates that the welcome screen has been shown for a given account
"""
shownFilename = baseDir + '/accounts/.welcome_shown'
shownFile = open(shownFilename, 'w+')
if shownFile:
shownFile.write('\n')
shownFile.close()
def htmlWelcomeScreen(baseDir: str, nickname: str, domain: str,
language: str, translate: {}) -> str:
"""Returns the welcome screen
"""
# set a custom background for the welcome screen
if os.path.isfile(baseDir + '/accounts/welcome-background-custom.jpg'):
if not os.path.isfile(baseDir + '/accounts/welcome-background.jpg'):
copyfile(baseDir + '/accounts/welcome-background-custom.jpg',
baseDir + '/accounts/welcome-background.jpg')
welcomeText = 'Welcome to Epicyon'
welcomeFilename = baseDir + '/accounts/welcome.txt'
if not os.path.isfile(welcomeFilename):
defaultFilename = baseDir + '/defaultwelcome/' + language + '.txt'
if os.path.isfile(defaultFilename):
copyfile(defaultFilename, welcomeFilename)
if os.path.isfile(welcomeFilename):
with open(baseDir + '/accounts/welcome.txt', 'r') as welcomeFile:
welcomeText = welcomeFile.read()
welcomeForm = ''
cssFilename = baseDir + '/epicyon-welcome.css'
if os.path.isfile(baseDir + '/welcome.css'):
cssFilename = baseDir + '/welcome.css'
instanceTitle = \
getConfigParam(baseDir, 'instanceTitle')
welcomeForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
welcomeForm += '<div class="container">' + welcomeText + '</div>\n'
welcomeForm += ' <div class="container next">\n'
welcomeForm += ' <button type="submit" name="submit">' + \
translate['Next'] + '</button>\n'
welcomeForm += ' </div>\n'
welcomeForm += '</div>\n'
welcomeForm += htmlFooter()
return welcomeForm