forked from indymedia/epicyon
Showing image attachments
parent
2b3a947265
commit
8b3b71d942
|
@ -1,3 +1,5 @@
|
||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
|
@ -31,6 +33,12 @@ body {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container img.attachment {
|
||||||
|
max-width: 100%;
|
||||||
|
margin-left: 25%;
|
||||||
|
width: 50%;
|
||||||
|
border-radius: 0%;
|
||||||
|
}
|
||||||
.container img.right {
|
.container img.right {
|
||||||
float: right;
|
float: right;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
|
|
|
@ -1056,8 +1056,8 @@ if args.testdata:
|
||||||
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"like, this is totally just a test, man",False,True,False,None,None,useBlurhash)
|
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"like, this is totally just a test, man",False,True,False,None,None,useBlurhash)
|
||||||
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"Zoiks!!!",False,True,False,None,None,useBlurhash)
|
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"Zoiks!!!",False,True,False,None,None,useBlurhash)
|
||||||
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"Hey scoob we need like a hundred more milkshakes",False,True,False,None,None,useBlurhash)
|
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"Hey scoob we need like a hundred more milkshakes",False,True,False,None,None,useBlurhash)
|
||||||
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"Getting kinda spooky around here",False,True,False,None,None,useBlurhash)
|
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"Getting kinda spooky around here",False,True,False,None,None,useBlurhash,'someone')
|
||||||
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"And they would have gotten away with it too if it wasn't for those pesky hackers",False,True,False,None,None,useBlurhash)
|
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"And they would have gotten away with it too if it wasn't for those pesky hackers",False,True,False,'img/logo.png','Description of image',useBlurhash)
|
||||||
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"man, these centralized sites are, like, the worst!",False,True,False,None,None,useBlurhash)
|
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"man, these centralized sites are, like, the worst!",False,True,False,None,None,useBlurhash)
|
||||||
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"another mystery solved hey",False,True,False,None,None,useBlurhash)
|
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"another mystery solved hey",False,True,False,None,None,useBlurhash)
|
||||||
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"let's go bowling",False,True,False,None,None,useBlurhash)
|
createPublicPost(baseDir,nickname,domain,port,httpPrefix,"let's go bowling",False,True,False,None,None,useBlurhash)
|
||||||
|
|
|
@ -41,11 +41,42 @@ def htmlFollowers(followersJson: {}) -> str:
|
||||||
return htmlHeader()+"<h1>Followers collection</h1>"+htmlFooter()
|
return htmlHeader()+"<h1>Followers collection</h1>"+htmlFooter()
|
||||||
|
|
||||||
def individualPostAsHtml(postJsonObject: {}) -> str:
|
def individualPostAsHtml(postJsonObject: {}) -> str:
|
||||||
|
avatarPosition=''
|
||||||
|
containerClass='container'
|
||||||
|
timeClass='time-right'
|
||||||
|
if postJsonObject['object']['inReplyTo']:
|
||||||
|
containerClass='container darker'
|
||||||
|
avatarPosition=' class="right"'
|
||||||
|
timeClass='time-left'
|
||||||
|
attachmentStr=''
|
||||||
|
if postJsonObject['object']['attachment']:
|
||||||
|
if isinstance(postJsonObject['object']['attachment'], list):
|
||||||
|
attachmentCtr=0
|
||||||
|
for attach in postJsonObject['object']['attachment']:
|
||||||
|
if attach.get('mediaType') and attach.get('url'):
|
||||||
|
mediaType=attach['mediaType']
|
||||||
|
imageDescription=''
|
||||||
|
if attach.get('name'):
|
||||||
|
imageDescription=attach['name']
|
||||||
|
if mediaType=='image/png' or \
|
||||||
|
mediaType=='image/jpeg' or \
|
||||||
|
mediaType=='image/gif':
|
||||||
|
if attach['url'].endswith('.png') or \
|
||||||
|
attach['url'].endswith('.jpg') or \
|
||||||
|
attach['url'].endswith('.jpeg') or \
|
||||||
|
attach['url'].endswith('.gif'):
|
||||||
|
if attachmentCtr>0:
|
||||||
|
attachmentStr+='<br>'
|
||||||
|
attachmentStr+= \
|
||||||
|
'<img src="'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" class="attachment">\n'
|
||||||
|
attachmentCtr+=1
|
||||||
|
|
||||||
return \
|
return \
|
||||||
'<div class="container">\n' \
|
'<div class="'+containerClass+'">\n' \
|
||||||
'<img src="'+postJsonObject['actor']+'/avatar.png" alt="Avatar">\n'+ \
|
'<img src="'+postJsonObject['actor']+'/avatar.png" alt="Avatar"'+avatarPosition+'>\n'+ \
|
||||||
postJsonObject['object']['content']+'\n'+ \
|
postJsonObject['object']['content']+'\n'+ \
|
||||||
'<span class="time-right">'+postJsonObject['object']['published']+'</span>\n' \
|
attachmentStr+ \
|
||||||
|
'<span class="'+timeClass+'">'+postJsonObject['object']['published']+'</span>\n'+ \
|
||||||
'</div>\n'
|
'</div>\n'
|
||||||
|
|
||||||
def htmlTimeline(timelineJson: {}) -> str:
|
def htmlTimeline(timelineJson: {}) -> str:
|
||||||
|
|
Loading…
Reference in New Issue