Bunch of little fixes for beta release

main
Cameron Murphy Reikes 2 years ago
parent 616cceb49c
commit 6bfe5d73ae

@ -370,8 +370,8 @@
"rotation":0, "rotation":0,
"visible":true, "visible":true,
"width":32, "width":32,
"x":520.833333333333, "x":564.833333333333,
"y":577.5 "y":457
}, },
{ {
"class":"", "class":"",
@ -493,17 +493,6 @@
"width":32, "width":32,
"x":482.666666666667, "x":482.666666666667,
"y":433.333333333333 "y":433.333333333333
},
{
"class":"",
"height":32,
"id":15,
"name":"OldMan",
"rotation":0,
"visible":true,
"width":32,
"x":581,
"y":584
}], }],
"opacity":1, "opacity":1,
"type":"objectgroup", "type":"objectgroup",

@ -9,11 +9,12 @@ call run_codegen.bat || goto :error
set FLAGS=-s TOTAL_STACK=5242880 set FLAGS=-s TOTAL_STACK=5242880
copy marketing_page\favicon.ico build_web_release\favicon.ico 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 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 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 goto :EOF

@ -133,7 +133,7 @@ typedef struct AnimatedSprite
#ifdef DEVTOOLS #ifdef DEVTOOLS
#define SERVER_URL "http://localhost:8090" #define SERVER_URL "http://localhost:8090"
#else #else
#define SERVER_URL "https://rpgpt.duckdns.org/completion" #define SERVER_URL "https://rpgpt.duckdns.org"
#endif #endif
#include "makeprompt.h" #include "makeprompt.h"
@ -2751,9 +2751,11 @@ void frame(void)
#ifdef WEB #ifdef WEB
// fire off generation request, save id // 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({ int req_id = EM_ASM_INT({
return make_generation_request(UTF8ToString($1), UTF8ToString($0)); return make_generation_request(UTF8ToString($1), UTF8ToString($0));
}, SERVER_URL, prompt.data); }, completion_server_url, prompt.data);
it->gen_request_id = req_id; it->gen_request_id = req_id;
#endif #endif

@ -38,7 +38,7 @@ const (
type User struct { type User struct {
CreatedAt time.Time CreatedAt time.Time
UpdatedAt 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 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 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 req.Body = http.MaxBytesReader(w, req.Body, 1024 * 1024) // no sending huge files to crash the server
if doCors { if doCors {
w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Origin", "*")
@ -256,6 +256,8 @@ func index(w http.ResponseWriter, req *http.Request) {
if len(splitBody) != 2 { if len(splitBody) != 2 {
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
log.Println("Weird body length %d not 2\n", len(splitBody))
return
} }
var promptString string = splitBody[1] var promptString string = splitBody[1]
var userToken string = splitBody[0] var userToken string = splitBody[0]
@ -405,7 +407,7 @@ func main() {
doCors = os.Getenv("CORS") != "" doCors = os.Getenv("CORS") != ""
c = gogpt.NewClient(api_key) c = gogpt.NewClient(api_key)
http.HandleFunc("/", index) http.HandleFunc("/completion", completion)
http.HandleFunc("/webhook", webhookResponse) http.HandleFunc("/webhook", webhookResponse)
http.HandleFunc("/checkout", checkout) http.HandleFunc("/checkout", checkout)

@ -9,7 +9,7 @@ User=root
Group=root Group=root
WorkingDirectory=/root/rpgpt/server WorkingDirectory=/root/rpgpt/server
ExecStart=/usr/bin/go run . ExecStart=/usr/bin/go run .
EnvironmentFile=/root/.high_security EnvironmentFile=/root/.high_security_vars
Restart=on-failure Restart=on-failure
RestartSec=10 RestartSec=10
SyslogIdentifier=appgoservice SyslogIdentifier=appgoservice

Loading…
Cancel
Save