Make the 'apps' app list core apps, and populate apps lists when importing.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3795 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		@@ -1 +1 @@
 | 
			
		||||
{"type":"tildefriends-app","files":{"app.js":"&5hVx7GCBbUh81CFIPkWJCyDZ9Pp1KBne6BiLbKklwCQ=.sha256"}}
 | 
			
		||||
{"type":"tildefriends-app","files":{"app.js":"&C82YfV2CQsreGCcY0FHR4owqVOaN10yvVW7OZxFC8sE=.sha256"}}
 | 
			
		||||
@@ -1,21 +1,28 @@
 | 
			
		||||
async function main() {
 | 
			
		||||
	var apps = await core.apps();
 | 
			
		||||
	var core_apps = await core.apps('core');
 | 
			
		||||
	var doc = `<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
<body style="background: #888">
 | 
			
		||||
<h1>Apps</h1>
 | 
			
		||||
<ul id="apps"></ul>
 | 
			
		||||
<h1>Core Apps</h1>
 | 
			
		||||
<ul id="core_apps"></ul>
 | 
			
		||||
</body>
 | 
			
		||||
<script>
 | 
			
		||||
	var apps = ${JSON.stringify(apps)};
 | 
			
		||||
	for (let app of Object.keys(apps)) {
 | 
			
		||||
		var li = document.getElementById('apps').appendChild(document.createElement('li'));
 | 
			
		||||
		var a = document.createElement('a');
 | 
			
		||||
		a.innerText = app;
 | 
			
		||||
		a.href = '/~${core.user.credentials.session.name}/' + app + '/';
 | 
			
		||||
		a.target = '_top';
 | 
			
		||||
		li.appendChild(a);
 | 
			
		||||
	function populate_apps(id, name, apps) {
 | 
			
		||||
		var list = document.getElementById(id);
 | 
			
		||||
		for (let app of Object.keys(apps)) {
 | 
			
		||||
			var li = list.appendChild(document.createElement('li'));
 | 
			
		||||
			var a = document.createElement('a');
 | 
			
		||||
			a.innerText = app;
 | 
			
		||||
			a.href = '/~' + name + '/' + app + '/';
 | 
			
		||||
			a.target = '_top';
 | 
			
		||||
			li.appendChild(a);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	populate_apps('apps', '${core.user.credentials.session.name}', ${JSON.stringify(apps)});
 | 
			
		||||
	populate_apps('core_apps', 'core', ${JSON.stringify(core_apps)});
 | 
			
		||||
</script>
 | 
			
		||||
</html>`
 | 
			
		||||
	app.setDocument(doc);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user