Skip to content

Commit b959a94

Browse files
committed
Moved apps-specific config options to dedicated section
1 parent 1dfa3ca commit b959a94

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

src/core/wopi.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def checkFileInfo(fileid, acctok):
3434
acctok['viewmode'] = utils.ViewMode(acctok['viewmode'])
3535
acctok['usertype'] = utils.UserType(acctok['usertype'])
3636
statInfo = st.statx(acctok['endpoint'], acctok['filename'], acctok['userid'])
37+
3738
# populate metadata for this file
3839
fmd = {}
3940
fmd['BaseFileName'] = fmd['BreadcrumbDocName'] = os.path.basename(acctok['filename'])
@@ -77,7 +78,7 @@ def checkFileInfo(fileid, acctok):
7778
if acctok['viewmode'] != utils.ViewMode.VIEW_ONLY and srv.config.get('general', 'downloadurl', fallback=None):
7879
fmd['DownloadUrl'] = fmd['FileUrl'] = '%s?access_token=%s' % \
7980
(srv.config.get('general', 'downloadurl'), flask.request.args['access_token'])
80-
if srv.config.get('general', 'businessflow', fallback='True').upper() == 'TRUE':
81+
if srv.config.get('apps', 'businessflow', fallback='True').upper() == 'TRUE':
8182
# according to Microsoft, this must be enabled for all users
8283
fmd['LicenseCheckForEditIsEnabled'] = True
8384
fmd['BreadcrumbBrandName'] = srv.config.get('general', 'brandingname', fallback=None)
@@ -105,11 +106,11 @@ def checkFileInfo(fileid, acctok):
105106
uinfo = statInfo['xattrs'].get(utils.USERINFOKEY + '.' + acctok['wopiuser'].split('!')[0])
106107
if uinfo:
107108
fmd['UserInfo'] = uinfo
108-
if srv.config.get('general', 'earlyfeatures', fallback='False').upper() == 'TRUE':
109-
fmd['AllowEarlyFeatures'] = True
110-
fmd['ComplianceDomainPrefix'] = srv.config.get('general', 'compliancedomain', fallback='euc')
111109

112110
# populate app-specific metadata
111+
if srv.config.get('apps', 'earlyfeatures', fallback='False').upper() == 'TRUE':
112+
fmd['AllowEarlyFeatures'] = True
113+
fmd['ComplianceDomainPrefix'] = srv.config.get('apps', 'compliancedomain', fallback='euc')
113114
# the following is to enable the 'Edit in Word/Excel/PowerPoint' (desktop) action (probably broken)
114115
try:
115116
fmd['ClientUrl'] = srv.config.get('general', 'webdavurl') + '/' + acctok['filename']

src/wopiserver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ def init(cls):
124124
# prepare the Flask web app
125125
cls.port = int(cls.config.get('general', 'port'))
126126
try:
127-
cls.nonofficetypes = cls.config.get('general', 'nonofficetypes').split()
127+
cls.nonofficetypes = cls.config.get('apps', 'nonofficetypes').split()
128128
except (TypeError, configparser.NoOptionError):
129129
cls.nonofficetypes = []
130-
cls.codetypes = cls.config.get('general', 'codeofficetypes', fallback='.odt .ods .odp').split()
130+
cls.codetypes = cls.config.get('apps', 'codeofficetypes', fallback='.odt .ods .odp').split()
131131
with open(cls.config.get('security', 'wopisecretfile')) as s:
132132
cls.wopisecret = s.read().strip('\n')
133133
with open(cls.config.get('security', 'iopsecretfile')) as s:
@@ -366,7 +366,7 @@ def iopOpenInApp():
366366
res['app-url'] = appurl if vm == utils.ViewMode.READ_WRITE else appviewurl
367367
res['app-url'] += '%sWOPISrc=%s' % ('&' if '?' in res['app-url'] else '?',
368368
utils.generateWopiSrc(inode, appname == Wopi.proxiedappname))
369-
if Wopi.config.get('general', 'businessflow', fallback='False').upper() == 'TRUE':
369+
if Wopi.config.get('apps', 'businessflow', fallback='False').upper() == 'TRUE':
370370
# tells the app to enable the business flow if appropriate
371371
res['app-url'] += '&IsLicensedUser=1'
372372
res['form-parameters'] = {'access_token': acctok}

wopiserver.conf

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ loghandler = file
7272
# Optional URL to a privacy notice for this service
7373
#privacyurl = https://your-organization/path/to/privacy-notice
7474

75-
# List of file extensions deemed incompatible with LibreOffice:
76-
# interoperable locking will be disabled for such files
77-
nonofficetypes = .md .zmd .txt
78-
79-
# List of file extensions supported by Collabora
80-
codeofficetypes = .odt .ott .ods .ots .odp .otp .odg .otg .doc .dot .xls .xlt .xlm .ppt .pot .pps .vsd .dxf .wmf .cdr .pages .number .key
81-
8275
# WOPI access token expiration time [seconds]
8376
#tokenvalidity = 86400
8477

@@ -134,6 +127,14 @@ codeofficetypes = .odt .ott .ods .ots .odp .otp .odg .otg .doc .dot .xls .xlt .x
134127
#wopiproxysecretfile = /path/to/your/shared-key-file
135128
#proxiedappname = Name of your proxied app
136129

130+
[apps]
131+
# List of file extensions deemed incompatible with LibreOffice:
132+
# interoperable locking will be disabled for such files
133+
nonofficetypes = .md .zmd .txt
134+
135+
# List of file extensions supported by Collabora
136+
codeofficetypes = .odt .ott .ods .ots .odp .otp .odg .otg .doc .dot .xls .xlt .xlm .ppt .pot .pps .vsd .dxf .wmf .cdr .pages .number .key
137+
137138
# A flag to disable the business flow with Microsoft Office 365 as detailed in:
138139
# https://learn.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/online/scenarios/business
139140
# Note that this must stay enabled if this wopiserver is to serve Microsoft Office 365.

0 commit comments

Comments
 (0)