mirror of https://gitlab.com/bashrc2/epicyon
Full path on shares images
parent
eeba9b5214
commit
8572c235f1
13
daemon.py
13
daemon.py
|
@ -382,12 +382,13 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# if not authorized then show the login screen
|
# if not authorized then show the login screen
|
||||||
if self.headers.get('Accept'):
|
if self.headers.get('Accept'):
|
||||||
if 'text/html' in self.headers['Accept'] and self.path!='/login':
|
if 'text/html' in self.headers['Accept'] and self.path!='/login':
|
||||||
if not authorized:
|
if '/media/' not in self.path and 'sharefiles' not in self.path:
|
||||||
self.send_response(303)
|
if not authorized:
|
||||||
self.send_header('Location', '/login')
|
self.send_response(303)
|
||||||
self.end_headers()
|
self.send_header('Location', '/login')
|
||||||
self.server.POSTbusy=False
|
self.end_headers()
|
||||||
return
|
self.server.POSTbusy=False
|
||||||
|
return
|
||||||
|
|
||||||
# get css
|
# get css
|
||||||
# Note that this comes before the busy flag to avoid conflicts
|
# Note that this comes before the busy flag to avoid conflicts
|
||||||
|
|
|
@ -1154,7 +1154,8 @@ if args.testdata:
|
||||||
setRole(baseDir,nickname,domain,'someproject','assistant')
|
setRole(baseDir,nickname,domain,'someproject','assistant')
|
||||||
setAvailability(baseDir,nickname,domain,'busy')
|
setAvailability(baseDir,nickname,domain,'busy')
|
||||||
|
|
||||||
addShare(baseDir,nickname,domain, \
|
addShare(baseDir, \
|
||||||
|
httpPrefix,nickname,domain,port, \
|
||||||
"spanner", \
|
"spanner", \
|
||||||
"It's a spanner", \
|
"It's a spanner", \
|
||||||
"img/shares1.png", \
|
"img/shares1.png", \
|
||||||
|
@ -1163,7 +1164,8 @@ if args.testdata:
|
||||||
"City", \
|
"City", \
|
||||||
"2 months",
|
"2 months",
|
||||||
debug)
|
debug)
|
||||||
addShare(baseDir,nickname,domain, \
|
addShare(baseDir, \
|
||||||
|
httpPrefix,nickname,domain,port, \
|
||||||
"witch hat", \
|
"witch hat", \
|
||||||
"Spooky", \
|
"Spooky", \
|
||||||
"img/shares2.png", \
|
"img/shares2.png", \
|
||||||
|
|
15
shares.py
15
shares.py
|
@ -45,7 +45,8 @@ def removeShare(baseDir: str,nickname: str,domain: str, \
|
||||||
with open(sharesFilename, 'w') as fp:
|
with open(sharesFilename, 'w') as fp:
|
||||||
commentjson.dump(sharesJson, fp, indent=4, sort_keys=True)
|
commentjson.dump(sharesJson, fp, indent=4, sort_keys=True)
|
||||||
|
|
||||||
def addShare(baseDir: str,nickname: str,domain: str, \
|
def addShare(baseDir: str, \
|
||||||
|
httpPrefix: str,nickname: str,domain: str,port: int, \
|
||||||
displayName: str, \
|
displayName: str, \
|
||||||
summary: str, \
|
summary: str, \
|
||||||
imageFilename: str, \
|
imageFilename: str, \
|
||||||
|
@ -99,6 +100,9 @@ def addShare(baseDir: str,nickname: str,domain: str, \
|
||||||
# copy or move the image for the shared item to its destination
|
# copy or move the image for the shared item to its destination
|
||||||
if imageFilename:
|
if imageFilename:
|
||||||
if os.path.isfile(imageFilename):
|
if os.path.isfile(imageFilename):
|
||||||
|
domainFull=domain
|
||||||
|
if port!=80 and port!=443:
|
||||||
|
domainFull=domain+':'+str(port)
|
||||||
if not os.path.isdir(baseDir+'/sharefiles'):
|
if not os.path.isdir(baseDir+'/sharefiles'):
|
||||||
os.mkdir(baseDir+'/sharefiles')
|
os.mkdir(baseDir+'/sharefiles')
|
||||||
if not os.path.isdir(baseDir+'/sharefiles/'+nickname):
|
if not os.path.isdir(baseDir+'/sharefiles/'+nickname):
|
||||||
|
@ -108,17 +112,17 @@ def addShare(baseDir: str,nickname: str,domain: str, \
|
||||||
removeMetaData(imageFilename,itemIDfile+'.png')
|
removeMetaData(imageFilename,itemIDfile+'.png')
|
||||||
if moveImage:
|
if moveImage:
|
||||||
os.remove(imageFilename)
|
os.remove(imageFilename)
|
||||||
imageUrl='/sharefiles/'+nickname+'/'+itemID+'.png'
|
imageUrl=httpPrefix+'://'+domainFull+'/sharefiles/'+nickname+'/'+itemID+'.png'
|
||||||
if imageFilename.endswith('.jpg'):
|
if imageFilename.endswith('.jpg'):
|
||||||
removeMetaData(imageFilename,itemIDfile+'.jpg')
|
removeMetaData(imageFilename,itemIDfile+'.jpg')
|
||||||
if moveImage:
|
if moveImage:
|
||||||
os.remove(imageFilename)
|
os.remove(imageFilename)
|
||||||
imageUrl='/sharefiles/'+nickname+'/'+itemID+'.jpg'
|
imageUrl=httpPrefix+'://'+domainFull+'/sharefiles/'+nickname+'/'+itemID+'.jpg'
|
||||||
if imageFilename.endswith('.gif'):
|
if imageFilename.endswith('.gif'):
|
||||||
removeMetaData(imageFilename,itemIDfile+'.gif')
|
removeMetaData(imageFilename,itemIDfile+'.gif')
|
||||||
if moveImage:
|
if moveImage:
|
||||||
os.remove(imageFilename)
|
os.remove(imageFilename)
|
||||||
imageUrl='/sharefiles/'+nickname+'/'+itemID+'.gif'
|
imageUrl=httpPrefix+'://'+domainFull+'/sharefiles/'+nickname+'/'+itemID+'.gif'
|
||||||
|
|
||||||
sharesJson[itemID] = {
|
sharesJson[itemID] = {
|
||||||
"displayName": displayName,
|
"displayName": displayName,
|
||||||
|
@ -469,7 +473,8 @@ def outboxShareUpload(baseDir: str,httpPrefix: str, \
|
||||||
if debug:
|
if debug:
|
||||||
print('DEBUG: duration missing from Offer')
|
print('DEBUG: duration missing from Offer')
|
||||||
return
|
return
|
||||||
addShare(baseDir,nickname,domain, \
|
addShare(baseDir, \
|
||||||
|
httpPrefix,nickname,domain,port, \
|
||||||
messageJson['object']['displayName'], \
|
messageJson['object']['displayName'], \
|
||||||
messageJson['object']['summary'], \
|
messageJson['object']['summary'], \
|
||||||
messageJson['object']['imageFilename'], \
|
messageJson['object']['imageFilename'], \
|
||||||
|
|
Loading…
Reference in New Issue