comparison src/admin/index.html.luan @ 4:028e74c8889d

add all_users
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 12 May 2022 16:54:11 -0600
parents dfc36e7ed22c
children a7187a447835
comparison
equal deleted inserted replaced
3:e3448053230a 4:028e74c8889d
1 local Luan = require "luan:Luan.luan" 1 local Luan = require "luan:Luan.luan"
2 local error = Luan.error 2 local error = Luan.error
3 local pairs = Luan.pairs or error()
4 local ipairs = Luan.ipairs or error() 3 local ipairs = Luan.ipairs or error()
5 local Io = require "luan:Io.luan" 4 local Io = require "luan:Io.luan"
6 local Http = require "luan:http/Http.luan" 5 local Http = require "luan:http/Http.luan"
7 local Shared = require "site:/lib/Shared.luan" 6 local Shared = require "site:/lib/Shared.luan"
8 local head = Shared.head or error() 7 local head = Shared.head or error()
9 local header = Shared.admin_header or error() 8 local header = Shared.admin_header or error()
10 local get_user = Shared.get_user or error() 9 local get_user = Shared.get_user or error()
11 local config = Shared.config or error() 10 local config = Shared.config or error()
11 local user_repos = Shared.user_repos or error()
12 12
13
14 local user_repos = {}
15 for _, repo in pairs(config.repos) do
16 for user in pairs(repo.users) do
17 local repos = user_repos[user]
18 if repos == nil then
19 repos = {}
20 user_repos[user] = repos
21 end
22 repos[#repos+1] = repo
23 end
24 end
25 13
26 return function() 14 return function()
27 local user = get_user() 15 local user = get_user()
28 Io.stdout = Http.response.text_writer() 16 Io.stdout = Http.response.text_writer()
29 %> 17 %>