From 6bfe5d73ae84bd95b5fbe51a0c53013847f18343 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Sat, 1 Apr 2023 14:52:23 -0700 Subject: [PATCH] Bunch of little fixes for beta release --- assets/new_level.json | 15 ++------------- build_web_release.bat | 5 +++-- main.c | 6 ++++-- server/main.go | 8 +++++--- server/rpgpt.service | 2 +- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/assets/new_level.json b/assets/new_level.json index 79e93c2..8df432c 100644 --- a/assets/new_level.json +++ b/assets/new_level.json @@ -370,8 +370,8 @@ "rotation":0, "visible":true, "width":32, - "x":520.833333333333, - "y":577.5 + "x":564.833333333333, + "y":457 }, { "class":"", @@ -493,17 +493,6 @@ "width":32, "x":482.666666666667, "y":433.333333333333 - }, - { - "class":"", - "height":32, - "id":15, - "name":"OldMan", - "rotation":0, - "visible":true, - "width":32, - "x":581, - "y":584 }], "opacity":1, "type":"objectgroup", diff --git a/build_web_release.bat b/build_web_release.bat index dce635d..feb3634 100644 --- a/build_web_release.bat +++ b/build_web_release.bat @@ -9,11 +9,12 @@ call run_codegen.bat || goto :error set FLAGS=-s TOTAL_STACK=5242880 copy marketing_page\favicon.ico build_web_release\favicon.ico -copy marketing_page\eye_closed.svg build_web_release\eye_closed.svg -copy marketing_page\eye_open.svg build_web_release\eye_open.svg echo Building release +@echo on emcc -sEXPORTED_FUNCTIONS=_main,_end_text_input,_stop_controlling_input,_start_controlling_input,_read_from_save_data,_dump_save_data,_in_dialog -sEXPORTED_RUNTIME_METHODS=ccall,cwrap -DNDEBUG -O2 -s ALLOW_MEMORY_GROWTH %FLAGS% -Ithirdparty -Igen main.c -o build_web_release\index.html --preload-file assets --shell-file web_template.html || goto :error +@echo off +echo Built goto :EOF diff --git a/main.c b/main.c index 10af5ab..a7367c0 100644 --- a/main.c +++ b/main.c @@ -133,7 +133,7 @@ typedef struct AnimatedSprite #ifdef DEVTOOLS #define SERVER_URL "http://localhost:8090" #else -#define SERVER_URL "https://rpgpt.duckdns.org/completion" +#define SERVER_URL "https://rpgpt.duckdns.org" #endif #include "makeprompt.h" @@ -2751,9 +2751,11 @@ void frame(void) #ifdef WEB // fire off generation request, save id + BUFF(char, 512) completion_server_url = {0}; + printf_buff(&completion_server_url, "%s/completion", SERVER_URL); int req_id = EM_ASM_INT({ return make_generation_request(UTF8ToString($1), UTF8ToString($0)); - }, SERVER_URL, prompt.data); + }, completion_server_url, prompt.data); it->gen_request_id = req_id; #endif diff --git a/server/main.go b/server/main.go index f5f6c5a..cbf7d6b 100644 --- a/server/main.go +++ b/server/main.go @@ -38,7 +38,7 @@ const ( type User struct { CreatedAt time.Time UpdatedAt time.Time - DeletedAt gorm.DeletedAt `gorm:"index"` + DeletedAt gorm.DeletedAt `gorm:"completion"` Code codes.UserCode `gorm:"primaryKey"` // of maximum value max codes, incremented one by one. These are converted to 4 digit alphanumeric code users can remember/use BoughtTime int64 // unix time. Used to figure out if the pass is still valid @@ -240,7 +240,7 @@ func checkout(w http.ResponseWriter, req *http.Request) { } } -func index(w http.ResponseWriter, req *http.Request) { +func completion(w http.ResponseWriter, req *http.Request) { req.Body = http.MaxBytesReader(w, req.Body, 1024 * 1024) // no sending huge files to crash the server if doCors { w.Header().Set("Access-Control-Allow-Origin", "*") @@ -256,6 +256,8 @@ func index(w http.ResponseWriter, req *http.Request) { if len(splitBody) != 2 { w.WriteHeader(http.StatusBadRequest) + log.Println("Weird body length %d not 2\n", len(splitBody)) + return } var promptString string = splitBody[1] var userToken string = splitBody[0] @@ -405,7 +407,7 @@ func main() { doCors = os.Getenv("CORS") != "" c = gogpt.NewClient(api_key) - http.HandleFunc("/", index) + http.HandleFunc("/completion", completion) http.HandleFunc("/webhook", webhookResponse) http.HandleFunc("/checkout", checkout) diff --git a/server/rpgpt.service b/server/rpgpt.service index 053d4cf..ce90733 100644 --- a/server/rpgpt.service +++ b/server/rpgpt.service @@ -9,7 +9,7 @@ User=root Group=root WorkingDirectory=/root/rpgpt/server ExecStart=/usr/bin/go run . -EnvironmentFile=/root/.high_security +EnvironmentFile=/root/.high_security_vars Restart=on-failure RestartSec=10 SyslogIdentifier=appgoservice