mirror of https://gitlab.com/bashrc2/epicyon
Mobile links screen
parent
53d9cadfdf
commit
0c3ec272b1
24
daemon.py
24
daemon.py
|
@ -143,6 +143,7 @@ from webinterface import htmlFollowConfirm
|
|||
from webinterface import htmlCalendar
|
||||
from webinterface import htmlSearch
|
||||
from webinterface import htmlNewswireMobile
|
||||
from webinterface import htmlLinksMobile
|
||||
from webinterface import htmlSearchEmoji
|
||||
from webinterface import htmlSearchEmojiTextEntry
|
||||
from webinterface import htmlUnfollowConfirm
|
||||
|
@ -9083,19 +9084,15 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
'permitted directory',
|
||||
'login shown done')
|
||||
|
||||
print('TEST1 ' + self.path)
|
||||
if authorized and htmlGET and '/users/' in self.path and \
|
||||
self.path.endswith('/newswiremobile'):
|
||||
print('TEST2 ' + self.path)
|
||||
nickname = getNicknameFromActor(self.path)
|
||||
if not nickname:
|
||||
self._404()
|
||||
self.server.GETbusy = False
|
||||
return
|
||||
print('TEST3 ' + nickname)
|
||||
timelinePath = \
|
||||
'/users/' + nickname + '/' + self.server.defaultTimeline
|
||||
print('TEST4 ' + timelinePath)
|
||||
msg = htmlNewswireMobile(self.server.baseDir,
|
||||
nickname,
|
||||
self.server.domain,
|
||||
|
@ -9110,6 +9107,25 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.GETbusy = False
|
||||
return
|
||||
|
||||
if authorized and htmlGET and '/users/' in self.path and \
|
||||
self.path.endswith('/linksmobile'):
|
||||
nickname = getNicknameFromActor(self.path)
|
||||
if not nickname:
|
||||
self._404()
|
||||
self.server.GETbusy = False
|
||||
return
|
||||
timelinePath = \
|
||||
'/users/' + nickname + '/' + self.server.defaultTimeline
|
||||
msg = htmlLinksMobile(self.server.baseDir, nickname,
|
||||
self.server.domainFull,
|
||||
self.server.httpPrefix,
|
||||
self.server.translate,
|
||||
timelinePath).encode('utf-8')
|
||||
self._set_headers('text/html', len(msg), cookie, callingDomain)
|
||||
self._write(msg)
|
||||
self.server.GETbusy = False
|
||||
return
|
||||
|
||||
# hashtag search
|
||||
if self.path.startswith('/tags/') or \
|
||||
(authorized and '/tags/' in self.path):
|
||||
|
|
|
@ -1541,12 +1541,24 @@ aside .toggle-inside li {
|
|||
font-size: var(--font-size);
|
||||
line-height: var(--line-spacing);
|
||||
}
|
||||
.leftColEditImage {
|
||||
background: var(--main-bg-color);
|
||||
width: var(--column-left-icon-size);
|
||||
float: right;
|
||||
margin: 20px 0px;
|
||||
}
|
||||
.rightColEditImage {
|
||||
background: var(--main-bg-color);
|
||||
width: var(--column-right-icon-size);
|
||||
float: right;
|
||||
margin: 20px 0px;
|
||||
}
|
||||
.leftColImg {
|
||||
background: var(--main-bg-color);
|
||||
width: 100vw;
|
||||
margin: 0 0;
|
||||
padding: 0 0;
|
||||
}
|
||||
.rightColImg {
|
||||
background: var(--main-bg-color);
|
||||
width: 100vw;
|
||||
|
|
|
@ -5381,7 +5381,8 @@ def htmlHighlightLabel(label: str, highlight: bool) -> str:
|
|||
|
||||
def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
|
||||
httpPrefix: str, translate: {},
|
||||
iconsDir: str, editor: bool) -> str:
|
||||
iconsDir: str, editor: bool,
|
||||
showBackButton: bool, timelinePath: str) -> str:
|
||||
"""Returns html content for the left column
|
||||
"""
|
||||
htmlStr = ''
|
||||
|
@ -5414,6 +5415,12 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
|
|||
nickname + '/left_col_image.png" />\n' + \
|
||||
' </center>\n'
|
||||
|
||||
if showBackButton:
|
||||
htmlStr += \
|
||||
' <a href="' + timelinePath + '">' + \
|
||||
'<button class="cancelbtn">' + \
|
||||
translate['Go Back'] + '</button></a>\n'
|
||||
|
||||
if editImageClass == 'leftColEdit':
|
||||
htmlStr += '\n <center>\n'
|
||||
|
||||
|
@ -5659,6 +5666,43 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
|
|||
return htmlStr
|
||||
|
||||
|
||||
def htmlLinksMobile(baseDir: str, nickname: str, domainFull: str,
|
||||
httpPrefix: str, translate,
|
||||
timelinePath: str) -> str:
|
||||
"""Show the left column links within mobile view
|
||||
"""
|
||||
htmlStr = ''
|
||||
|
||||
# the css filename
|
||||
cssFilename = baseDir + '/epicyon-profile.css'
|
||||
if os.path.isfile(baseDir + '/epicyon.css'):
|
||||
cssFilename = baseDir + '/epicyon.css'
|
||||
|
||||
profileStyle = None
|
||||
with open(cssFilename, 'r') as cssFile:
|
||||
# load css
|
||||
profileStyle = \
|
||||
cssFile.read()
|
||||
# replace any https within the css with whatever prefix is needed
|
||||
if httpPrefix != 'https':
|
||||
profileStyle = \
|
||||
profileStyle.replace('https://', httpPrefix + '://')
|
||||
|
||||
iconsDir = getIconsDir(baseDir)
|
||||
|
||||
# is the user a site editor?
|
||||
editor = isEditor(baseDir, nickname)
|
||||
|
||||
htmlStr = htmlHeader(cssFilename, profileStyle)
|
||||
htmlStr += \
|
||||
getLeftColumnContent(baseDir, nickname, domainFull,
|
||||
httpPrefix, translate,
|
||||
iconsDir, editor,
|
||||
True, timelinePath)
|
||||
htmlStr += htmlFooter()
|
||||
return htmlStr
|
||||
|
||||
|
||||
def htmlNewswireMobile(baseDir: str, nickname: str,
|
||||
domain: str, domainFull: str,
|
||||
httpPrefix: str, translate: {},
|
||||
|
@ -5674,31 +5718,11 @@ def htmlNewswireMobile(baseDir: str, nickname: str,
|
|||
if os.path.isfile(baseDir + '/epicyon.css'):
|
||||
cssFilename = baseDir + '/epicyon.css'
|
||||
|
||||
# filename of the banner shown at the top
|
||||
bannerFile = 'banner.png'
|
||||
bannerFilename = baseDir + '/accounts/' + \
|
||||
nickname + '@' + domain + '/' + bannerFile
|
||||
if not os.path.isfile(bannerFilename):
|
||||
bannerFile = 'banner.jpg'
|
||||
bannerFilename = baseDir + '/accounts/' + \
|
||||
nickname + '@' + domain + '/' + bannerFile
|
||||
if not os.path.isfile(bannerFilename):
|
||||
bannerFile = 'banner.gif'
|
||||
bannerFilename = baseDir + '/accounts/' + \
|
||||
nickname + '@' + domain + '/' + bannerFile
|
||||
if not os.path.isfile(bannerFilename):
|
||||
bannerFile = 'banner.avif'
|
||||
bannerFilename = baseDir + '/accounts/' + \
|
||||
nickname + '@' + domain + '/' + bannerFile
|
||||
if not os.path.isfile(bannerFilename):
|
||||
bannerFile = 'banner.webp'
|
||||
|
||||
profileStyle = None
|
||||
with open(cssFilename, 'r') as cssFile:
|
||||
# load css
|
||||
profileStyle = \
|
||||
cssFile.read().replace('banner.png',
|
||||
'/users/' + nickname + '/' + bannerFile)
|
||||
cssFile.read()
|
||||
# replace any https within the css with whatever prefix is needed
|
||||
if httpPrefix != 'https':
|
||||
profileStyle = \
|
||||
|
@ -6047,7 +6071,7 @@ def htmlTimeline(defaultTimeline: str,
|
|||
leftColumnStr = \
|
||||
getLeftColumnContent(baseDir, nickname, domainFull,
|
||||
httpPrefix, translate, iconsDir,
|
||||
editor)
|
||||
editor, False, None)
|
||||
tlStr += ' <td valign="top" class="col-left">' + \
|
||||
leftColumnStr + ' </td>\n'
|
||||
# center column containing posts
|
||||
|
@ -6222,7 +6246,7 @@ def htmlTimeline(defaultTimeline: str,
|
|||
# the links button to show left column links
|
||||
tlStr += \
|
||||
' <a class="imageAnchorMobile" href="' + \
|
||||
usersPath + '/links">' + \
|
||||
usersPath + '/linksmobile">' + \
|
||||
'<img loading="lazy" src="/' + iconsDir + \
|
||||
'/links.png" title="' + translate['Edit Links'] + \
|
||||
'" alt="| ' + translate['Edit Links'] + \
|
||||
|
|
Loading…
Reference in New Issue