Mobile links screen

merge-requests/8/head
Bob Mottram 2020-10-12 20:41:53 +01:00
parent 53d9cadfdf
commit 0c3ec272b1
3 changed files with 80 additions and 28 deletions

View File

@ -143,6 +143,7 @@ from webinterface import htmlFollowConfirm
from webinterface import htmlCalendar from webinterface import htmlCalendar
from webinterface import htmlSearch from webinterface import htmlSearch
from webinterface import htmlNewswireMobile from webinterface import htmlNewswireMobile
from webinterface import htmlLinksMobile
from webinterface import htmlSearchEmoji from webinterface import htmlSearchEmoji
from webinterface import htmlSearchEmojiTextEntry from webinterface import htmlSearchEmojiTextEntry
from webinterface import htmlUnfollowConfirm from webinterface import htmlUnfollowConfirm
@ -9083,19 +9084,15 @@ class PubServer(BaseHTTPRequestHandler):
'permitted directory', 'permitted directory',
'login shown done') 'login shown done')
print('TEST1 ' + self.path)
if authorized and htmlGET and '/users/' in self.path and \ if authorized and htmlGET and '/users/' in self.path and \
self.path.endswith('/newswiremobile'): self.path.endswith('/newswiremobile'):
print('TEST2 ' + self.path)
nickname = getNicknameFromActor(self.path) nickname = getNicknameFromActor(self.path)
if not nickname: if not nickname:
self._404() self._404()
self.server.GETbusy = False self.server.GETbusy = False
return return
print('TEST3 ' + nickname)
timelinePath = \ timelinePath = \
'/users/' + nickname + '/' + self.server.defaultTimeline '/users/' + nickname + '/' + self.server.defaultTimeline
print('TEST4 ' + timelinePath)
msg = htmlNewswireMobile(self.server.baseDir, msg = htmlNewswireMobile(self.server.baseDir,
nickname, nickname,
self.server.domain, self.server.domain,
@ -9110,6 +9107,25 @@ class PubServer(BaseHTTPRequestHandler):
self.server.GETbusy = False self.server.GETbusy = False
return 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 # hashtag search
if self.path.startswith('/tags/') or \ if self.path.startswith('/tags/') or \
(authorized and '/tags/' in self.path): (authorized and '/tags/' in self.path):

View File

@ -1541,12 +1541,24 @@ aside .toggle-inside li {
font-size: var(--font-size); font-size: var(--font-size);
line-height: var(--line-spacing); line-height: var(--line-spacing);
} }
.leftColEditImage {
background: var(--main-bg-color);
width: var(--column-left-icon-size);
float: right;
margin: 20px 0px;
}
.rightColEditImage { .rightColEditImage {
background: var(--main-bg-color); background: var(--main-bg-color);
width: var(--column-right-icon-size); width: var(--column-right-icon-size);
float: right; float: right;
margin: 20px 0px; margin: 20px 0px;
} }
.leftColImg {
background: var(--main-bg-color);
width: 100vw;
margin: 0 0;
padding: 0 0;
}
.rightColImg { .rightColImg {
background: var(--main-bg-color); background: var(--main-bg-color);
width: 100vw; width: 100vw;

View File

@ -5381,7 +5381,8 @@ def htmlHighlightLabel(label: str, highlight: bool) -> str:
def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
httpPrefix: str, translate: {}, httpPrefix: str, translate: {},
iconsDir: str, editor: bool) -> str: iconsDir: str, editor: bool,
showBackButton: bool, timelinePath: str) -> str:
"""Returns html content for the left column """Returns html content for the left column
""" """
htmlStr = '' htmlStr = ''
@ -5414,6 +5415,12 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str,
nickname + '/left_col_image.png" />\n' + \ nickname + '/left_col_image.png" />\n' + \
' </center>\n' ' </center>\n'
if showBackButton:
htmlStr += \
' <a href="' + timelinePath + '">' + \
'<button class="cancelbtn">' + \
translate['Go Back'] + '</button></a>\n'
if editImageClass == 'leftColEdit': if editImageClass == 'leftColEdit':
htmlStr += '\n <center>\n' htmlStr += '\n <center>\n'
@ -5659,6 +5666,43 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str,
return htmlStr 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, def htmlNewswireMobile(baseDir: str, nickname: str,
domain: str, domainFull: str, domain: str, domainFull: str,
httpPrefix: str, translate: {}, httpPrefix: str, translate: {},
@ -5674,31 +5718,11 @@ def htmlNewswireMobile(baseDir: str, nickname: str,
if os.path.isfile(baseDir + '/epicyon.css'): if os.path.isfile(baseDir + '/epicyon.css'):
cssFilename = 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 profileStyle = None
with open(cssFilename, 'r') as cssFile: with open(cssFilename, 'r') as cssFile:
# load css # load css
profileStyle = \ profileStyle = \
cssFile.read().replace('banner.png', cssFile.read()
'/users/' + nickname + '/' + bannerFile)
# replace any https within the css with whatever prefix is needed # replace any https within the css with whatever prefix is needed
if httpPrefix != 'https': if httpPrefix != 'https':
profileStyle = \ profileStyle = \
@ -6047,7 +6071,7 @@ def htmlTimeline(defaultTimeline: str,
leftColumnStr = \ leftColumnStr = \
getLeftColumnContent(baseDir, nickname, domainFull, getLeftColumnContent(baseDir, nickname, domainFull,
httpPrefix, translate, iconsDir, httpPrefix, translate, iconsDir,
editor) editor, False, None)
tlStr += ' <td valign="top" class="col-left">' + \ tlStr += ' <td valign="top" class="col-left">' + \
leftColumnStr + ' </td>\n' leftColumnStr + ' </td>\n'
# center column containing posts # center column containing posts
@ -6222,7 +6246,7 @@ def htmlTimeline(defaultTimeline: str,
# the links button to show left column links # the links button to show left column links
tlStr += \ tlStr += \
' <a class="imageAnchorMobile" href="' + \ ' <a class="imageAnchorMobile" href="' + \
usersPath + '/links">' + \ usersPath + '/linksmobile">' + \
'<img loading="lazy" src="/' + iconsDir + \ '<img loading="lazy" src="/' + iconsDir + \
'/links.png" title="' + translate['Edit Links'] + \ '/links.png" title="' + translate['Edit Links'] + \
'" alt="| ' + translate['Edit Links'] + \ '" alt="| ' + translate['Edit Links'] + \