plugin XEP-0329: added FISCreateDir method:
This method is used to create a directory for component file sharing, and optionally set its configuration.
This commit is contained in:
parent
a82f7108a2
commit
f321952cbe
1 changed files with 136 additions and 16 deletions
|
|
@ -391,8 +391,6 @@ class FileSharing:
|
|||
client._file_sharing_base_url = f"https://{client.host}:{self.http_port}"
|
||||
else:
|
||||
client._file_sharing_base_url = public_base_url
|
||||
client._file_sharing_allowed_hosts = self.host.memory.getConfig(
|
||||
'component file_sharing', 'http_upload_allowed_hosts_list') or [client.host]
|
||||
path = client.file_tmp_dir = os.path.join(
|
||||
self.host.memory.getConfig("", "local_dir"),
|
||||
C.FILES_TMP_DIR,
|
||||
|
|
@ -596,6 +594,7 @@ class FileSharing:
|
|||
def _onHTTPUpload(self, client, request):
|
||||
# filename should be already cleaned, but it's better to double check
|
||||
assert '/' not in request.filename
|
||||
# client._file_sharing_allowed_hosts is set in plugin XEP-0329
|
||||
if request.from_.host not in client._file_sharing_allowed_hosts:
|
||||
raise error.StanzaError("forbidden")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue