Persist user GUI preferences and resize the shared media modal
DC CMS qualification / qualify (push) Successful in 2m22s
DC CMS qualification / qualify (push) Successful in 2m22s
This commit is contained in:
+10
-1
@@ -187,13 +187,22 @@ test('independent sites, rendering, secrets and publication ownership', async t
|
||||
await t.test('cross-origin registry mutations are refused',async()=>{
|
||||
const response=await fetch(base+'/api/sites',{method:'POST',headers:{origin:'https://untrusted.invalid','content-type':'application/json'},body:JSON.stringify({id:'attack',copyFrom:'nodedc'})});assert.equal(response.status,403);
|
||||
});
|
||||
await t.test('GUI preferences persist outside sites and reject cross-origin writes', async () => {
|
||||
assert.equal((await api('/api/user/preferences')).exists, false);
|
||||
await api('/api/user/preferences','PATCH',{gui:{modals:{'media-library':{width:1200,height:800}}}});
|
||||
await api('/api/user/preferences','PATCH',{appearance:{theme:'light'}});
|
||||
const response = await fetch(base+'/api/user/preferences',{method:'PATCH',headers:{origin:'https://untrusted.invalid','content-type':'application/json'},body:'{}'});
|
||||
assert.equal(response.status,403);
|
||||
assert.equal((await api('/api/sites')).sites.length,2);
|
||||
});
|
||||
await stop(); await start();
|
||||
await t.test('registry and edits survive server restart',async()=>{
|
||||
assert.equal((await api('/api/user/preferences')).preferences.gui.modals['media-library'].width,1200);
|
||||
assert.equal((await api('/api/sites')).sites.length,2);assert.equal((await api('/s/mission-core/api/page/home')).title,'Mission edited');assert.equal((await api('/s/nodedc/api/page/home')).title,'Agent edited');
|
||||
});
|
||||
await stop();await start(true);
|
||||
await t.test('registry, scoped content and preview retain authentication',async()=>{
|
||||
for(const path of ['/api/sites','/s/mission-core/api/page/home','/s/mission-core/api/project/backup','/s/mission-core/api/media/download?path=assets/proof.txt']){const response=await fetch(base+path,{redirect:'manual'});assert.equal(response.status,401,path);assert.match(response.headers.get('content-type'),/json/);}
|
||||
for(const path of ['/api/user/preferences','/api/sites','/s/mission-core/api/page/home','/s/mission-core/api/project/backup','/s/mission-core/api/media/download?path=assets/proof.txt']){const response=await fetch(base+path,{redirect:'manual'});assert.equal(response.status,401,path);assert.match(response.headers.get('content-type'),/json/);}
|
||||
assert.equal((await fetch(base+'/s/mission-core/api/project/backup',{method:'POST',redirect:'manual'})).status,401);
|
||||
assert.equal((await fetch(base+'/s/mission-core/index.html',{redirect:'manual'})).status,302);
|
||||
assert.equal((await fetch(base+'/healthz')).status,200);
|
||||
|
||||
Reference in New Issue
Block a user