changeset 21:b14073ab9d07

update luan
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 14 Sep 2024 22:17:26 -0600
parents 8b4481769cc6
children e65668ff8822
files luan/install.sh luan/jars/luan.jar luan/jars/slf4j-goodjava.jar luan/uninstall.sh src/admin/add.html.luan src/get_password.html.luan
diffstat 6 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
diff -r 8b4481769cc6 -r b14073ab9d07 luan/install.sh
--- a/luan/install.sh	Mon Aug 05 11:32:22 2024 +0300
+++ b/luan/install.sh	Sat Sep 14 22:17:26 2024 -0600
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 set -e
 
 cd `dirname $0`
@@ -5,7 +7,10 @@
 mkdir -p /usr/local/bin
 
 cat >/usr/local/bin/luan <<End
+#!/bin/bash
+
 for i in `pwd`/jars/* ; do CLASSPATH=\$CLASSPATH:\$i ; done
+CLASSPATH=$(echo -n $CLASSPATH | sed 's/^://')
 
 java -classpath \$CLASSPATH luan.Luan "\$@"
 End
diff -r 8b4481769cc6 -r b14073ab9d07 luan/jars/luan.jar
Binary file luan/jars/luan.jar has changed
diff -r 8b4481769cc6 -r b14073ab9d07 luan/jars/slf4j-goodjava.jar
Binary file luan/jars/slf4j-goodjava.jar has changed
diff -r 8b4481769cc6 -r b14073ab9d07 luan/uninstall.sh
--- a/luan/uninstall.sh	Mon Aug 05 11:32:22 2024 +0300
+++ b/luan/uninstall.sh	Sat Sep 14 22:17:26 2024 -0600
@@ -1,3 +1,5 @@
+#!/bin/bash
+
 set -e
 rm -f /usr/local/bin/luan
 cd `dirname $0`
diff -r 8b4481769cc6 -r b14073ab9d07 src/admin/add.html.luan
--- a/src/admin/add.html.luan	Mon Aug 05 11:32:22 2024 +0300
+++ b/src/admin/add.html.luan	Sat Sep 14 22:17:26 2024 -0600
@@ -1,7 +1,6 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local String = require "luan:String.luan"
-local matches = String.matches or error()
 local Io = require "luan:Io.luan"
 local Http = require "luan:http/Http.luan"
 local Shared = require "site:/lib/Shared.luan"
@@ -12,11 +11,12 @@
 local save_raw_config = Shared.save_raw_config or error()
 local admin_return = Shared.admin_return or error()
 
+local name_regex = String.regex("^[a-z0-9_][a-z0-9_-]*$")
 
 local function handle()
 	local user = get_user()
 	local repo_name = Http.request.parameters.repo or error()
-	matches( repo_name, "^[a-z0-9_][a-z0-9_-]*$" ) or error "invalid regex name"
+	name_regex.matches( repo_name ) or error "invalid regex name"
 	if repo_name=="_all" or repo_name=="_private" then
 		return [[<p error>Invalid rep name</p>]]
 	end
diff -r 8b4481769cc6 -r b14073ab9d07 src/get_password.html.luan
--- a/src/get_password.html.luan	Mon Aug 05 11:32:22 2024 +0300
+++ b/src/get_password.html.luan	Sat Sep 14 22:17:26 2024 -0600
@@ -1,7 +1,6 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local String = require "luan:String.luan"
-local matches = String.matches or error()
 local Io = require "luan:Io.luan"
 local output_of = Io.output_of or error()
 local Http = require "luan:http/Http.luan"
@@ -16,9 +15,10 @@
 
 
 local send_mail = config.mail_info and Mail.sender(config.mail_info).send
+local email_regex = String.regex[[^(\w[-+~.\w]*)@[-\w]+(\\.[-\w]+)*\.[a-zA-Z]+$]]
 
 local function handle(email)
-	matches( email, [[^(\w[-+~.\w]*)@[-\w]+(\\.[-\w]+)*\.[a-zA-Z]+$]] ) or error "invalid email"
+	email_regex.matches(email) or error "invalid email"
 	local change = Http.request.parameters.change ~= nil
 	local password = config.users[email]
 	if password == nil or change then