Permalink
Browse files

Provide a better welcome.

  • Loading branch information...
oskarth committed Sep 14, 2015
1 parent 80ca9b3 commit a1c8ece3cd8bc0d9b912a437a19d68f5cce41e89
Showing with 18 additions and 9 deletions.
  1. +3 −1 client/js/netpowder.js
  2. +15 −8 server/handler.rkt
@@ -36,7 +36,9 @@ function log(msg) {
var ws = new WebSocket('ws://placeholder.neptune.netpowder.com:8080/');
ws.onopen = function() {
log('CONNECTED');
log('bottom of the screen to login.');
log('Enter your access code at the');
log('Welcome to Netpowder!');
};
ws.onclose = function() {
log('DISCONNECTED');
@@ -66,6 +66,7 @@
(string-join (list "echo ran" (string-join args) "\n")))
(define (ping? cmd) (equal? (car cmd) "ping"))
(define (help? cmd) (equal? (car cmd) "help"))
(define (open? cmd) (equal? (car cmd) "open"))
(define (serve? cmd) (equal? (car cmd) "serve"))
(define (beginop? cmd) (equal? (car cmd) "beginop"))
@@ -77,6 +78,7 @@
(define (handle-command cmd)
(cond [(= (length cmd) 0) "unknown\n"]
[(help? cmd) (open '("README.md"))]
[(ping? cmd) "pong\n"]
[(= (length cmd) 1) "unknown\n"]
[(open? cmd) (open (cdr cmd))]
@@ -101,11 +103,16 @@
; Super Poor man's auth
;(if (equal? (read-line) (getenv "TICKET"))
(if (equal? (read-line) ticket)
(begin
(display "AUTHENTICATED\n")
(flush-output)
(input-loop))
(begin
(display "UNAUTHENTICATED\n")
(flush-output)))
(define (auth-loop)
(if (equal? (read-line) ticket)
(begin
(display "\nType 'help' to get help.\n")
(display "Authenticated.\n")
(flush-output)
(input-loop))
(begin
(display "\nBad login. Please try again.\n")
(flush-output)
(auth-loop))))
(auth-loop)

0 comments on commit a1c8ece

Please sign in to comment.