move request code
This commit is contained in:
		
							父節點
							
								
									470ebb5507
								
							
						
					
					
						當前提交
						8138733bd1
					
				@ -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)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
							
								
								
									
										7
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.go
									
									
									
									
									
								
							@ -1,7 +0,0 @@
 | 
				
			|||||||
package main
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import "git.tilde.town/tildetown/town/email"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func main() {
 | 
					 | 
				
			||||||
	email.SendLocalEmail("vilmibm", "testing hi", "this is a body")
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -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)
 | 
				
			||||||
 | 
				
			|||||||
@ -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")
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								request/request.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								request/request.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					package request
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user