move request code

pull/1/head
vilmibm 2022-07-30 13:39:48 +00:00
parent 470ebb5507
commit 8138733bd1
5 changed files with 8 additions and 13 deletions

View File

@ -6,6 +6,7 @@ import (
"os" "os"
"os/user" "os/user"
"git.tilde.town/tildetown/town/request"
townUser "git.tilde.town/tildetown/town/user" townUser "git.tilde.town/tildetown/town/user"
) )
@ -27,12 +28,12 @@ func _main(args []string) error {
errs := []error{} errs := []error{}
err = processGitea(requestPath) err = request.ProcessGitea(requestPath)
if err != nil { if err != nil {
errs = append(errs, err) errs = append(errs, err)
} }
err = processGemini(requestPath) err = request.ProcessGemini(requestPath)
if err != nil { if err != nil {
errs = append(errs, err) errs = append(errs, err)
} }

View File

@ -1,7 +0,0 @@
package main
import "git.tilde.town/tildetown/town/email"
func main() {
email.SendLocalEmail("vilmibm", "testing hi", "this is a body")
}

View File

@ -1,4 +1,4 @@
package main package request
import ( import (
"fmt" "fmt"
@ -11,7 +11,7 @@ import (
const geminiHomeDocBase = "/home/gemini/users" const geminiHomeDocBase = "/home/gemini/users"
func processGemini(requestRootPath string) error { func ProcessGemini(requestRootPath string) error {
rp := filepath.Join(requestRootPath, "gemini") rp := filepath.Join(requestRootPath, "gemini")
files, err := ioutil.ReadDir(rp) files, err := ioutil.ReadDir(rp)

View File

@ -1,4 +1,4 @@
package main package request
import ( import (
"bytes" "bytes"
@ -19,7 +19,7 @@ import (
const pwLetters = "!@#$%^&*() []{}:;,.<>/?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890" const pwLetters = "!@#$%^&*() []{}:;,.<>/?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890"
func processGitea(rp string) error { func ProcessGitea(rp string) error {
apiToken := os.Getenv("GITEA_TOKEN") apiToken := os.Getenv("GITEA_TOKEN")
if apiToken == "" { if apiToken == "" {
return errors.New("need GITEA_TOKEN") return errors.New("need GITEA_TOKEN")

View File

@ -0,0 +1 @@
package request