Compare commits
	
		
			3 Commits
		
	
	
		
			7b9ccf0ff2
			...
			7cb2fd67d1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 7cb2fd67d1 | ||
|  | ebadba99af | ||
|  | b3294e880f | 
| @ -3,7 +3,6 @@ package main | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"math/rand" | ||||
| 	"os" | ||||
| 	"os/user" | ||||
| 	"path" | ||||
| @ -71,8 +70,6 @@ func validExec(execPath string) error { | ||||
| } | ||||
| 
 | ||||
| func submit(opts *contribOpts) error { | ||||
| 	rand.Seed(time.Now().UTC().UnixNano()) | ||||
| 
 | ||||
| 	var cmdName string | ||||
| 	var category string | ||||
| 	var shortDesc string | ||||
|  | ||||
| @ -153,8 +153,6 @@ func _main() error { | ||||
| 
 | ||||
| 	r := newReviewer(signupDB, u.Username) | ||||
| 
 | ||||
| 	rand.Seed(time.Now().Unix()) | ||||
| 
 | ||||
| 	su := models.TownSignup{} | ||||
| 
 | ||||
| 	signups, err := su.All(signupDB) | ||||
| @ -437,7 +435,8 @@ func _main() error { | ||||
| 					if exiterr, ok := err.(*exec.ExitError); ok { | ||||
| 						// no match or interrupt. who cares | ||||
| 						switch exiterr.ExitCode() { | ||||
| 						case 1: case 130: | ||||
| 						case 1: | ||||
| 						case 130: | ||||
| 							return | ||||
| 						} | ||||
| 					} | ||||
|  | ||||
| @ -6,11 +6,14 @@ import ( | ||||
| 	"math/rand" | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"os/user" | ||||
| 	"path" | ||||
| 	"strings" | ||||
| 
 | ||||
| 	"git.tilde.town/tildetown/town/email" | ||||
| 	"github.com/charmbracelet/glamour" | ||||
| 	"github.com/charmbracelet/huh" | ||||
| 	"gopkg.in/yaml.v3" | ||||
| ) | ||||
| 
 | ||||
| //go:embed banners/* | ||||
| @ -35,8 +38,128 @@ func banner() (string, error) { | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| func pager() *exec.Cmd { | ||||
| 	return exec.Command("/usr/bin/bat") | ||||
| func info() error { | ||||
| 	infoContent, err := md.ReadFile("md/info.md") | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	out, err := glamour.Render(string(infoContent), "dracula") | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	cmd := exec.Command("/usr/bin/bat") | ||||
| 	cmd.Stdin = strings.NewReader(out) | ||||
| 	cmd.Stdout = os.Stdout | ||||
| 	return cmd.Run() | ||||
| } | ||||
| 
 | ||||
| type physicalData struct { | ||||
| 	Arriving       string | ||||
| 	Departing      string | ||||
| 	Transportation bool | ||||
| 	Lodging        bool | ||||
| 	Allergies      string | ||||
| 	Couch          bool | ||||
| } | ||||
| 
 | ||||
| type rsvpData struct { | ||||
| 	Being        string | ||||
| 	PhysicalData *physicalData `yaml:"PhysicalData,omitempty"` | ||||
| 	Freeform     string | ||||
| } | ||||
| 
 | ||||
| func sendRSVPEmail(rd rsvpData) error { | ||||
| 	bs, err := yaml.Marshal(rd) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	return email.SendLocalEmail("vilmibm", "RSVP TOWNCON24", string(bs)) | ||||
| } | ||||
| 
 | ||||
| func rsvp(o opts) error { | ||||
| 	var being string | ||||
| 	var arriving string | ||||
| 	var departing string | ||||
| 	var transportation bool | ||||
| 	lodging := true | ||||
| 	var allergies string | ||||
| 	couch := true | ||||
| 	var freeform string | ||||
| 
 | ||||
| 	form := huh.NewForm( | ||||
| 		huh.NewGroup( | ||||
| 			huh.NewSelect[string]().Title("How will you be attending?"). | ||||
| 				Options( | ||||
| 					huh.NewOption("Digitally", "digital"), | ||||
| 					huh.NewOption("Phyiscally", "physical"), | ||||
| 				).Value(&being)), | ||||
| 
 | ||||
| 		// Physical attendee form | ||||
| 		huh.NewGroup( | ||||
| 			huh.NewInput().Title("When (day/time) are you arriving?"). | ||||
| 				Value(&arriving), | ||||
| 			huh.NewInput().Title("When (day/time) are you departing?"). | ||||
| 				Value(&departing), | ||||
| 		).WithHideFunc(func() bool { | ||||
| 			return being != "physical" | ||||
| 		}), | ||||
| 		huh.NewGroup( | ||||
| 			huh.NewConfirm().Title("Will you be staying overnight at the venue?"). | ||||
| 				Value(&lodging), | ||||
| 		).WithHideFunc(func() bool { | ||||
| 			return being != "physical" | ||||
| 		}), | ||||
| 		huh.NewGroup( | ||||
| 			huh.NewConfirm().Title("If the need arises are you ok sleeping on a couch?"). | ||||
| 				Value(&couch), | ||||
| 		).WithHideFunc(func() bool { | ||||
| 			return being != "physical" && !lodging | ||||
| 		}), | ||||
| 		huh.NewGroup( | ||||
| 			huh.NewInput().Title("Do you have any food allergies I should be aware of?"). | ||||
| 				Value(&allergies), | ||||
| 			huh.NewConfirm().Title("Will you need any help getting to the venue?"). | ||||
| 				Description("I have a car and have some ability to help getting people to the venue"). | ||||
| 				Value(&transportation), | ||||
| 		).WithHideFunc(func() bool { | ||||
| 			return being != "physical" | ||||
| 		}), | ||||
| 
 | ||||
| 		// Catch all freeform | ||||
| 		huh.NewGroup( | ||||
| 			huh.NewText(). | ||||
| 				Title("Anything you want me to know? Any questions?"). | ||||
| 				Value(&freeform))) | ||||
| 
 | ||||
| 	err := form.Run() | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	var pd *physicalData | ||||
| 
 | ||||
| 	if being == "physical" { | ||||
| 		pd = &physicalData{ | ||||
| 			Arriving:       arriving, | ||||
| 			Departing:      departing, | ||||
| 			Transportation: transportation, | ||||
| 			Lodging:        lodging, | ||||
| 			Allergies:      allergies, | ||||
| 			Couch:          couch, | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	rd := rsvpData{ | ||||
| 		Being:        being, | ||||
| 		Freeform:     freeform, | ||||
| 		PhysicalData: pd} | ||||
| 
 | ||||
| 	return sendRSVPEmail(rd) | ||||
| } | ||||
| 
 | ||||
| type opts struct { | ||||
| 	Username string | ||||
| } | ||||
| 
 | ||||
| func _main() error { | ||||
| @ -47,6 +170,18 @@ func _main() error { | ||||
| 
 | ||||
| 	fmt.Println(b) | ||||
| 
 | ||||
| 	u, err := user.Current() | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	o := opts{ | ||||
| 		Username: u.Username, | ||||
| 	} | ||||
| 
 | ||||
| 	fmt.Printf("\t\t^_^_^_^_^_^_^ hi ~%s ^_^_^_^_^_^_^\n", o.Username) | ||||
| 	fmt.Println() | ||||
| 
 | ||||
| 	var mode string | ||||
| 
 | ||||
| 	huh.NewSelect[string]().Title("whuddyu wanna doo?"). | ||||
| @ -60,22 +195,9 @@ func _main() error { | ||||
| 
 | ||||
| 	switch mode { | ||||
| 	case "info": | ||||
| 		infoContent, err := md.ReadFile("md/info.md") | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		out, err := glamour.Render(string(infoContent), "dracula") | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		cmd := pager() | ||||
| 		cmd.Stdin = strings.NewReader(out) | ||||
| 		cmd.Stdout = os.Stdout | ||||
| 		err = cmd.Run() | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		return info() | ||||
| 	case "rsvp": | ||||
| 		return rsvp(o) | ||||
| 	case "submit": | ||||
| 	case "jam": | ||||
| 	case "quit": | ||||
|  | ||||
| @ -73,6 +73,12 @@ I'll arrange food throughout the event. | ||||
| 
 | ||||
| There are also plenty of restaurants around the venue if people want to get their own food. | ||||
| 
 | ||||
| ### TRANSPORTATION | ||||
| 
 | ||||
| The venue is accessible from rail, bus, and cab/uber/lyft. I have a car and can make myself available to pick people up and get them to the venue once they have made it to Chicago if they need. Depending on timing I might not be able to help, however. Contact via my cell phone (`~vilmibm/phone.txt`) to ask about my availability for a ride during the event. | ||||
| 
 | ||||
| If you are driving parking might be tough in the area--I can offer a few spots by my place in Forest Park if you want to put a car there and then get a ride over to the venue. | ||||
| 
 | ||||
| ### ACTIVITIES | ||||
| 
 | ||||
| I'd like to do a field trip on the 12th...Some potential ideas: | ||||
| @ -84,3 +90,7 @@ I'd like to do a field trip on the 12th...Some potential ideas: | ||||
| - just hang out and play synths (field trip of the mind) | ||||
| 
 | ||||
| !!! TBD !!! | ||||
| 
 | ||||
| ## COMMS | ||||
| 
 | ||||
| For any kind of emergency during the event please contact me via my cell phone. My number can be found at `~vilmibm/phone.txt`. | ||||
|  | ||||
| @ -3,13 +3,11 @@ package main | ||||
| import ( | ||||
| 	"encoding/json" | ||||
| 	"fmt" | ||||
| 	"io/ioutil" | ||||
| 	"math/rand" | ||||
| 	"os" | ||||
| 	"os/exec" | ||||
| 	"path/filepath" | ||||
| 	"strings" | ||||
| 	"time" | ||||
| 
 | ||||
| 	"github.com/AlecAivazis/survey/v2" | ||||
| 	"github.com/charmbracelet/glamour" | ||||
| @ -39,7 +37,6 @@ func main() { | ||||
| } | ||||
| 
 | ||||
| func visitRandomUser() error { | ||||
| 	rand.Seed(time.Now().UnixNano()) | ||||
| 	usernames, err := getUsernames() | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| @ -78,7 +75,7 @@ func visitPrompt() error { | ||||
| } | ||||
| 
 | ||||
| func visitUser(username string) error { | ||||
| 	files, err := ioutil.ReadDir(filepath.Join("/home", username)) | ||||
| 	files, err := os.ReadDir(filepath.Join("/home", username)) | ||||
| 	if err != nil { | ||||
| 		return fmt.Errorf("user is not accepting visitors (could not read user's home directory: %w)", err) | ||||
| 	} | ||||
| @ -90,7 +87,7 @@ func visitUser(username string) error { | ||||
| 
 | ||||
| 		path := filepath.Join("/home", username, file.Name()) | ||||
| 
 | ||||
| 		data, err := ioutil.ReadFile(path) | ||||
| 		data, err := os.ReadFile(path) | ||||
| 		if err != nil { | ||||
| 			break | ||||
| 		} | ||||
|  | ||||
| @ -12,7 +12,6 @@ import ( | ||||
| 	"os/user" | ||||
| 	"path/filepath" | ||||
| 	"syscall" | ||||
| 	"time" | ||||
| 
 | ||||
| 	email "git.tilde.town/tildetown/town/email" | ||||
| ) | ||||
| @ -178,7 +177,6 @@ if you did _not_ request this, please let an admin know. | ||||
| } | ||||
| 
 | ||||
| func genGiteaPassword() string { | ||||
| 	rand.Seed(time.Now().UnixNano()) | ||||
| 	b := make([]byte, 20) | ||||
| 	for i := range b { | ||||
| 		b[i] = pwLetters[rand.Intn(len(pwLetters))] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user