@@ -33,6 +33,9 @@ func ServeAPI(ginServer *gin.Engine) {
33
33
ginServer .Handle ("POST" , "/api/system/loginAuth" , model .LoginAuth )
34
34
ginServer .Handle ("POST" , "/api/system/logoutAuth" , model .LogoutAuth )
35
35
ginServer .Handle ("GET" , "/api/system/getCaptcha" , model .GetCaptcha )
36
+ ginServer .Handle ("POST" , "/api/system/setUILayout" , setUILayout ) // 这里不加鉴权 After modifying the access authentication code on the browser side, the other side does not refresh https://github.com/siyuan-note/siyuan/issues/8028
37
+
38
+ ginServer .Handle ("GET" , "/snippets/*filepath" , serveSnippets )
36
39
37
40
// 需要鉴权
38
41
@@ -56,15 +59,14 @@ func ServeAPI(ginServer *gin.Engine) {
56
59
ginServer .Handle ("POST" , "/api/system/setAppearanceMode" , model .CheckAuth , setAppearanceMode )
57
60
ginServer .Handle ("POST" , "/api/system/getSysFonts" , model .CheckAuth , getSysFonts )
58
61
ginServer .Handle ("POST" , "/api/system/exit" , model .CheckAuth , exit )
59
- ginServer .Handle ("POST" , "/api/system/setUILayout" , setUILayout ) // 这里不加鉴权 After modifying the access authentication code on the browser side, the other side does not refresh https://github.com/siyuan-note/siyuan/issues/8028
60
62
ginServer .Handle ("POST" , "/api/system/getConf" , model .CheckAuth , getConf )
61
63
ginServer .Handle ("POST" , "/api/system/checkUpdate" , model .CheckAuth , checkUpdate )
62
64
ginServer .Handle ("POST" , "/api/system/exportLog" , model .CheckAuth , exportLog )
63
65
ginServer .Handle ("POST" , "/api/system/getChangelog" , model .CheckAuth , getChangelog )
64
66
65
- ginServer .Handle ("POST" , "/api/storage/setLocalStorage" , model .CheckAuth , setLocalStorage )
67
+ ginServer .Handle ("POST" , "/api/storage/setLocalStorage" , model .CheckAuth , model . CheckReadonly , setLocalStorage )
66
68
ginServer .Handle ("POST" , "/api/storage/getLocalStorage" , model .CheckAuth , getLocalStorage )
67
- ginServer .Handle ("POST" , "/api/storage/setLocalStorageVal" , model .CheckAuth , setLocalStorageVal )
69
+ ginServer .Handle ("POST" , "/api/storage/setLocalStorageVal" , model .CheckAuth , model . CheckReadonly , setLocalStorageVal )
68
70
ginServer .Handle ("POST" , "/api/storage/removeLocalStorageVals" , model .CheckAuth , model .CheckReadonly , removeLocalStorageVals )
69
71
ginServer .Handle ("POST" , "/api/storage/setCriterion" , model .CheckAuth , model .CheckReadonly , setCriterion )
70
72
ginServer .Handle ("POST" , "/api/storage/getCriteria" , model .CheckAuth , getCriteria )
@@ -78,12 +80,12 @@ func ServeAPI(ginServer *gin.Engine) {
78
80
ginServer .Handle ("POST" , "/api/account/startFreeTrial" , model .CheckAuth , model .CheckReadonly , startFreeTrial )
79
81
80
82
ginServer .Handle ("POST" , "/api/notebook/lsNotebooks" , model .CheckAuth , lsNotebooks )
81
- ginServer .Handle ("POST" , "/api/notebook/openNotebook" , model .CheckAuth , openNotebook )
83
+ ginServer .Handle ("POST" , "/api/notebook/openNotebook" , model .CheckAuth , model . CheckReadonly , openNotebook )
82
84
ginServer .Handle ("POST" , "/api/notebook/closeNotebook" , model .CheckAuth , model .CheckReadonly , closeNotebook )
83
85
ginServer .Handle ("POST" , "/api/notebook/getNotebookConf" , model .CheckAuth , getNotebookConf )
84
86
ginServer .Handle ("POST" , "/api/notebook/setNotebookConf" , model .CheckAuth , model .CheckReadonly , setNotebookConf )
85
87
ginServer .Handle ("POST" , "/api/notebook/createNotebook" , model .CheckAuth , model .CheckReadonly , createNotebook )
86
- ginServer .Handle ("POST" , "/api/notebook/removeNotebook" , model .CheckAuth , removeNotebook )
88
+ ginServer .Handle ("POST" , "/api/notebook/removeNotebook" , model .CheckAuth , model . CheckReadonly , removeNotebook )
87
89
ginServer .Handle ("POST" , "/api/notebook/renameNotebook" , model .CheckAuth , model .CheckReadonly , renameNotebook )
88
90
ginServer .Handle ("POST" , "/api/notebook/changeSortNotebook" , model .CheckAuth , model .CheckReadonly , changeSortNotebook )
89
91
ginServer .Handle ("POST" , "/api/notebook/setNotebookIcon" , model .CheckAuth , model .CheckReadonly , setNotebookIcon )
@@ -122,8 +124,8 @@ func ServeAPI(ginServer *gin.Engine) {
122
124
ginServer .Handle ("POST" , "/api/history/rollbackDocHistory" , model .CheckAuth , model .CheckReadonly , rollbackDocHistory )
123
125
ginServer .Handle ("POST" , "/api/history/clearWorkspaceHistory" , model .CheckAuth , model .CheckReadonly , clearWorkspaceHistory )
124
126
ginServer .Handle ("POST" , "/api/history/reindexHistory" , model .CheckAuth , model .CheckReadonly , reindexHistory )
125
- ginServer .Handle ("POST" , "/api/history/searchHistory" , model .CheckAuth , model . CheckReadonly , searchHistory )
126
- ginServer .Handle ("POST" , "/api/history/getHistoryItems" , model .CheckAuth , model . CheckReadonly , getHistoryItems )
127
+ ginServer .Handle ("POST" , "/api/history/searchHistory" , model .CheckAuth , searchHistory )
128
+ ginServer .Handle ("POST" , "/api/history/getHistoryItems" , model .CheckAuth , getHistoryItems )
127
129
128
130
ginServer .Handle ("POST" , "/api/outline/getDocOutline" , model .CheckAuth , getDocOutline )
129
131
ginServer .Handle ("POST" , "/api/bookmark/getBookmark" , model .CheckAuth , getBookmark )
@@ -141,14 +143,14 @@ func ServeAPI(ginServer *gin.Engine) {
141
143
142
144
ginServer .Handle ("POST" , "/api/search/searchTag" , model .CheckAuth , searchTag )
143
145
ginServer .Handle ("POST" , "/api/search/searchTemplate" , model .CheckAuth , searchTemplate )
144
- ginServer .Handle ("POST" , "/api/search/removeTemplate" , model .CheckAuth , removeTemplate )
146
+ ginServer .Handle ("POST" , "/api/search/removeTemplate" , model .CheckAuth , model . CheckReadonly , removeTemplate )
145
147
ginServer .Handle ("POST" , "/api/search/searchWidget" , model .CheckAuth , searchWidget )
146
148
ginServer .Handle ("POST" , "/api/search/searchRefBlock" , model .CheckAuth , searchRefBlock )
147
149
ginServer .Handle ("POST" , "/api/search/searchEmbedBlock" , model .CheckAuth , searchEmbedBlock )
148
150
ginServer .Handle ("POST" , "/api/search/getEmbedBlock" , model .CheckAuth , getEmbedBlock )
149
151
ginServer .Handle ("POST" , "/api/search/fullTextSearchBlock" , model .CheckAuth , fullTextSearchBlock )
150
152
ginServer .Handle ("POST" , "/api/search/searchAsset" , model .CheckAuth , searchAsset )
151
- ginServer .Handle ("POST" , "/api/search/findReplace" , model .CheckAuth , model . CheckReadonly , findReplace )
153
+ ginServer .Handle ("POST" , "/api/search/findReplace" , model .CheckAuth , findReplace )
152
154
ginServer .Handle ("POST" , "/api/search/fullTextSearchAssetContent" , model .CheckAuth , fullTextSearchAssetContent )
153
155
ginServer .Handle ("POST" , "/api/search/getAssetContent" , model .CheckAuth , getAssetContent )
154
156
@@ -183,14 +185,14 @@ func ServeAPI(ginServer *gin.Engine) {
183
185
ginServer .Handle ("POST" , "/api/block/getHeadingChildrenDOM" , model .CheckAuth , getHeadingChildrenDOM )
184
186
ginServer .Handle ("POST" , "/api/block/swapBlockRef" , model .CheckAuth , model .CheckReadonly , swapBlockRef )
185
187
ginServer .Handle ("POST" , "/api/block/transferBlockRef" , model .CheckAuth , model .CheckReadonly , transferBlockRef )
186
- ginServer .Handle ("POST" , "/api/block/getParentNextChildID" , model .CheckAuth , model . CheckReadonly , getParentNextChildID )
188
+ ginServer .Handle ("POST" , "/api/block/getParentNextChildID" , model .CheckAuth , getParentNextChildID )
187
189
188
190
ginServer .Handle ("POST" , "/api/file/getFile" , model .CheckAuth , getFile )
189
191
ginServer .Handle ("POST" , "/api/file/putFile" , model .CheckAuth , model .CheckReadonly , putFile )
190
192
ginServer .Handle ("POST" , "/api/file/copyFile" , model .CheckAuth , model .CheckReadonly , copyFile )
191
193
ginServer .Handle ("POST" , "/api/file/removeFile" , model .CheckAuth , model .CheckReadonly , removeFile )
192
194
ginServer .Handle ("POST" , "/api/file/renameFile" , model .CheckAuth , model .CheckReadonly , renameFile )
193
- ginServer .Handle ("POST" , "/api/file/readDir" , model .CheckAuth , model . CheckReadonly , readDir )
195
+ ginServer .Handle ("POST" , "/api/file/readDir" , model .CheckAuth , readDir )
194
196
195
197
ginServer .Handle ("POST" , "/api/ref/refreshBacklink" , model .CheckAuth , refreshBacklink )
196
198
ginServer .Handle ("POST" , "/api/ref/getBacklink" , model .CheckAuth , getBacklink )
@@ -200,7 +202,7 @@ func ServeAPI(ginServer *gin.Engine) {
200
202
201
203
ginServer .Handle ("POST" , "/api/attr/getBookmarkLabels" , model .CheckAuth , getBookmarkLabels )
202
204
ginServer .Handle ("POST" , "/api/attr/resetBlockAttrs" , model .CheckAuth , model .CheckReadonly , resetBlockAttrs )
203
- ginServer .Handle ("POST" , "/api/attr/setBlockAttrs" , model .CheckAuth , setBlockAttrs )
205
+ ginServer .Handle ("POST" , "/api/attr/setBlockAttrs" , model .CheckAuth , model . CheckReadonly , setBlockAttrs )
204
206
ginServer .Handle ("POST" , "/api/attr/getBlockAttrs" , model .CheckAuth , getBlockAttrs )
205
207
206
208
ginServer .Handle ("POST" , "/api/cloud/getCloudSpace" , model .CheckAuth , getCloudSpace )
@@ -215,15 +217,15 @@ func ServeAPI(ginServer *gin.Engine) {
215
217
ginServer .Handle ("POST" , "/api/sync/setCloudSyncDir" , model .CheckAuth , model .CheckReadonly , setCloudSyncDir )
216
218
ginServer .Handle ("POST" , "/api/sync/createCloudSyncDir" , model .CheckAuth , model .CheckReadonly , createCloudSyncDir )
217
219
ginServer .Handle ("POST" , "/api/sync/removeCloudSyncDir" , model .CheckAuth , model .CheckReadonly , removeCloudSyncDir )
218
- ginServer .Handle ("POST" , "/api/sync/listCloudSyncDir" , model .CheckAuth , model . CheckReadonly , listCloudSyncDir )
220
+ ginServer .Handle ("POST" , "/api/sync/listCloudSyncDir" , model .CheckAuth , listCloudSyncDir )
219
221
ginServer .Handle ("POST" , "/api/sync/performSync" , model .CheckAuth , model .CheckReadonly , performSync )
220
222
ginServer .Handle ("POST" , "/api/sync/performBootSync" , model .CheckAuth , model .CheckReadonly , performBootSync )
221
223
ginServer .Handle ("POST" , "/api/sync/getBootSync" , model .CheckAuth , getBootSync )
222
224
ginServer .Handle ("POST" , "/api/sync/getSyncInfo" , model .CheckAuth , getSyncInfo )
223
225
ginServer .Handle ("POST" , "/api/sync/exportSyncProviderS3" , model .CheckAuth , exportSyncProviderS3 )
224
- ginServer .Handle ("POST" , "/api/sync/importSyncProviderS3" , model .CheckAuth , importSyncProviderS3 )
226
+ ginServer .Handle ("POST" , "/api/sync/importSyncProviderS3" , model .CheckAuth , model . CheckReadonly , importSyncProviderS3 )
225
227
ginServer .Handle ("POST" , "/api/sync/exportSyncProviderWebDAV" , model .CheckAuth , exportSyncProviderWebDAV )
226
- ginServer .Handle ("POST" , "/api/sync/importSyncProviderWebDAV" , model .CheckAuth , importSyncProviderWebDAV )
228
+ ginServer .Handle ("POST" , "/api/sync/importSyncProviderWebDAV" , model .CheckAuth , model . CheckReadonly , importSyncProviderWebDAV )
227
229
228
230
ginServer .Handle ("POST" , "/api/inbox/getShorthands" , model .CheckAuth , getShorthands )
229
231
ginServer .Handle ("POST" , "/api/inbox/getShorthand" , model .CheckAuth , getShorthand )
@@ -243,7 +245,7 @@ func ServeAPI(ginServer *gin.Engine) {
243
245
ginServer .Handle ("POST" , "/api/asset/getMissingAssets" , model .CheckAuth , getMissingAssets )
244
246
ginServer .Handle ("POST" , "/api/asset/removeUnusedAsset" , model .CheckAuth , model .CheckReadonly , removeUnusedAsset )
245
247
ginServer .Handle ("POST" , "/api/asset/removeUnusedAssets" , model .CheckAuth , model .CheckReadonly , removeUnusedAssets )
246
- ginServer .Handle ("POST" , "/api/asset/getDocImageAssets" , model .CheckAuth , model . CheckReadonly , getDocImageAssets )
248
+ ginServer .Handle ("POST" , "/api/asset/getDocImageAssets" , model .CheckAuth , getDocImageAssets )
247
249
ginServer .Handle ("POST" , "/api/asset/renameAsset" , model .CheckAuth , model .CheckReadonly , renameAsset )
248
250
ginServer .Handle ("POST" , "/api/asset/getImageOCRText" , model .CheckAuth , model .CheckReadonly , getImageOCRText )
249
251
ginServer .Handle ("POST" , "/api/asset/setImageOCRText" , model .CheckAuth , model .CheckReadonly , setImageOCRText )
@@ -284,7 +286,7 @@ func ServeAPI(ginServer *gin.Engine) {
284
286
285
287
ginServer .Handle ("POST" , "/api/template/render" , model .CheckAuth , renderTemplate )
286
288
ginServer .Handle ("POST" , "/api/template/docSaveAsTemplate" , model .CheckAuth , model .CheckReadonly , docSaveAsTemplate )
287
- ginServer .Handle ("POST" , "/api/template/renderSprig" , model .CheckAuth , model . CheckReadonly , renderSprig )
289
+ ginServer .Handle ("POST" , "/api/template/renderSprig" , model .CheckAuth , renderSprig )
288
290
289
291
ginServer .Handle ("POST" , "/api/transactions" , model .CheckAuth , model .CheckReadonly , performTransactions )
290
292
@@ -363,33 +365,33 @@ func ServeAPI(ginServer *gin.Engine) {
363
365
ginServer .Handle ("POST" , "/api/riff/getRiffCards" , model .CheckAuth , getRiffCards )
364
366
ginServer .Handle ("POST" , "/api/riff/getTreeRiffCards" , model .CheckAuth , getTreeRiffCards )
365
367
ginServer .Handle ("POST" , "/api/riff/getNotebookRiffCards" , model .CheckAuth , getNotebookRiffCards )
366
- ginServer .Handle ("POST" , "/api/riff/resetRiffCards" , model .CheckAuth , resetRiffCards )
368
+ ginServer .Handle ("POST" , "/api/riff/resetRiffCards" , model .CheckAuth , model . CheckReadonly , resetRiffCards )
367
369
368
370
ginServer .Handle ("POST" , "/api/notification/pushMsg" , model .CheckAuth , pushMsg )
369
371
ginServer .Handle ("POST" , "/api/notification/pushErrMsg" , model .CheckAuth , pushErrMsg )
370
372
371
373
ginServer .Handle ("POST" , "/api/snippet/getSnippet" , model .CheckAuth , getSnippet )
372
- ginServer .Handle ("POST" , "/api/snippet/setSnippet" , model .CheckAuth , setSnippet )
374
+ ginServer .Handle ("POST" , "/api/snippet/setSnippet" , model .CheckAuth , model . CheckReadonly , setSnippet )
373
375
ginServer .Handle ("POST" , "/api/snippet/removeSnippet" , model .CheckAuth , model .CheckReadonly , removeSnippet )
374
- ginServer .Handle ("GET" , "/snippets/*filepath" , serveSnippets )
375
376
376
377
ginServer .Handle ("POST" , "/api/av/renderAttributeView" , model .CheckAuth , renderAttributeView )
377
378
ginServer .Handle ("POST" , "/api/av/getAttributeViewKeys" , model .CheckAuth , getAttributeViewKeys )
378
- ginServer .Handle ("POST" , "/api/av/setAttributeViewBlockAttr" , model .CheckAuth , setAttributeViewBlockAttr )
379
+ ginServer .Handle ("POST" , "/api/av/setAttributeViewBlockAttr" , model .CheckAuth , model . CheckReadonly , setAttributeViewBlockAttr )
379
380
380
- ginServer .Handle ("POST" , "/api/ai/chatGPT" , model .CheckAuth , model . CheckReadonly , chatGPT )
381
- ginServer .Handle ("POST" , "/api/ai/chatGPTWithAction" , model .CheckAuth , model . CheckReadonly , chatGPTWithAction )
381
+ ginServer .Handle ("POST" , "/api/ai/chatGPT" , model .CheckAuth , chatGPT )
382
+ ginServer .Handle ("POST" , "/api/ai/chatGPTWithAction" , model .CheckAuth , chatGPTWithAction )
382
383
383
384
ginServer .Handle ("POST" , "/api/petal/loadPetals" , model .CheckAuth , loadPetals )
384
385
ginServer .Handle ("POST" , "/api/petal/setPetalEnabled" , model .CheckAuth , model .CheckReadonly , setPetalEnabled )
385
386
386
- ginServer .Handle ("POST" , "/api/network/forwardProxy" , model .CheckAuth , model .CheckReadonly , forwardProxy )
387
+ ginServer .Any ("/api/network/echo" , model .CheckAuth , echo )
388
+ ginServer .Handle ("POST" , "/api/network/forwardProxy" , model .CheckAuth , forwardProxy )
387
389
388
390
ginServer .Handle ("GET" , "/ws/broadcast" , model .CheckAuth , broadcast )
389
- ginServer .Handle ("GET" , "/api/broadcast/channels" , model .CheckAuth , getChannels )
390
391
ginServer .Handle ("POST" , "/api/broadcast/postMessage" , model .CheckAuth , postMessage )
392
+ ginServer .Handle ("POST" , "/api/broadcast/getChannels" , model .CheckAuth , getChannels )
391
393
ginServer .Handle ("POST" , "/api/broadcast/getChannelInfo" , model .CheckAuth , getChannelInfo )
392
394
393
- ginServer .Handle ("POST" , "/api/archive/zip" , model .CheckAuth , zip )
394
- ginServer .Handle ("POST" , "/api/archive/unzip" , model .CheckAuth , unzip )
395
+ ginServer .Handle ("POST" , "/api/archive/zip" , model .CheckAuth , model . CheckReadonly , zip )
396
+ ginServer .Handle ("POST" , "/api/archive/unzip" , model .CheckAuth , model . CheckReadonly , unzip )
395
397
}
0 commit comments