@@ -105,20 +105,7 @@ public function checkFileInfo(string $fileId, string $access_token): JSONRespons
105
105
try {
106
106
$ wopi = $ this ->wopiMapper ->getWopiForToken ($ access_token );
107
107
108
- // TODO: condition for $wopi not found? -auth???
109
-
110
- $ userSettingsUri = $ this ->generateUserSettingsUri ($ wopi );
111
-
112
- if ($ fileId == '-1 ' && $ wopi ->getTokenType () == WOPI ::TOKEN_TYPE_SETTING_AUTH ) {
113
- $ response = [
114
- 'UserSettingsUri ' => $ userSettingsUri ,
115
- ];
116
-
117
- return new JSONResponse ($ response );
118
- }
119
-
120
108
[$ fileId , , $ version ] = Helper::parseFileId ($ fileId );
121
-
122
109
$ file = $ this ->getFileForWopiToken ($ wopi );
123
110
if (!($ file instanceof File)) {
124
111
throw new NotFoundException ('No valid file found for ' . $ fileId );
@@ -142,6 +129,9 @@ public function checkFileInfo(string $fileId, string $access_token): JSONRespons
142
129
$ isSmartPickerEnabled = (bool )$ wopi ->getCanwrite () && !$ isPublic && !$ wopi ->getDirect ();
143
130
$ isTaskProcessingEnabled = $ isSmartPickerEnabled && $ this ->taskProcessingManager ->isTaskProcessingEnabled ();
144
131
132
+ $ userSettings = $ this ->generateSettings ($ wopi , 'userconfig ' );
133
+ $ sharedSettings = $ this ->generateSettings ($ wopi , 'systemconfig ' );
134
+
145
135
// If the file is locked manually by a user we want to open it read only for all others
146
136
$ canWriteThroughLock = true ;
147
137
try {
@@ -182,7 +172,8 @@ public function checkFileInfo(string $fileId, string $access_token): JSONRespons
182
172
'EnableRemoteAIContent ' => $ isTaskProcessingEnabled ,
183
173
'HasContentRange ' => true ,
184
174
'ServerPrivateInfo ' => [],
185
- 'UserSettingsUri ' => $ userSettingsUri ,
175
+ 'UserSettings ' => $ userSettings ,
176
+ // 'SharedSettings' => $sharedSettings,
186
177
];
187
178
188
179
$ enableZotero = $ this ->config ->getAppValue (Application::APPNAME , 'zoteroEnabled ' , 'yes ' ) === 'yes ' ;
@@ -991,8 +982,12 @@ private function generateSettingToken(Wopi $wopi): string {
991
982
return $ res ['token ' ];
992
983
}
993
984
// todo extract nextcloud url from everything
994
- private function generateUserSettingsUri (Wopi $ wopi ): string {
985
+ private function generateSettings (Wopi $ wopi, string $ type ): array {
995
986
$ nextcloudUrl = $ this ->appConfig ->getNextcloudUrl () ?: trim ($ this ->urlGenerator ->getAbsoluteURL ('' ), '/ ' );
996
- return $ nextcloudUrl . '/index.php/apps/richdocuments/wopi/settings ' . '?type=userconfig ' . '&access_token= ' . $ this ->generateSettingToken ($ wopi ) . '&fileId= ' . '-1 ' ;
987
+ $ uri = $ nextcloudUrl . '/index.php/apps/richdocuments/wopi/settings ' . '?type= ' . $ type . '&access_token= ' . $ this ->generateSettingToken ($ wopi ) . '&fileId= ' . '-1 ' ;
988
+ return [
989
+ 'uri ' => $ uri ,
990
+ 'stamp ' => time ()
991
+ ];
997
992
}
998
993
}
0 commit comments