mirror of https://gitlab.com/bashrc2/epicyon
Refresh newswire after removing or suspending an account
parent
8532e71cc1
commit
5ef5174fee
|
@ -218,6 +218,7 @@ from utils import loadJson
|
|||
from utils import saveJson
|
||||
from utils import isSuspended
|
||||
from utils import dangerousMarkup
|
||||
from utils import refreshNewswire
|
||||
from manualapprove import manualDenyFollowRequest
|
||||
from manualapprove import manualApproveFollowRequest
|
||||
from announce import createAnnounce
|
||||
|
@ -255,7 +256,6 @@ from newswire import rss2Footer
|
|||
from newswire import loadHashtagCategories
|
||||
from newsdaemon import runNewswireWatchdog
|
||||
from newsdaemon import runNewswireDaemon
|
||||
from newsdaemon import refreshNewswire
|
||||
from filters import isFiltered
|
||||
from filters import addGlobalFilter
|
||||
from filters import removeGlobalFilter
|
||||
|
|
|
@ -750,15 +750,3 @@ def runNewswireWatchdog(projectVersion: str, httpd) -> None:
|
|||
newswireOriginal.clone(runNewswireDaemon)
|
||||
httpd.thrNewswireDaemon.start()
|
||||
print('Restarting newswire daemon...')
|
||||
|
||||
|
||||
def refreshNewswire(baseDir: str) -> None:
|
||||
"""Causes the newswire to be updated.
|
||||
This creates a file which is then detected by the daemon
|
||||
"""
|
||||
refreshFilename = baseDir + '/accounts/.refresh_newswire'
|
||||
if os.path.isfile(refreshFilename):
|
||||
return
|
||||
refreshFile = open(refreshFilename, 'w+')
|
||||
refreshFile.write('\n')
|
||||
refreshFile.close()
|
||||
|
|
|
@ -40,6 +40,7 @@ from utils import loadJson
|
|||
from utils import saveJson
|
||||
from utils import setConfigParam
|
||||
from utils import getConfigParam
|
||||
from utils import refreshNewswire
|
||||
|
||||
|
||||
def generateRSAKey() -> (str, str):
|
||||
|
@ -915,6 +916,9 @@ def removeAccount(baseDir: str, nickname: str,
|
|||
os.remove(baseDir + '/wfdeactivated/' + handle + '.json')
|
||||
if os.path.isdir(baseDir + '/sharefilesdeactivated/' + nickname):
|
||||
shutil.rmtree(baseDir + '/sharefilesdeactivated/' + nickname)
|
||||
|
||||
refreshNewswire(baseDir)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
@ -944,6 +948,9 @@ def deactivateAccount(baseDir: str, nickname: str, domain: str) -> bool:
|
|||
os.mkdir(deactivatedSharefilesDir)
|
||||
shutil.move(baseDir + '/sharefiles/' + nickname,
|
||||
deactivatedSharefilesDir + '/' + nickname)
|
||||
|
||||
refreshNewswire(baseDir)
|
||||
|
||||
return os.path.isdir(deactivatedDir + '/' + nickname + '@' + domain)
|
||||
|
||||
|
||||
|
@ -970,6 +977,8 @@ def activateAccount(baseDir: str, nickname: str, domain: str) -> None:
|
|||
shutil.move(deactivatedSharefilesDir + '/' + nickname,
|
||||
baseDir + '/sharefiles/' + nickname)
|
||||
|
||||
refreshNewswire(baseDir)
|
||||
|
||||
|
||||
def isPersonSnoozed(baseDir: str, nickname: str, domain: str,
|
||||
snoozeActor: str) -> bool:
|
||||
|
|
11
utils.py
11
utils.py
|
@ -26,6 +26,17 @@ invalidCharacters = (
|
|||
)
|
||||
|
||||
|
||||
def refreshNewswire(baseDir: str):
|
||||
"""Causes the newswire to be updates after a change to user accounts
|
||||
"""
|
||||
refreshNewswireFilename = baseDir + '/accounts/.refresh_newswire'
|
||||
if os.path.isfile(refreshNewswireFilename):
|
||||
return
|
||||
refreshFile = open(refreshNewswireFilename, 'w+')
|
||||
refreshFile.write('\n')
|
||||
refreshFile.close()
|
||||
|
||||
|
||||
def getSHA256(msg: str):
|
||||
"""Returns a SHA256 hash of the given string
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue