gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit7ae13f597ae13f59ident#34: the lead, message and notice lines are named with Style.pLead / pMessage / pNotice (shared bodies in lib/looks.hl) instead of class stringsmre7ae13f59/components/access.hl

22.0 KB

  1. // components/access.hl — `/access`: WHO MAY ACT IN WHICH OF YOUR APPS (ident#27; the screens he approved 2026-10-29, mockups 027-01…08).
  2. // The matrix (identity × app), "Give access" in three steps (who → which apps, level, label → the key, shown once), a cell's sheet
  3. // (since, last use, level, rotate, revoke). The account stays signed in as itself: no logging out and in. The server side is lib/access.hl.
  4. //
  5. // The faces' names start with `acc…`: a face is found by its EVENT NAME across all files (hl:web).
  6. parent './main.hl'
  7. import { accountOfSession } from '../lib/accounts.hl'
  8. import { matrix, pickList, cellOf, giveAccess, revokeAccess, setLevel, rotateKey } from '../lib/access.hl'
  9. import { siteName } from '../project.hl'
  10. import { leadLook, messageLook, noticeLook } from '../lib/looks.hl'
  11. session = null
  12. me = accountOfSession(&session)
  13. signedIn = me != null
  14. signedOut = me == null
  15. data = me != null ? matrix(me.id) : { apps = [] rows = [] never = [] hasNever = false }
  16. apps = data.apps
  17. rows = data.rows
  18. never = data.never
  19. hasNever = data.hasNever
  20. noApps = apps.length == 0
  21. hasApps = apps.length > 0
  22. __title = siteName + ' | access'
  23. // WHICH SCREEN: 'overview' | 'who' (step 1) | 'where' (step 2) | 'key' (step 3)
  24. screen = 'overview'
  25. isOverview = true
  26. isWho = false
  27. isWhere = false
  28. isKey = false
  29. pickRows = []
  30. pickId = ''
  31. newMode = false
  32. newName = ''
  33. tickRows = []
  34. allOn = false
  35. level = 'write'
  36. writeCls = 'seg on'
  37. readCls = 'seg'
  38. newCls = 'newone'
  39. doneLabel = 'Done'
  40. label = ''
  41. // THE KEY, shown once (never kept by the server)
  42. keyText = ''
  43. keyWho = ''
  44. keyApps = []
  45. hasKey = false
  46. newKeyNeeded = true
  47. hasKeyText = false
  48. noKeyText = true
  49. doneText = ''
  50. // the cell's sheet
  51. sheetOpen = false
  52. sheet = null
  53. message = ''
  54. notice = ''
  55. View {
  56. accessPage {
  57. if (signedOut) {
  58. h1 { "Access" }
  59. p { id = "signinfirst" Style.pLead "Sign in to ident first: " a { href = "/" "sign in" } "." }
  60. }
  61. if (signedIn) {
  62. if (isOverview) {
  63. section { id = "accesssection"
  64. h1 { "Access" }
  65. p { Style.pLead "Which identity may act in which of your apps." }
  66. if (noApps) { p { id = "noapps" Style.pLead "No apps yet. Register an app first, then give an identity access to it: " a { href = "/apps" "your apps" } "." } }
  67. if (hasApps) {
  68. accessMatrix { table { id = "matrix"
  69. thead { tr { th { } for (a of apps) { th { class = "appname" a.name } } } }
  70. tbody {
  71. for (r of rows) {
  72. tr { class = "idrow"
  73. th { class = "who" a { class = "whoname" href = r.href r.label } whoSub { r.sub } }
  74. for (c of r.cells) {
  75. td { button { type = "button" class = c.cls value = c.value title = c.tip 'aria-label' = c.tip
  76. on click(e) { emit accOpenCell(e.target.value) }
  77. c.glyph } }
  78. }
  79. }
  80. }
  81. }
  82. } }
  83. matrixKey { id = "legend" "● agent key works · ◐ you log in there · ○ no access. Tap a cell for since / last use / revoke." }
  84. }
  85. if (hasNever) {
  86. h2 { "Never used" }
  87. ul { id = "neverused"
  88. for (n of never) {
  89. li { class = "never"
  90. neverMain { neverName { n.text } neverLine { n.line } }
  91. button { type = "button" class = "quiet small neverrevoke" value = n.value "Revoke" on click(e) { emit accRevokeNever(e.target.value) } }
  92. }
  93. }
  94. }
  95. }
  96. if (hasApps) { button { id = "give" type = "button" class = "primary" "+ Give access" on click(e) { emit accStartGive(e) } } }
  97. }
  98. }
  99. if (isWho) {
  100. section { id = "whosection"
  101. stepLabel { "STEP 1 OF 3" }
  102. h1 { "Who gets access?" }
  103. ul { id = "picklist"
  104. for (p of pickRows) {
  105. li { class = p.cls
  106. button { type = "button" class = "pick" value = p.id on click(e) { emit accPick(e.currentTarget.value) }
  107. avatarDot { class = p.dot p.initial }
  108. pickMain { pickName { p.label } pickSub { p.sub } }
  109. pickMark { p.mark }
  110. }
  111. }
  112. }
  113. li { class = newCls
  114. button { type = "button" id = "newidentity" class = "pick" on click(e) { emit accPickNew(e) }
  115. avatarDot { class = "plus" "+" }
  116. pickMain { pickName { "New identity" } pickSub { "just a name, nothing else needed" } }
  117. }
  118. }
  119. }
  120. if (newMode) {
  121. label { "Name"
  122. input { id = "newname" name = "newname" maxlength = "60" autocomplete = "off" placeholder = "e.g. Hermes" value = newName on input(e) { emit accSetNewName(e.target.value) } }
  123. }
  124. }
  125. p { id = "message" Style.pMessage message }
  126. button { id = "next" type = "button" class = "primary" "Next" on click(e) { emit accNext(e) } }
  127. button { id = "cancelgive" type = "button" class = "quiet" "Cancel" on click(e) { emit accCancel(e) } }
  128. }
  129. }
  130. if (isWhere) {
  131. section { id = "wheresection"
  132. stepLabel { "STEP 2 OF 3" }
  133. h1 { "Where can " keyWho " act?" }
  134. ul { id = "ticklist"
  135. li { class = "all"
  136. label { class = "tick"
  137. input { id = "allapps" type = "checkbox" checked = allOn on change(e) { emit accToggleAll(e.target.checked) } }
  138. tickMain { tickName { "All my apps (" + apps.length + ")" } tickSub { "today’s apps; new apps ask again" } }
  139. }
  140. }
  141. for (t of tickRows) {
  142. li { class = "app"
  143. label { class = "tick"
  144. input { class = "apptick" type = "checkbox" name = "app" value = t.id checked = t.on on change(e) { emit accToggleApp(e.target.value) } }
  145. tickMain { tickName { t.name } }
  146. }
  147. }
  148. }
  149. }
  150. h2 { "Level" }
  151. levelRow {
  152. button { type = "button" id = "levelwrite" class = writeCls "Read + write" on click(e) { emit accLevel('write') } }
  153. button { type = "button" id = "levelread" class = readCls "Read only" on click(e) { emit accLevel('read') } }
  154. }
  155. if (newKeyNeeded) {
  156. h2 { "Key label" }
  157. input { id = "keylabel" name = "keylabel" maxlength = "60" autocomplete = "off" value = label on input(e) { emit accSetLabel(e.target.value) } }
  158. }
  159. if (hasKey) { p { Style.pLead keyWho " already has a key: it works in the new apps too, nothing new to copy." } }
  160. p { Style.pLead "In each app " keyWho " can still only do what its project roles allow." }
  161. p { id = "message" Style.pMessage message }
  162. button { id = "givego" type = "button" class = "primary" "Give access" on click(e) { emit accGive(e) } }
  163. button { id = "backwho" type = "button" class = "quiet" "Back" on click(e) { emit accBackToWho(e) } }
  164. }
  165. }
  166. if (isKey) {
  167. section { id = "keysection"
  168. if (hasKeyText) {
  169. stepLabel { "STEP 3 OF 3 · SHOWN ONCE" }
  170. h1 { keyWho "’s key" }
  171. keyBox { id = "thekey" keyText }
  172. button { id = "copykey" type = "button" class = "primary" "Copy key" on click(e) { emit accCopyKey(e) } }
  173. button { id = "copyenv" type = "button" "Copy as .env line" on click(e) { emit accCopyEnv(e) } }
  174. warnBox { "ident keeps only a hash. Once you leave this screen the key cannot be shown again — rotate to get a new one." }
  175. h2 { "Works in" }
  176. chips { for (n of keyApps) { chip { n } } }
  177. h2 { "The conductor uses it as" }
  178. pre { "Authorization: Bearer idt_…\ngit clone https://x:idt_…@gitoria…" }
  179. }
  180. if (noKeyText) {
  181. h1 { doneText }
  182. }
  183. p { id = "notice" Style.pNotice notice }
  184. button { id = "keydone" type = "button" class = "primary" doneLabel on click(e) { emit accDone(e) } }
  185. }
  186. }
  187. if (sheetOpen) {
  188. cellSheet { id = "cellsheet"
  189. h2 { id = "sheettitle" sheet.who " in " sheet.appName }
  190. if (sheet.hasGrant) {
  191. sheetRow { sheetLabel { "Since" } sheetValue { id = "sheetsince" sheet.since } }
  192. sheetRow { sheetLabel { "Last use" } sheetValue { id = "sheetlast" sheet.last } }
  193. sheetRow { sheetLabel { "Level" } sheetValue { id = "sheetlevel" sheet.level }
  194. button { type = "button" id = "changelevel" class = "quiet small" "change" on click(e) { emit accChangeLevel(e) } } }
  195. button { type = "button" id = "rotate" class = "quiet" "Rotate key" on click(e) { emit accRotate(e) } }
  196. button { type = "button" id = "revoke" class = "quiet danger" "Revoke access to " sheet.appName on click(e) { emit accRevoke(e) } }
  197. }
  198. if (sheet.noGrant) {
  199. if (sheet.login) { p { Style.pLead sheet.who " logs in to " sheet.appName " as a person. No key is involved." } }
  200. if (sheet.noLogin) { p { Style.pLead sheet.who " has no access to " sheet.appName "." } }
  201. button { type = "button" id = "giveone" class = "primary" "Give " sheet.who " access to " sheet.appName on click(e) { emit accGiveOne(e) } }
  202. }
  203. p { id = "sheetmessage" Style.pMessage message }
  204. button { type = "button" id = "closesheet" class = "quiet" "Close" on click(e) { emit accCloseSheet(e) } }
  205. }
  206. }
  207. }
  208. }
  209. }
  210. // the page's own look: nested rules named after its elements; colours only through the theme's tokens
  211. Style {
  212. pLead = leadLook
  213. pMessage = messageLook
  214. pNotice = noticeLook
  215. accessMatrix { display = 'block' overflowX = 'auto'
  216. table { width = '100%' borderCollapse = 'separate' borderSpacing = '0 .4rem'
  217. th { padding = '.3rem .2rem' fontWeight = '400' textAlign = 'center' fontSize = '.875rem' color = 'var(--color-text-muted)' background = 'transparent' }
  218. tbody { th { padding = '.5rem .8rem' textAlign = 'left' fontWeight = '700' background = 'var(--color-surface)' borderRadius = 'var(--radius-large) 0 0 var(--radius-large)' a { color = 'var(--color-text-strong)' } }
  219. td { background = 'var(--color-surface)' lastChild { borderRadius = '0 var(--radius-large) var(--radius-large) 0' }
  220. button { width = '100%' minWidth = 'var(--layout-tap)' minHeight = '3rem' padding = '0' fontSize = '1.1rem' } }
  221. }
  222. td { padding = '0' textAlign = 'center' background = 'var(--color-surface)' }
  223. }
  224. }
  225. // THE STATE OF A CELL is a class the data chooses ('cell key' | 'cell login' | 'cell none'): quoted selectors, nothing else can say it
  226. 'td button.key' { color = 'var(--color-success)' }
  227. 'td button.login' { color = 'var(--color-action)' }
  228. 'td button.none' { color = 'var(--color-text-muted)' }
  229. accessPage { display = 'grid' gap = '1rem' maxWidth = '46rem' margin = '0 auto'
  230. h1 { margin = '0' }
  231. h2 { margin = '.6rem 0 0' }
  232. p { margin = '0' }
  233. section { display = 'grid' gap = '.8rem' position = 'relative' }
  234. ul { listStyle = 'none' margin = '0' padding = '0' display = 'grid' gap = '.5rem'
  235. li { display = 'flex' alignItems = 'center' justifyContent = 'space-between' gap = '.5rem' margin = '0' padding = '.4rem .8rem' background = 'var(--color-surface)' borderRadius = 'var(--radius-large)'
  236. button { minHeight = 'var(--layout-tap)' }
  237. }
  238. }
  239. label { display = 'flex' alignItems = 'center' gap = '.8rem' minHeight = 'var(--layout-tap)' width = '100%' margin = '0' }
  240. input { flex = 'none' }
  241. }
  242. // from 60rem the main button sits at the top right, beside the title (the 1280 mockup); on the phone it is the last thing on the page
  243. @media { minWidth = '60rem' accessPage { '#give' { position = 'absolute' top = '0' right = '0' width = 'auto' } } }
  244. // the pick buttons of step 1 (a class: quoted): the card is the tap area
  245. 'button.pick' { flex = '1 1 auto' display = 'flex' justifyContent = 'flex-start' gap = '.7rem' textAlign = 'left' }
  246. // the chosen identity of step 1 (a class the data chooses) and the dashed "New identity"
  247. 'li.on' { outline = '2px solid var(--color-accent)' outlineOffset = '-2px' }
  248. 'li.newone' { background = 'transparent' outline = '2px dashed var(--color-text-muted)' outlineOffset = '-2px' }
  249. 'li.newone.on' { outline = '2px solid var(--color-accent)' }
  250. // the level buttons: the chosen one is the accent
  251. 'button.seg' { background = 'var(--color-surface)' }
  252. 'button.seg.on' { color = 'var(--color-accent-text)' background = 'var(--color-accent)' }
  253. whoSub { display = 'block' fontSize = '.875rem' fontWeight = '400' color = 'var(--color-text-muted)' }
  254. matrixKey { fontSize = '.875rem' color = 'var(--color-text-muted)' }
  255. stepLabel { fontSize = '.875rem' fontWeight = '700' letterSpacing = '.06em' color = 'var(--color-accent)' }
  256. neverMain { display = 'grid' flex = '1 1 auto' minWidth = '0' }
  257. neverName { fontWeight = '700' color = 'var(--color-text-strong)' }
  258. neverLine { fontSize = '.875rem' color = 'var(--color-text-muted)' }
  259. pickMain { display = 'grid' flex = '1 1 auto' minWidth = '0' textAlign = 'left' }
  260. pickName { fontWeight = '700' color = 'var(--color-text-strong)' }
  261. pickSub { fontSize = '.875rem' fontWeight = '400' color = 'var(--color-text-muted)' }
  262. pickMark { color = 'var(--color-success)' }
  263. avatarDot { display = 'inline-flex' alignItems = 'center' justifyContent = 'center' flex = '0 0 auto' width = '2.25rem' height = '2.25rem' borderRadius = '50%' fontWeight = '700' color = 'var(--color-accent-text)' background = 'var(--color-accent)' }
  264. tickMain { display = 'grid' }
  265. tickName { fontWeight = '600' color = 'var(--color-text-strong)' }
  266. tickSub { fontSize = '.875rem' color = 'var(--color-text-muted)' }
  267. levelRow { display = 'grid' gridTemplateColumns = '1fr 1fr' gap = '.5rem' }
  268. keyBox { display = 'block' padding = '.7rem .8rem' fontFamily = 'ui-monospace, monospace' fontSize = '.875rem' color = 'var(--color-text-strong)' background = 'var(--color-background-sunken)' borderRadius = 'var(--radius-small)' overflowWrap = 'anywhere' userSelect = 'all' }
  269. warnBox { display = 'block' padding = '.7rem .8rem' color = 'var(--color-warning)' background = 'var(--color-surface)' borderRadius = 'var(--radius-small)' }
  270. chips { display = 'flex' flexWrap = 'wrap' gap = '.4rem' }
  271. chip { padding = '.2rem .6rem' fontSize = '.875rem' color = 'var(--color-success)' background = 'var(--color-background-sunken)' borderRadius = 'var(--radius-small)' }
  272. cellSheet { position = 'fixed' left = '0' right = '0' bottom = '0' zIndex = '30' display = 'grid' gap = '.5rem' maxWidth = '34rem' margin = '0 auto' padding = '1rem var(--layout-gutter) 1.2rem' background = 'var(--color-surface)' borderRadius = 'var(--radius-large) var(--radius-large) 0 0' boxShadow = '0 -.5rem 2rem var(--color-background-sunken)' }
  273. sheetRow { display = 'flex' alignItems = 'center' justifyContent = 'space-between' gap = '.5rem' padding = '.5rem .8rem' background = 'var(--color-background-sunken)' borderRadius = 'var(--radius-small)' }
  274. sheetLabel { display = 'block' fontWeight = '700' color = 'var(--color-text-strong)' }
  275. sheetValue { display = 'block' fontSize = '.875rem' color = 'var(--color-text-muted)' }
  276. }
  277. // ---- the screens ------------------------------------------------------------------------------------------------
  278. setScreen = (name) => {
  279. screen = name
  280. isOverview = name == 'overview'
  281. isWho = name == 'who'
  282. isWhere = name == 'where'
  283. isKey = name == 'key'
  284. message = ''
  285. return null
  286. }
  287. setData = (d) => {
  288. data = d
  289. apps = d.apps
  290. rows = d.rows
  291. never = d.never
  292. hasNever = d.hasNever
  293. noApps = d.apps.length == 0
  294. hasApps = d.apps.length > 0
  295. return null
  296. }
  297. pickView = () => {
  298. out = []
  299. for (p of pickRows) { out.push(p) }
  300. return out
  301. }
  302. // the step-1 list with the chosen one marked
  303. markPicks = (list) => {
  304. out = []
  305. for (p of list) {
  306. let chosen = !newMode && '' + p.id == '' + pickId
  307. out.push({ id = p.id label = p.label sub = p.sub initial = p.initial isAgent = p.isAgent dot = p.isAgent ? 'agent' : 'person' hasKey = p.hasKey cls = chosen ? 'on' : '' mark = chosen ? '✓' : '' })
  308. }
  309. return out
  310. }
  311. // step 2's list: each app with its tick
  312. tickView = (ids) => {
  313. out = []
  314. for (a of apps) { out.push({ id = a.id name = a.name on = ids.includes(a.id) }) }
  315. return out
  316. }
  317. tickedIds = () => {
  318. out = []
  319. for (t of tickRows) { if (t.on) { out.push(t.id) } }
  320. return out
  321. }
  322. on accStartGive(e) {
  323. notice = ''
  324. pickId = ''
  325. newMode = false
  326. newCls = 'newone'
  327. newName = ''
  328. r = emit server accPickList()
  329. if (r == null) { message = 'the server did not answer — try again' return null }
  330. pickRaw = r
  331. pickRows = markPicks(r)
  332. setScreen('who')
  333. }
  334. pickRaw = []
  335. on accPick(id) {
  336. newMode = false
  337. newCls = 'newone'
  338. pickId = '' + id
  339. pickRows = markPicks(pickRaw)
  340. message = ''
  341. }
  342. on accPickNew(e) {
  343. newMode = true
  344. newCls = 'newone on'
  345. pickId = ''
  346. pickRows = markPicks(pickRaw)
  347. message = ''
  348. }
  349. on accSetNewName(v) { newName = v }
  350. on accCancel(e) { setScreen('overview') }
  351. // step 1 → 2: who is chosen (or a name typed)
  352. on accNext(e) {
  353. if (newMode) {
  354. if (newName.trim() == '') { message = 'type a name for the new identity' return null }
  355. keyWho = newName.trim()
  356. hasKey = false
  357. newKeyNeeded = true
  358. label = keyWho
  359. } else {
  360. let who = null
  361. for (p of pickRaw) { if ('' + p.id == pickId) { who = p } }
  362. if (who == null) { message = 'pick an identity' return null }
  363. keyWho = who.label
  364. hasKey = who.hasKey
  365. newKeyNeeded = !who.hasKey
  366. label = who.label
  367. }
  368. ids = []
  369. for (a of apps) { ids.push(a.id) }
  370. tickRows = tickView(ids)
  371. allOn = true
  372. level = 'write'
  373. writeCls = 'seg on'
  374. readCls = 'seg'
  375. setScreen('where')
  376. }
  377. on accBackToWho(e) { setScreen('who') }
  378. on accToggleAll(ticked) {
  379. ids = []
  380. if (ticked) { for (a of apps) { ids.push(a.id) } }
  381. tickRows = tickView(ids)
  382. allOn = ticked
  383. }
  384. on accToggleApp(id) {
  385. ids = tickedIds()
  386. next = []
  387. let had = false
  388. for (x of ids) { if ('' + x == '' + id) { had = true } else { next.push(x) } }
  389. if (!had) { next.push('' + id) }
  390. tickRows = tickView(next)
  391. allOn = next.length == apps.length
  392. }
  393. on accLevel(v) {
  394. level = v
  395. writeCls = v == 'write' ? 'seg on' : 'seg'
  396. readCls = v == 'read' ? 'seg on' : 'seg'
  397. }
  398. on accSetLabel(v) { label = v }
  399. // step 2 → 3: give access; the key (when a new one was made) is on the screen and nowhere else
  400. on accGive(e) {
  401. ids = tickedIds()
  402. if (ids.length == 0) { message = 'tick at least one app' return null }
  403. input = { apps = ids level = level label = label }
  404. if (newMode) { input.newName = newName } else { input.identity = pickId }
  405. r = emit server accGiveAccess(input)
  406. if (r == null) { message = 'the server did not answer — try again' return null }
  407. if (r.error != null) { message = r.error return null }
  408. setData(r.data)
  409. showKey(r)
  410. }
  411. showKey = (r) => {
  412. keyWho = r.who
  413. keyApps = r.apps
  414. keyText = r.key == null ? '' : r.key
  415. hasKeyText = r.key != null
  416. noKeyText = r.key == null
  417. doneText = r.key == null ? r.who + ' now has access to ' + r.apps.join(', ') + '.' : ''
  418. doneLabel = r.key == null ? 'Done' : 'I saved it — done'
  419. sheetOpen = false
  420. setScreen('key')
  421. return null
  422. }
  423. on accCopyKey(e) {
  424. window.navigator.clipboard.writeText(keyText)
  425. notice = 'Key copied.'
  426. }
  427. on accCopyEnv(e) {
  428. window.navigator.clipboard.writeText('WORLDAPI_TOKEN=' + keyText)
  429. notice = '.env line copied.'
  430. }
  431. // done: the key is gone from the page
  432. on accDone(e) {
  433. keyText = ''
  434. hasKeyText = false
  435. noKeyText = true
  436. keyWho = ''
  437. keyApps = []
  438. notice = ''
  439. setScreen('overview')
  440. }
  441. // ---- a cell's sheet ---------------------------------------------------------------------------------------------
  442. on accOpenCell(v) {
  443. parts = ('' + v).split(':')
  444. r = emit server accCell(parts[0], parts[1])
  445. if (r == null || r.error != null) { return null }
  446. sheet = r
  447. message = ''
  448. sheetOpen = true
  449. }
  450. on accCloseSheet(e) {
  451. sheetOpen = false
  452. message = ''
  453. }
  454. on accChangeLevel(e) {
  455. next = sheet.levelRaw == 'write' ? 'read' : 'write'
  456. r = emit server accSetLevel(sheet.identity, sheet.app, next)
  457. if (r == null || r.error != null) { message = r == null ? 'the server did not answer — try again' : r.error return null }
  458. setData(r.data)
  459. sheet = r.cell
  460. }
  461. on accRevoke(e) {
  462. if (!confirm('Revoke ' + sheet.who + '’s access to ' + sheet.appName + '? It stops working there within 30 seconds.')) { return null }
  463. r = emit server accRevokeCell(sheet.identity, sheet.app)
  464. if (r == null || r.error != null) { message = r == null ? 'the server did not answer — try again' : r.error return null }
  465. setData(r.data)
  466. sheetOpen = false
  467. }
  468. on accRevokeNever(v) {
  469. parts = ('' + v).split(':')
  470. r = emit server accRevokeCell(parts[0], parts[1])
  471. if (r == null || r.error != null) { return null }
  472. setData(r.data)
  473. }
  474. on accRotate(e) {
  475. if (!confirm('Rotate the key of ' + sheet.who + '? The old key stops working at once, in every app.')) { return null }
  476. r = emit server accRotateKey(sheet.identity)
  477. if (r == null || r.error != null) { message = r == null ? 'the server did not answer — try again' : r.error return null }
  478. showKey(r)
  479. }
  480. // a ○ or ◐ cell: give that identity access to that app (step 2, prefilled)
  481. on accGiveOne(e) {
  482. r = emit server accPickList()
  483. if (r == null) { return null }
  484. pickRaw = r
  485. pickId = sheet.identity
  486. newMode = false
  487. keyWho = sheet.who
  488. hasKey = false
  489. newKeyNeeded = true
  490. for (p of r) { if ('' + p.id == pickId) { hasKey = p.hasKey newKeyNeeded = !p.hasKey label = p.label } }
  491. tickRows = tickView([sheet.app])
  492. allOn = apps.length == 1
  493. sheetOpen = false
  494. setScreen('where')
  495. }
  496. // ---- the faces ----------------------------------------------------------------------------------------------------
  497. on server accPickList(session) {
  498. let me = accountOfSession(&session)
  499. if (me == null) { return [] }
  500. return pickList(me.id)
  501. }
  502. on server accGiveAccess(input, session) {
  503. let me = accountOfSession(&session)
  504. if (me == null) { return { error = 'you are not signed in' } }
  505. r = giveAccess(me.id, input)
  506. if (r.error != null) { return r }
  507. r.data = matrix(me.id)
  508. return r
  509. }
  510. on server accCell(identity, app, session) {
  511. let me = accountOfSession(&session)
  512. if (me == null) { return { error = 'you are not signed in' } }
  513. c = cellOf(me.id, identity, app)
  514. if (c == null) { return { error = 'no such cell' } }
  515. return c
  516. }
  517. on server accSetLevel(identity, app, lv, session) {
  518. let me = accountOfSession(&session)
  519. if (me == null) { return { error = 'you are not signed in' } }
  520. r = setLevel(me.id, identity, app, lv)
  521. if (r.error != null) { return r }
  522. return { data = matrix(me.id) cell = cellOf(me.id, identity, app) }
  523. }
  524. on server accRevokeCell(identity, app, session) {
  525. let me = accountOfSession(&session)
  526. if (me == null) { return { error = 'you are not signed in' } }
  527. r = revokeAccess(me.id, identity, app)
  528. if (r.error != null) { return r }
  529. return { data = matrix(me.id) }
  530. }
  531. on server accRotateKey(identity, session) {
  532. let me = accountOfSession(&session)
  533. if (me == null) { return { error = 'you are not signed in' } }
  534. return rotateKey(me.id, identity)
  535. }

