forked from indymedia/epicyon
Add an instance identifier
parent
b4cd2b926a
commit
0fb0f89462
|
@ -123,6 +123,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
if cookie:
|
||||
self.send_header('Cookie', cookie)
|
||||
self.send_header('Host', self.server.domainFull)
|
||||
self.send_header('InstanceID', self.server.instanceId)
|
||||
self.end_headers()
|
||||
|
||||
def _redirect_headers(self,redirect: str,cookie: str) -> None:
|
||||
|
@ -132,6 +133,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.send_header('Cookie', cookie)
|
||||
self.send_header('Location', redirect)
|
||||
self.send_header('Host', self.server.domainFull)
|
||||
self.send_header('InstanceID', self.server.instanceId)
|
||||
self.end_headers()
|
||||
|
||||
def _404(self) -> None:
|
||||
|
@ -2101,7 +2103,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.end_headers()
|
||||
self.server.POSTbusy=False
|
||||
|
||||
def runDaemon(clientToServer: bool,baseDir: str,domain: str, \
|
||||
def runDaemon(instanceId,clientToServer: bool, \
|
||||
baseDir: str,domain: str, \
|
||||
port=80,httpPrefix='https', \
|
||||
fedList=[],noreply=False,nolike=False,nopics=False, \
|
||||
noannounce=False,cw=False,ocapAlways=False, \
|
||||
|
@ -2128,6 +2131,7 @@ def runDaemon(clientToServer: bool,baseDir: str,domain: str, \
|
|||
httpd.debug=debug
|
||||
httpd.federationList=fedList.copy()
|
||||
httpd.baseDir=baseDir
|
||||
httpd.instanceId=instanceId
|
||||
httpd.personCache={}
|
||||
httpd.cachedWebfingers={}
|
||||
httpd.useTor=useTor
|
||||
|
|
10
epicyon.py
10
epicyon.py
|
@ -310,6 +310,13 @@ if args.domain:
|
|||
domain=args.domain
|
||||
setConfigParam(baseDir,'domain',domain)
|
||||
|
||||
# unique ID for the instance
|
||||
instanceId=getConfigParam(baseDir,'instanceId')
|
||||
if not instanceId:
|
||||
instanceId=createPassword(32)
|
||||
setConfigParam(baseDir,'instanceId',instanceId)
|
||||
print('Instance ID: '+instanceId)
|
||||
|
||||
# get domain name from configuration
|
||||
configDomain=getConfigParam(baseDir,'domain')
|
||||
if configDomain:
|
||||
|
@ -1196,7 +1203,8 @@ if args.testdata:
|
|||
followerOfPerson(baseDir,nickname,domain,'drokk',domainFull,federationList,False)
|
||||
followerOfPerson(baseDir,nickname,domain,'maxboardroom',domainFull,federationList,False)
|
||||
|
||||
runDaemon(args.client,baseDir,domain,port,httpPrefix, \
|
||||
runDaemon(instanceId,args.client,baseDir, \
|
||||
domain,port,httpPrefix, \
|
||||
federationList, \
|
||||
args.noreply,args.nolike,args.nopics, \
|
||||
args.noannounce,args.cw,ocapAlways, \
|
||||
|
|
6
tests.py
6
tests.py
|
@ -181,7 +181,7 @@ def createServerAlice(path: str,domain: str,port: int,federationList: [], \
|
|||
global testServerAliceRunning
|
||||
testServerAliceRunning = True
|
||||
print('Server running: Alice')
|
||||
runDaemon(False,path,domain,port,httpPrefix,federationList, \
|
||||
runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \
|
||||
noreply,nolike,nopics,noannounce,cw,ocapAlways, \
|
||||
useTor,maxReplies, \
|
||||
domainMaxPostsPerDay,accountMaxPostsPerDay, \
|
||||
|
@ -233,7 +233,7 @@ def createServerBob(path: str,domain: str,port: int,federationList: [], \
|
|||
global testServerBobRunning
|
||||
testServerBobRunning = True
|
||||
print('Server running: Bob')
|
||||
runDaemon(False,path,domain,port,httpPrefix,federationList, \
|
||||
runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \
|
||||
noreply,nolike,nopics,noannounce,cw,ocapAlways, \
|
||||
useTor,maxReplies, \
|
||||
domainMaxPostsPerDay,accountMaxPostsPerDay, \
|
||||
|
@ -265,7 +265,7 @@ def createServerEve(path: str,domain: str,port: int,federationList: [], \
|
|||
global testServerEveRunning
|
||||
testServerEveRunning = True
|
||||
print('Server running: Eve')
|
||||
runDaemon(False,path,domain,port,httpPrefix,federationList, \
|
||||
runDaemon("instanceId",False,path,domain,port,httpPrefix,federationList, \
|
||||
noreply,nolike,nopics,noannounce,cw,ocapAlways, \
|
||||
useTor,maxReplies,allowDeletion,True)
|
||||
|
||||
|
|
Loading…
Reference in New Issue