refactoring volgens skill

This commit is contained in:
2026-08-29 22:25:06 +02:00
parent 09121df0d7
commit b3a5a0b345
20 changed files with 1043 additions and 998 deletions
+30 -18
View File
@@ -1,24 +1,36 @@
#lang racket/base
(require "users.rkt"
simple-ini/class)
(require racket/class
racket/contract
simple-ini/class
"users.rkt")
(provide set-user)
(define (set-user)
(displayln "Using rkt-web-player.ini as configuration file")
(newline)
(display "Give username: >")
(define user (read-line))
(display "Give password: >")
(define pwd (read-line))
(let ((hash (make-password-hash pwd)))
(define ini (new ini% [file "rkt-web-player.ini"]))
(send ini set! 'users (string->symbol user) hash)
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Provided functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; goal : Interactively add or replace one configured web-player user.
; pre : Standard input supplies a username and a password of at least
; twelve characters; rkt-web-player.ini is writable.
; post : The INI file's [users] section contains an Argon2id hash for the
; entered username; the clear-text password is not stored.
; result : Void after the configuration file has been updated.
; internals:
; The small utility uses simple-ini directly and intentionally owns
; no duplicate configuration representation.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define/contract (set-user)
(-> void?)
(displayln "Using rkt-web-player.ini as configuration file")
(newline)
(display "Give username: >")
(let ((user (read-line)))
(display "Give password: >")
(let* ((password (read-line))
(hash (make-password-hash password))
(ini (new ini% (file "rkt-web-player.ini"))))
(send ini set! 'users (string->symbol user) hash)
(void))))