fix: revert fools

fools-recovery
sammyette 2023-04-10 12:22:46 -04:00
parent 57ac7bd0f6
commit f1ebf8f5d4
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
7 changed files with 4 additions and 69 deletions

View File

@ -1,11 +1,5 @@
# 🎀 Changelog # 🎀 Changelog
## [2.1.1] - 2022-04-01
### Added
- Validation checks for command input
- Improved runtime performance
- Validate Lua code
## [2.1.0] - 2022-02-10 ## [2.1.0] - 2022-02-10
### Added ### Added
- Documented custom userdata types (Job and Timer Objects) - Documented custom userdata types (Job and Timer Objects)

32
exec.go
View File

@ -7,7 +7,6 @@ import (
"os/exec" "os/exec"
"fmt" "fmt"
"io" "io"
"math/rand"
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
@ -119,11 +118,6 @@ func runInput(input string, priv bool) {
// can only be a string or function so // can only be a string or function so
var runnerErr error var runnerErr error
input, exitCode, cont, runnerErr, err = runLuaRunner(currentRunner, input) input, exitCode, cont, runnerErr, err = runLuaRunner(currentRunner, input)
t := time.Now()
if t.Month() == 4 && t.Day() == 1 {
fmt.Println("april fools")
}
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)
cmdFinish(124, input, priv) cmdFinish(124, input, priv)
@ -202,17 +196,6 @@ func runLuaRunner(runr rt.Value, userInput string) (input string, exitCode uint8
} }
func handleLua(input string) (string, uint8, error) { func handleLua(input string) (string, uint8, error) {
t := time.Now()
if t.Month() == 4 && t.Day() == 1 {
rand.Seed(t.UnixNano())
p := rand.Intn(100-1) + 1
if p >= 42 {
time.Sleep(2 * time.Second)
return input, 69, fmt.Errorf("how do i deal with this input?")
}
}
cmdString := aliases.Resolve(input) cmdString := aliases.Resolve(input)
// First try to load input, essentially compiling to bytecode // First try to load input, essentially compiling to bytecode
chunk, err := l.CompileAndLoadLuaChunk("", []byte(cmdString), rt.TableValue(l.GlobalEnv())) chunk, err := l.CompileAndLoadLuaChunk("", []byte(cmdString), rt.TableValue(l.GlobalEnv()))
@ -240,27 +223,12 @@ func handleLua(input string) (string, uint8, error) {
} }
func handleSh(cmdString string) (input string, exitCode uint8, cont bool, runErr error) { func handleSh(cmdString string) (input string, exitCode uint8, cont bool, runErr error) {
t := time.Now()
if t.Month() == 4 && t.Day() == 1 {
rand.Seed(time.Now().UnixNano())
p := rand.Intn(100-1) + 1
if p >= 42 {
input = cmdString
exitCode = 69
runErr = fmt.Errorf("sorry i forgot how to run commands")
time.Sleep(2 * time.Second)
return
}
}
shRunner := hshMod.Get(rt.StringValue("runner")).AsTable().Get(rt.StringValue("sh")) shRunner := hshMod.Get(rt.StringValue("runner")).AsTable().Get(rt.StringValue("sh"))
var err error var err error
input, exitCode, cont, runErr, err = runLuaRunner(shRunner, cmdString) input, exitCode, cont, runErr, err = runLuaRunner(shRunner, cmdString)
if err != nil { if err != nil {
runErr = err runErr = err
} }
return return
} }

View File

@ -71,13 +71,6 @@ bait.catch('error', function(event, handler, err)
end) end)
bait.catch('command.not-found', function(cmd) bait.catch('command.not-found', function(cmd)
if os.date '%d' == '01' and os.date '%m' == '04' then
print 'oopsie!!! you made a bad mistake!!! goodbye!!'
hilbish.timeout(function()
os.exit()
end, 2000)
end
print(string.format('hilbish: %s not found', cmd)) print(string.format('hilbish: %s not found', cmd))
end) end)

View File

@ -3,10 +3,6 @@ local lunacolors = require 'lunacolors'
bait.catch('hilbish.init', function() bait.catch('hilbish.init', function()
if hilbish.interactive and type(hilbish.opts.greeting) == 'string' then if hilbish.interactive and type(hilbish.opts.greeting) == 'string' then
if os.date '%d' == '01' and os.date '%m' == '04' then
print('welcome to a shell, i think??')
else
print(lunacolors.format(hilbish.opts.greeting)) print(lunacolors.format(hilbish.opts.greeting))
end end
end
end) end)

View File

@ -8,10 +8,6 @@ Docs, docs, docs... At least builtins work with pipes now.
bait.catch('hilbish.init', function() bait.catch('hilbish.init', function()
if hilbish.interactive and hilbish.opts.motd then if hilbish.interactive and hilbish.opts.motd then
if os.date '%d' == '01' and os.date '%m' == '04' then
print('lolololololololol\n')
else
print(lunacolors.format(hilbish.motd)) print(lunacolors.format(hilbish.motd))
end end
end
end) end)

View File

@ -2,13 +2,10 @@ package util
import ( import (
"bufio" "bufio"
"fmt"
"io" "io"
"strings" "strings"
"math/rand"
"os" "os"
"os/user" "os/user"
"time"
rt "github.com/arnodel/golua/runtime" rt "github.com/arnodel/golua/runtime"
) )
@ -40,15 +37,6 @@ func DoString(rtm *rt.Runtime, code string) error {
// DoFile runs the contents of the file in the Lua runtime. // DoFile runs the contents of the file in the Lua runtime.
func DoFile(rtm *rt.Runtime, path string) error { func DoFile(rtm *rt.Runtime, path string) error {
t := time.Now()
if t.Month() == 4 && t.Day() == 1 {
rand.Seed(t.UnixNano())
p := rand.Intn(100-1) + 1
if p >= 72 {
return fmt.Errorf("i dont like you or your lua code")
}
}
f, err := os.Open(path) f, err := os.Open(path)
defer f.Close() defer f.Close()

View File

@ -11,8 +11,8 @@ var (
// Version info // Version info
var ( var (
ver = "v2.1.1" ver = "v2.1.0"
releaseName = "Blood Lily" releaseName = "Pansy"
gitCommit string gitCommit string
gitBranch string gitBranch string
) )