gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchf3-codestep51e387f2|||PR ident#40 the code step is one component (components/codestep.hl) placed by home.hl and embed.hl; its verify face, setCode, browserZone and verify call exist once (#40.2)mref3-codestep/components/home.hl

19.5 KB

  1. // components/home.hl — `/` and `/signin/:rid`: ALL OF IDENT (pieces 1+2, tickets #24 #25;
  2. // CONCEPT.md).
  3. // Signed out: email → a six-digit code by mail → signed in. There is no registration:
  4. // the first right code for an address creates the account with a DEFAULT IDENTITY, then
  5. // this page shows that identity's name fields and says they are optional (Skip).
  6. // Signed in: the account's identities (list, new, edit, delete — never the last one)
  7. // and its time zone (the browser's at the first login; changeable here).
  8. //
  9. // Under `/signin/<rid>` the page belongs to an APP'S LOGIN BUTTON (lib/apps.hl requestOf):
  10. // it names the app, signs in to ident if needed, then asks WHICH IDENTITY the app gets
  11. // (with a single identity it still shows which one, one click) and sends the browser back
  12. // to the app with a one-time code. Managing identities stays on `/`.
  13. //
  14. // Every step takes the server's answer from the CALL (the value form of emit): it rides
  15. // the ack, over the socket or the POST fallback.
  16. parent './main.hl'
  17. import { accountOfSession, setTimeZone } from '../lib/accounts.hl'
  18. import { recordPending, dropPending } from '../lib/login.hl'
  19. import { identityRows, createIdentity, updateIdentity, deleteIdentity } from '../lib/identities.hl'
  20. import { requestOf, grantRequest } from '../lib/apps.hl'
  21. import { navigate } from 'hl:web'
  22. import CodeStep from './codestep.hl'
  23. import { siteName } from '../project.hl'
  24. session = null
  25. rid = null
  26. // 'code' on THE CODE PAGE `/code` and `/signin/<rid>/code` (ident#20; lib/api.hl codePage
  27. // renders this component there, only while the session has a pending code), else null
  28. step = null
  29. onCodePage = step == 'code'
  30. // the pending address, read by codePage from the session and handed in as a param (mission
  31. // 048): read here from the session, hl:web (64527baa) would re-derive it after EVERY face
  32. // that takes the session — after the 5th wrong code it turned null and the code form
  33. // vanished with nothing to click (gate "after 5 wrong tries even the RIGHT code is refused")
  34. pending = null
  35. // where this login lives: the email form, and the code page after "Send me a code"
  36. homeUrl = rid != null ? '/signin/' + rid : '/'
  37. codeUrl = rid != null ? '/signin/' + rid + '/code' : '/code'
  38. me = accountOfSession(&session)
  39. signedIn = me != null
  40. // THE APP'S LOGIN REQUEST (null on `/`, or when unknown / expired)
  41. request = rid != null ? requestOf(rid) : null
  42. forApp = request != null
  43. badRequest = rid != null && request == null
  44. appName = request != null ? request.app.name : ''
  45. appOrigin = request != null ? request.origin : ''
  46. forInvite = request != null && request.invite != ''
  47. requestLead = forInvite ? 'You are invited to ' : 'Sign in to '
  48. onWelcome = step == 'welcome' && me != null && forApp // a NEW address sent here from the selector's frame (ident#31): the default identity's form first
  49. choosing = forApp && me != null && !onWelcome // the identity choice for the app
  50. manage = rid == null && me != null // identities + time zone (only on `/`)
  51. meEmail = me != null ? me.email : ''
  52. timeZone = me != null ? me.timeZone : ''
  53. tzInput = timeZone
  54. identities = me != null ? identityRows(me.id) : []
  55. __title = siteName + (forApp ? ' | sign in to ' + appName : (me != null ? ' | your identities' : ' | sign in'))
  56. // the login steps (a View's `if` takes a member, so each step is one).
  57. // THE CODE STEP IS ITS OWN PAGE (ident#20, creator: "just make a /code where it checks a
  58. // pending code"): "Send me a code" records the address in this browser's session (face
  59. // rememberPending) and goes to `/code`; that page shows the code form for the session's
  60. // pending address (lib/login.hl pendingOf) — so a reload, a second tab or a re-seed keeps it.
  61. pendingEmail = onCodePage && me == null && !badRequest ? pending : null
  62. askEmail = me == null && !badRequest && !onCodePage
  63. askCode = pendingEmail != null
  64. email = ''
  65. sentTo = pendingEmail != null ? pendingEmail : ''
  66. message = ''
  67. notice = ''
  68. // THE IDENTITY FORM — new, edit, and right after the first login the default identity
  69. // ("welcome": the names are optional, Skip closes it)
  70. editing = onWelcome
  71. welcome = onWelcome
  72. notWelcome = !onWelcome // `if (!welcome)` in a View renders nothing: an `if` takes a member
  73. editId = '' // '' = a new identity, else the identity's id (a UUID)
  74. // the default identity the welcome form (/signin/<rid>/welcome) edits. It is its OWN member: `editId` must stay a plain value (a member made of an
  75. // expression is recomputed when `identities` changes, which reset the id of every identity edited on `/`)
  76. welcomeId = onWelcome ? '' + identities[0].id : ''
  77. editHeading = onWelcome ? 'Welcome — name your default identity' : ''
  78. fIdentityName = ''
  79. fNickname = ''
  80. fFirstname = ''
  81. fLastname = ''
  82. fAvatar = ''
  83. hasAvatarPreview = false
  84. avatarPreviewClass = hasAvatarPreview ? 'avatar' : 'avatar hidden'
  85. avatarRemoveClass = hasAvatarPreview ? 'quiet small' : 'quiet small hidden'
  86. View {
  87. identCard {
  88. if (forApp) {
  89. appRequest { id = "apprequest" requestLead strong { id = "appname" appName } " " requestOrigin { id = "apporigin" appOrigin } }
  90. }
  91. if (badRequest) {
  92. h1 { "Login request expired" }
  93. p { id = "badrequest" class = "message" "This login request is unknown or expired. Go back to the app and start the login again." }
  94. }
  95. if (askEmail) {
  96. h1 { "Sign in" }
  97. p { class = "lead" "We mail you a one-time code. There are no passwords, and no sign-up: the first login with an address creates its account." }
  98. form { id = "emailform"
  99. on submit(e) {
  100. e.preventDefault()
  101. emit ask(e)
  102. }
  103. label { "Email"
  104. input { id = "email" name = "email" type = "email" autocomplete = "email" required = "required" value = email on input(e) { emit setEmail(e.target.value) } }
  105. }
  106. button { id = "sendcode" type = "submit" "Send me a code" }
  107. }
  108. }
  109. if (askCode) {
  110. h1 { "Enter your code" }
  111. CodeStep { sentTo = sentTo tail = ". It is valid for 10 minutes." }
  112. }
  113. if (signedIn) {
  114. if (editing) {
  115. form { id = "identityform"
  116. on submit(e) {
  117. e.preventDefault()
  118. emit saveForm(e)
  119. }
  120. h1 { id = "formheading" editHeading }
  121. if (welcome) {
  122. p { id = "welcome" class = "lead" "Your account is ready and has a default identity. All of these fields are " strong { "optional" } " — fill in what you like, or skip it and do it later." }
  123. }
  124. label { "Identity name " fieldHint { "(shown when you pick an identity in an app; optional)" }
  125. input { id = "fidentityname" name = "identityName" maxlength = "60" autocomplete = "off" value = fIdentityName on input(e) { emit setF('identityName', e.target.value) } }
  126. }
  127. label { "Nickname " fieldHint { "(optional)" }
  128. input { id = "fnickname" name = "nickname" maxlength = "60" autocomplete = "nickname" value = fNickname on input(e) { emit setF('nickname', e.target.value) } }
  129. }
  130. label { "First name " fieldHint { "(optional)" }
  131. input { id = "ffirstname" name = "firstname" maxlength = "60" autocomplete = "given-name" value = fFirstname on input(e) { emit setF('firstname', e.target.value) } }
  132. }
  133. label { "Last name " fieldHint { "(optional)" }
  134. input { id = "flastname" name = "lastname" maxlength = "60" autocomplete = "family-name" value = fLastname on input(e) { emit setF('lastname', e.target.value) } }
  135. }
  136. avatarField {
  137. img { id = "avatarpreview" class = avatarPreviewClass src = fAvatar alt = "" width = "48" height = "48" }
  138. label { "Avatar " fieldHint { "(optional; a picture apps can show, e.g. next to your comments)" }
  139. input { id = "favatarfile" type = "file" accept = "image/png,image/jpeg,image/webp,image/gif" }
  140. }
  141. input { id = "favatar" name = "avatar" type = "hidden" value = fAvatar on input(e) { emit setF('avatar', e.target.value) } }
  142. button { id = "avatarremove" type = "button" class = avatarRemoveClass "Remove picture" on click(e) { emit setF('avatar', '') } }
  143. span { id = "avatarnote" class = "avatar-note" }
  144. }
  145. formButtons {
  146. button { id = "saveidentity" type = "submit" "Save" }
  147. if (welcome) { button { id = "skip" type = "button" class = "quiet" "Skip" on click(e) { emit closeForm(e) } } }
  148. if (notWelcome) { button { id = "cancel" type = "button" class = "quiet" "Cancel" on click(e) { emit closeForm(e) } } }
  149. }
  150. }
  151. }
  152. if (choosing) {
  153. section { id = "choosesection"
  154. h1 { "Choose an identity" }
  155. p { class = "lead" "Which identity signs in to " strong { appName } "? The app gets only the identity's short id — no email, no names." }
  156. ul { id = "chooselist"
  157. for (row of identities) {
  158. li { class = "choice"
  159. if (row.hasAvatar) { img { class = "avatar" src = row.avatar alt = "" width = "32" height = "32" } }
  160. identityMain {
  161. identityLabel { row.label }
  162. identityShortId { class = "shortid" row.shortId }
  163. if (row.isDefault) { defaultBadge { "default" } }
  164. identityDetails { row.details }
  165. }
  166. button { type = "button" class = "choose" value = row.id "Continue" on click(e) { emit choose(e.target.value) } }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. if (manage) {
  173. section { id = "identitiessection"
  174. sectionHead {
  175. h1 { "Your identities" }
  176. button { id = "newidentity" type = "button" class = "small" "New identity" on click(e) { emit openNew(e) } }
  177. }
  178. ul { id = "identities"
  179. for (row of identities) {
  180. li { class = "identity"
  181. if (row.hasAvatar) { img { class = "avatar" src = row.avatar alt = "" width = "32" height = "32" } }
  182. identityMain {
  183. identityLabel { row.label }
  184. identityShortId { class = "shortid" row.shortId }
  185. if (row.isDefault) { defaultBadge { "default" } }
  186. identityDetails { row.details }
  187. }
  188. identityActions {
  189. a { class = "used" href = row.usedHref "Used in…" }
  190. button { type = "button" class = "quiet small edit" value = row.id "Edit" on click(e) { emit openEdit(e.target.value) } }
  191. if (row.canDelete) { button { type = "button" class = "quiet small danger delete" value = row.id "Delete" on click(e) { emit remove(e.target.value) } } }
  192. }
  193. }
  194. }
  195. }
  196. }
  197. section { id = "timezonesection"
  198. h2 { "Time zone" }
  199. p { class = "lead" "Taken from your browser at your first login. Currently " strong { id = "timezone" timeZone } "." }
  200. p { id = "digestnote" class = "lead" "Your daily mail of notifications comes at 17:00 in this time zone." }
  201. form { id = "tzform"
  202. on submit(e) {
  203. e.preventDefault()
  204. emit saveZone(e)
  205. }
  206. label { "Time zone (IANA name, e.g. Europe/Vienna)"
  207. input { id = "tzinput" name = "timeZone" autocomplete = "off" maxlength = "64" required = "required" value = tzInput on input(e) { emit setTz(e.target.value) } }
  208. }
  209. formButtons {
  210. button { id = "savetz" type = "submit" "Save time zone" }
  211. button { id = "browsertz" type = "button" class = "quiet" "Use this browser's" on click(e) { emit useBrowserZone(e) } }
  212. }
  213. }
  214. }
  215. }
  216. }
  217. p { id = "notice" class = "notice" notice }
  218. p { id = "message" class = "message" message }
  219. }
  220. }
  221. on setEmail(v) { email = v }
  222. on setTz(v) { tzInput = v }
  223. on setF(name, v) {
  224. if (name == 'identityName') { fIdentityName = v }
  225. if (name == 'nickname') { fNickname = v }
  226. if (name == 'firstname') { fFirstname = v }
  227. if (name == 'lastname') { fLastname = v }
  228. if (name == 'avatar') { fAvatar = v hasAvatarPreview = v.trim() != '' }
  229. }
  230. // the browser's own time zone (IANA name) and whether a name is one it knows (`Intl` is a
  231. // browser global of client code, hybriel#18)
  232. browserZone = () => { return Intl.DateTimeFormat().resolvedOptions().timeZone }
  233. knownZone = (v) => { return v == 'UTC' || Intl.supportedValuesOf('timeZone').includes(v) }
  234. // THE CODE REQUEST is a plain POST to /api/code (lib/api.hl), not a face: only an HTTP
  235. // request carries the client IP (X-Client-IP) the per-IP limit counts (mission 010).
  236. // A refusal (400, 429) answers { error } and is shown like every other message.
  237. on ask(e) {
  238. message = ''
  239. res = fetch('/api/code', { method = 'POST' headers = { 'Content-Type' = 'application/json' } body = JSON.stringify({ email = email }) })
  240. r = res != null ? res.json() : null
  241. if (r == null) {
  242. message = 'the server did not answer — try again'
  243. return null
  244. }
  245. if (r.error != null) {
  246. message = r.error
  247. return null
  248. }
  249. // THE SESSION REMEMBERS THE STEP, then the browser goes to the code page. A function
  250. // route gets no session (hybriel#11), so the face records it; it refuses unless a
  251. // code for the address is really waiting.
  252. k = emit server rememberPending(r.email)
  253. if (k == null) {
  254. message = 'the server did not answer — try again'
  255. return null
  256. }
  257. if (k.error != null) {
  258. message = k.error
  259. return null
  260. }
  261. navigate(codeUrl)
  262. }
  263. // the code step (components/codestep.hl) checked the code: why not, or the signed-in account
  264. codeFailed = (String text) => { message = text }
  265. codeVerified = (r) => {
  266. askCode = false
  267. // signed in: the address bar leaves the code page (a reload of /code would go back
  268. // to it anyway — lib/api.hl codePage sends a signed-in browser there)
  269. window.history.replaceState(null, '', homeUrl)
  270. meEmail = r.account.email
  271. timeZone = r.account.timeZone
  272. tzInput = r.account.timeZone
  273. identities = r.identities
  274. signedIn = true
  275. notice = ''
  276. manage = !forApp
  277. choosing = forApp
  278. // the shell (components/main.hl) shows the user menu from the account: a page's emit reaches every level above it
  279. // (hybriel#193), so the header follows the in-place sign-in without a reload — the welcome form below stays in place
  280. emit shellSession(r.account.email)
  281. // THE FIRST LOGIN: the default identity's names, optional (for an app too: the
  282. // choice follows once the form is saved or skipped)
  283. if (r.created) {
  284. fillForm(r.identities[0])
  285. editHeading = 'Welcome — name your default identity'
  286. welcome = true
  287. notWelcome = false
  288. editing = true
  289. choosing = false
  290. }
  291. }
  292. // THE CHOICE: the server makes (or finds) this identity's id for the app and answers
  293. // the app's return URL with a one-time code — the browser goes there
  294. on choose(id) {
  295. message = ''
  296. notice = ''
  297. r = emit server chooseIdentity(rid, '' + id)
  298. if (r == null) {
  299. message = 'the server did not answer — try again'
  300. return null
  301. }
  302. if (r.error != null) {
  303. message = r.error
  304. return null
  305. }
  306. notice = 'Back to ' + appName + ' …'
  307. window.location.assign(r.url)
  308. }
  309. fillForm = (row) => {
  310. editId = row.id
  311. fIdentityName = row.identityName
  312. fNickname = row.nickname
  313. fFirstname = row.firstname
  314. fLastname = row.lastname
  315. fAvatar = row.avatar
  316. hasAvatarPreview = row.hasAvatar
  317. return null
  318. }
  319. rowOf = (id) => {
  320. for (row of identities) { if ('' + row.id == '' + id) { return row } }
  321. return null
  322. }
  323. on openNew(e) {
  324. message = ''
  325. notice = ''
  326. editId = ''
  327. fIdentityName = ''
  328. fNickname = ''
  329. fFirstname = ''
  330. fLastname = ''
  331. fAvatar = ''
  332. hasAvatarPreview = false
  333. editHeading = 'New identity'
  334. welcome = false
  335. notWelcome = true
  336. editing = true
  337. }
  338. on openEdit(id) {
  339. message = ''
  340. notice = ''
  341. row = rowOf(id)
  342. if (row == null) { return null }
  343. fillForm(row)
  344. editHeading = 'Edit ' + row.label
  345. welcome = false
  346. notWelcome = true
  347. editing = true
  348. }
  349. on closeForm(e) {
  350. editing = false
  351. welcome = false
  352. notWelcome = true
  353. message = ''
  354. choosing = forApp
  355. }
  356. on saveForm(e) {
  357. message = ''
  358. fields = { identityName = fIdentityName nickname = fNickname firstname = fFirstname lastname = fLastname avatar = fAvatar }
  359. let r = null
  360. if (editId == '' && welcome) {
  361. r = emit server editIdentity('' + welcomeId, fields)
  362. } else if (editId == '') {
  363. r = emit server addIdentity(fields)
  364. } else {
  365. r = emit server editIdentity('' + editId, fields)
  366. }
  367. if (r == null) {
  368. message = 'the server did not answer — try again'
  369. return null
  370. }
  371. if (r.error != null) {
  372. message = r.error
  373. return null
  374. }
  375. identities = r.identities
  376. notice = editId == '' && !welcome ? 'Identity created.' : 'Identity saved.'
  377. editing = false
  378. welcome = false
  379. notWelcome = true
  380. choosing = forApp
  381. }
  382. on remove(id) {
  383. message = ''
  384. notice = ''
  385. row = rowOf(id)
  386. if (row == null) { return null }
  387. if (!confirm('Delete the identity “' + row.label + '”?')) { return null }
  388. r = emit server dropIdentity('' + id)
  389. if (r == null) {
  390. message = 'the server did not answer — try again'
  391. return null
  392. }
  393. if (r.error != null) {
  394. message = r.error
  395. return null
  396. }
  397. identities = r.identities
  398. if ('' + editId == '' + id) { editing = false }
  399. notice = 'Identity deleted.'
  400. }
  401. on useBrowserZone(e) { tzInput = browserZone() }
  402. on saveZone(e) {
  403. message = ''
  404. notice = ''
  405. v = tzInput.trim()
  406. if (!knownZone(v)) {
  407. message = 'this browser does not know the time zone “' + v + '”'
  408. return null
  409. }
  410. r = emit server changeTimeZone(v)
  411. if (r == null) {
  412. message = 'the server did not answer — try again'
  413. return null
  414. }
  415. if (r.error != null) {
  416. message = r.error
  417. return null
  418. }
  419. timeZone = r.timeZone
  420. tzInput = r.timeZone
  421. notice = 'Time zone saved.'
  422. }
  423. // "Other address": the session forgets the pending sign-in, back to the email form
  424. back = () => {
  425. message = ''
  426. r = emit server forgetPending()
  427. navigate(homeUrl)
  428. }
  429. // ---- the faces ------------------------------------------------------------------------
  430. // A face's LAST parameter is the session (the framework appends it). Every face that
  431. // needs the account asks accountOfSession, which only accepts the framework's Session.
  432. // A face runs on a BLANK instance: it has its arguments and its imports, not this
  433. // component's members or functions.
  434. // (the code request is NOT a face since mission 010: POST /api/code in lib/api.hl — a face
  435. // sees no request headers, so it could not apply the per-IP limit; a face here would be a
  436. // way around it)
  437. on server addIdentity(fields, session) {
  438. let me = accountOfSession(&session)
  439. if (me == null) { return { error = 'you are not signed in' } }
  440. r = createIdentity(me.id, fields)
  441. if (r.error != null) { return r }
  442. return { identity = r.identity identities = identityRows(me.id) }
  443. }
  444. on server editIdentity(id, fields, session) {
  445. let me = accountOfSession(&session)
  446. if (me == null) { return { error = 'you are not signed in' } }
  447. r = updateIdentity(me.id, id, fields)
  448. if (r.error != null) { return r }
  449. return { identity = r.identity identities = identityRows(me.id) }
  450. }
  451. on server dropIdentity(id, session) {
  452. let me = accountOfSession(&session)
  453. if (me == null) { return { error = 'you are not signed in' } }
  454. r = deleteIdentity(me.id, id)
  455. if (r.error != null) { return r }
  456. return { deleted = r.deleted identities = identityRows(me.id) }
  457. }
  458. on server changeTimeZone(tz, session) {
  459. let me = accountOfSession(&session)
  460. if (me == null) { return { error = 'you are not signed in' } }
  461. r = setTimeZone(me.id, tz)
  462. if (r.error != null) { return r }
  463. return { timeZone = r.account.timeZone }
  464. }
  465. // the identity for the app's login request (lib/apps.hl grantRequest: a plain login, or an invite's): { url } or { error }
  466. on server chooseIdentity(rid, identity, session) {
  467. let me = accountOfSession(&session)
  468. if (me == null) { return { error = 'you are not signed in' } }
  469. if (rid == null || hlTypeName(rid) != 'String') { return { error = 'field rid must be a string' } }
  470. if (identity == null || hlTypeName(identity) != 'String') { return { error = 'field identity must be a string' } }
  471. return grantRequest(me.id, rid, identity)
  472. }
  473. // THE PENDING SIGN-IN (ident#20): recorded after POST /api/code answered, only while a
  474. // code for that address is really waiting (lib/login.hl recordPending); "Other address"
  475. // forgets it. Named apart from the store functions (faces dispatch by name, hybriel#36).
  476. on server rememberPending(email, session) {
  477. return recordPending(&session, email)
  478. }
  479. on server forgetPending(session) {
  480. return dropPending(&session)
  481. }

Branches

Latest commits

  • 51e387f2|||PR ident#40 the code step is one component (components/codestep.hl) placed by home.hl and embed.hl; its verify face, setCode, browserZone and verify call exist once (#40.2)mre
  • c28bddeeMerge branch 'f2-shell' into mainIdent
  • c3a40ff6|||PR ident#40 one shell for the app and /start (account part off on /start, #40.1); startshell.hl removed; unused signOut faces gone (#40.4)mre
  • 060f3870ident#40.4: use the shell sign-out faces in regression gatesmre
  • 9b94aa6aMerge branch 'f1b-cleanup' into mainIdent
  • edcfce3f|||PR ident#41 ident#43 ident#44 login error page as a component (same status codes and text, pixel-identical), declarations and route wiring cleaned upmre
  • 3ac85995ident#43 ident#44: plain declarations for never-reassigned lets, one envString helper, named route functions and audience rule out of project.hlmre
  • c7eef14aMerge branch 'nv1-navigate' into mainIdent
  • 644f9775|||PR ident#36 navigate() instead of window.location in the shell, start shell and homemre
  • 4ca2f921deploy.sh: tar --hard-dereference so backups hold no hard linksmre
  • 23971fb7ident#49: media queries in the language's @media formmre
  • 73f4f97dident: re-vendor to hybriel day38b (mpackdb store-open fix)mre
  • aa056c03ident: a startup error prints its message before exit 1 (hybriel#247)mre
  • ee37a861ident#G48: gitoria's registration gets the wildcard origin of its repo addresses at load (gate tests/gitoria-origin.mjs)mre
  • dc6d486fident#27: the docs gate expects the new Access entry in the main menumre
  • d277633cident#27: README: identity access and the introspect endpointmre
  • e999b0d3ident#27: the Access tab — one key per identity for all its apps: give access in three steps, the overview matrix, a cell's sheet (since, last use, level, rotate, revoke), the app's check POST /api/introspect, agent identities hidden from the login picker, an inbox icon in the header's icon style (gate: tests/access.mjs)mre
  • 436206fcident#47: deploy.sh runs the sign-in gate on the deploy's own port slot, like the sessionwrites and docs gates (the default 8700 can be taken by another process)mre
  • a4887ea3ident#47: the selector's sign-in frame no longer has a Continue button; the identity row itself is the link (gate tests/signin.mjs fails on the old code)mre
  • d8ec703dident#45: /docs shows docs/IDENT.md (hl:markdown, vendored from ac1ed9da), one Docs entry in the main menu, README for developers only, gates tests/docs.mjs and tests/sessionwrites.mjs in deploy.shmre