Branches

Latest commits

  • 7ae13f59ident#34: the lead, message and notice lines are named with Style.pLead / pMessage / pNotice (shared bodies in lib/looks.hl) instead of class stringsmre
  • b323265aMerge branch 'f5-styles' into mainIdent
  • 9ced53c3|||PR ident#33 ident#35 every component's styles live in its own Style block; styles.hl keeps the page-wide rest; the account bar is phone first (min-width: 60rem block); the avatar preview is hidden with the hidden attribute (ident#34 in part)mre
  • f28333e4ident#33 ident#35: styles.hl keeps only the accent, the page column and the shared patterns; the account bar is written phone first (base rule + one min-width: 60rem block) instead of a max-width overridemre
  • 5b4541fcident#33: the selector sign-in frame's rules move into embed.hl's Stylemre
  • 00235f21ident#33: the per-app notification switches move into appsettings.hl's Stylemre
  • 2249945cident#33: the inbox and connection list rules move into inbox.hl's Stylemre
  • f2d9f79fident#33: the apps list and the secret box move into apps.hl's Stylemre
  • 8370b748ident#33: the app request box moves into home.hl's Stylemre
  • 40bf3b97ident#33: the 404 page's home link rule moves into notfound.hlmre
  • 40627a89ident#33: the time zone section's spacing moves into timezone.hlmre
  • d389db08ident#33: the identity page's rules and the Notif. chip move into identity.hl's Stylemre
  • ddda0b5bident#33: the identity row's parts move into identitylist.hl's Stylemre
  • 47e516afident#33 ident#34: the identity form's avatar rules move into identityform.hl; the preview and Remove button are hidden with the hidden attribute instead of built class strings (avatarPreviewClass, avatarRemoveClass gone)mre
  • 5cb5cf0eident#33: the code field's look moves into codestep.hl's Stylemre
  • f421cd60ident#33: the shell's own rules (user menu address, offline note, network probe) move into main.hl's Stylemre
  • c512fb96Merge branch 'f4-homesplit' into mainIdent
  • 07d1717c|||PR ident#40 home.hl is split into components, one per area: email step, identity form, identity list, app identity choice, time zone; each moves its faces with it, the email step is shared with embed.hl (#40.3, rest of #40.2)mre
  • 59e8fcc1ident#40.3: the app's identity choice is one component (components/chooseidentity.hl); its face chooseIdentity moves with itmre
  • e23efdfcident#40.3: the identity list is one component (components/identitylist.hl); its delete and face dropIdentity move with itmre