Compare commits
	
		
			7 Commits
		
	
	
		
			3f359d0c57
			...
			1892da9682
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					1892da9682 | ||
| 
						 | 
					0de632d29c | ||
| 
						 | 
					bbe7c76ae0 | ||
| 
						 | 
					f32461649b | ||
| 
						 | 
					3010118695 | ||
| 
						 | 
					fbc1dfd85a | ||
| 
						 | 
					41a20025f9 | 
							
								
								
									
										6
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "cSpell.words": [
 | 
				
			||||||
 | 
					        "diyhrt",
 | 
				
			||||||
 | 
					        "transfem"
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -3,28 +3,25 @@
 | 
				
			|||||||
<head>
 | 
					<head>
 | 
				
			||||||
    <meta charset="UTF-8">
 | 
					    <meta charset="UTF-8">
 | 
				
			||||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
				
			||||||
    <title>NewTab</title>
 | 
					    <title>{{ .PageTitle }}</title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <link rel="stylesheet" type="text/css" href="assets/style.css">
 | 
					    <link rel="stylesheet" type="text/css" href="assets/style.css">
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
<body>
 | 
					<body>
 | 
				
			||||||
    <form class="search-grid" action="https://duckduckgo.com/">
 | 
					    <form class="search-grid" action="{{ .SearchFormAction }}">
 | 
				
			||||||
        <div class="search-logo">
 | 
					        <div class="search-logo">
 | 
				
			||||||
            <img als="girl_juice" src="assets/girl_juice.png" />
 | 
					            <img als="girl_juice" src="assets/girl_juice.png" />
 | 
				
			||||||
            <h2 class="phrases">GirlJuice.Inject()</h2>
 | 
					            <h2 class="phrases"></h2>
 | 
				
			||||||
            <img als="girl_juice" src="assets/girl_juice.png" />
 | 
					            <img als="girl_juice" src="assets/girl_juice.png" />
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
        <input name="q" type="text" class="grid-item" class="search" placeholder="Search DuckDuckGo :3 :3 :3" />
 | 
					        <input name="{{ .SearchInputName }}" type="text" class="grid-item" class="search" placeholder="{{ .SearchPlaceholder }}" />
 | 
				
			||||||
    </form>
 | 
					    </form>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        const phrases = [
 | 
					        const phrases = [
 | 
				
			||||||
            "GirlJuice.Inject()",
 | 
					            {{range $Phrase := .HeaderPhrases }}
 | 
				
			||||||
            "Child.CrowdKill()",
 | 
					            "{{ $Phrase }}",
 | 
				
			||||||
            "CopCar.Burn()",
 | 
					            {{- end }}
 | 
				
			||||||
            "You.Cute = true",
 | 
					 | 
				
			||||||
            "You.Gay = true",
 | 
					 | 
				
			||||||
            "Nazi.Punch()",
 | 
					 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Array.from(document.querySelectorAll(".phrases")).forEach(element => {
 | 
					        Array.from(document.querySelectorAll(".phrases")).forEach(element => {
 | 
				
			||||||
@@ -33,18 +30,24 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        document.addEventListener('DOMContentLoaded', function() {
 | 
					        document.addEventListener('DOMContentLoaded', function() {
 | 
				
			||||||
            const marqueeElement = document.body;
 | 
					            const marqueeElement = document.body;
 | 
				
			||||||
            let position = 0;
 | 
					            let xPosition = 0;
 | 
				
			||||||
            const speed = 1; // Adjust speed here (lower is slower)
 | 
					            let yPosition = 0;
 | 
				
			||||||
 | 
					            const xSpeed = {{ .BackgroundScrollX }}; // Adjust speed here (lower is slower)
 | 
				
			||||||
 | 
					            const ySpeed = {{ .BackgroundScrollY }};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            function animateMarquee() {
 | 
					            function animateMarquee() {
 | 
				
			||||||
                position -= speed;
 | 
					                xPosition -= xSpeed;
 | 
				
			||||||
 | 
					                yPosition -= ySpeed;
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                // Reset position when the image has scrolled completely
 | 
					                // Reset position when the image has scrolled completely
 | 
				
			||||||
                if (Math.abs(position) >= marqueeElement.offsetWidth) {
 | 
					                if (Math.abs(xPosition) >= marqueeElement.offsetWidth) {
 | 
				
			||||||
                    position = 0;
 | 
					                    xPosition = 0;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (Math.abs(yPosition) >= marqueeElement.offsetHeight) {
 | 
				
			||||||
 | 
					                    yPosition = 0;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                marqueeElement.style.backgroundPosition = `${position}px 0`;
 | 
					                marqueeElement.style.backgroundPosition = `${xPosition}px ${yPosition}px`;
 | 
				
			||||||
                requestAnimationFrame(animateMarquee);
 | 
					                requestAnimationFrame(animateMarquee);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								go.mod
									
									
									
									
									
								
							@@ -1,3 +1,16 @@
 | 
				
			|||||||
module gitea.elara.ws/Hazel/transfem-startpage
 | 
					module gitea.elara.ws/Hazel/transfem-startpage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
go 1.24.2
 | 
					go 1.24.2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					require (
 | 
				
			||||||
 | 
						github.com/labstack/echo/v4 v4.13.4 // indirect
 | 
				
			||||||
 | 
						github.com/labstack/gommon v0.4.2 // indirect
 | 
				
			||||||
 | 
						github.com/mattn/go-colorable v0.1.14 // indirect
 | 
				
			||||||
 | 
						github.com/mattn/go-isatty v0.0.20 // indirect
 | 
				
			||||||
 | 
						github.com/valyala/bytebufferpool v1.0.0 // indirect
 | 
				
			||||||
 | 
						github.com/valyala/fasttemplate v1.2.2 // indirect
 | 
				
			||||||
 | 
						golang.org/x/crypto v0.38.0 // indirect
 | 
				
			||||||
 | 
						golang.org/x/net v0.40.0 // indirect
 | 
				
			||||||
 | 
						golang.org/x/sys v0.33.0 // indirect
 | 
				
			||||||
 | 
						golang.org/x/text v0.25.0 // indirect
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										21
									
								
								go.sum
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								go.sum
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					github.com/labstack/echo/v4 v4.13.4 h1:oTZZW+T3s9gAu5L8vmzihV7/lkXGZuITzTQkTEhcXEA=
 | 
				
			||||||
 | 
					github.com/labstack/echo/v4 v4.13.4/go.mod h1:g63b33BZ5vZzcIUF8AtRH40DrTlXnx4UMC8rBdndmjQ=
 | 
				
			||||||
 | 
					github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
 | 
				
			||||||
 | 
					github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
 | 
				
			||||||
 | 
					github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
 | 
				
			||||||
 | 
					github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
 | 
				
			||||||
 | 
					github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
 | 
				
			||||||
 | 
					github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
 | 
				
			||||||
 | 
					github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
 | 
				
			||||||
 | 
					github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
 | 
				
			||||||
 | 
					github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
 | 
				
			||||||
 | 
					github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
 | 
				
			||||||
 | 
					golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
 | 
				
			||||||
 | 
					golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
 | 
				
			||||||
 | 
					golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
 | 
				
			||||||
 | 
					golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
 | 
				
			||||||
 | 
					golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
 | 
				
			||||||
 | 
					golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
 | 
				
			||||||
 | 
					golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package backend
 | 
					package diyhrt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
package backend
 | 
					package diyhrt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ActiveIngredient struct {
 | 
					type ActiveIngredient struct {
 | 
				
			||||||
	Name        string `json:"name"`
 | 
						Name        string `json:"name"`
 | 
				
			||||||
							
								
								
									
										42
									
								
								internal/rendering/config.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								internal/rendering/config.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					package rendering
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "reflect"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type RenderingConfig struct {
 | 
				
			||||||
 | 
						HeaderPhrases     []string
 | 
				
			||||||
 | 
						BackgroundScrollX string
 | 
				
			||||||
 | 
						BackgroundScrollY string
 | 
				
			||||||
 | 
						PageTitle         string
 | 
				
			||||||
 | 
						SearchPlaceholder string
 | 
				
			||||||
 | 
						SearchFormAction  string
 | 
				
			||||||
 | 
						SearchInputName   string
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func DefaultRenderingConfig() RenderingConfig {
 | 
				
			||||||
 | 
						return RenderingConfig{
 | 
				
			||||||
 | 
							HeaderPhrases: []string{
 | 
				
			||||||
 | 
								"GirlJuice.Inject()",
 | 
				
			||||||
 | 
								"Child.CrowdKill()",
 | 
				
			||||||
 | 
								"CopCar.Burn()",
 | 
				
			||||||
 | 
								"You.Cute = true",
 | 
				
			||||||
 | 
								"You.Gay = true",
 | 
				
			||||||
 | 
								"Nazi.Punch()",
 | 
				
			||||||
 | 
								"Dolls.GiveGuns()",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							BackgroundScrollX: "1",
 | 
				
			||||||
 | 
							BackgroundScrollY: "0",
 | 
				
			||||||
 | 
							PageTitle:         "TransRights",
 | 
				
			||||||
 | 
							SearchPlaceholder: "Search on DuckDuckGo",
 | 
				
			||||||
 | 
							SearchFormAction:  "https://duckduckgo.com/",
 | 
				
			||||||
 | 
							SearchInputName:   "q",
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (rc *RenderingConfig) Set(key string, value string) {
 | 
				
			||||||
 | 
						// https://gist.github.com/kilfu0701/77c614386483782f68bc5538b6100730
 | 
				
			||||||
 | 
						r := reflect.ValueOf(rc)
 | 
				
			||||||
 | 
						f := reflect.Indirect(r).FieldByName(key)
 | 
				
			||||||
 | 
						if f.Kind() != reflect.Invalid {
 | 
				
			||||||
 | 
							f.SetString(value)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										19
									
								
								internal/rendering/template.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								internal/rendering/template.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					package rendering
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import (
 | 
				
			||||||
 | 
						"html/template"
 | 
				
			||||||
 | 
						"log"
 | 
				
			||||||
 | 
						"os"
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func getFileContent() string {
 | 
				
			||||||
 | 
						content, err := os.ReadFile("frontend/index.html")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							log.Fatal(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return string(content)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var IndexTemplate = template.Must(template.New("index").Parse(getFileContent()))
 | 
				
			||||||
							
								
								
									
										38
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								main.go
									
									
									
									
									
								
							@@ -1,21 +1,41 @@
 | 
				
			|||||||
package main
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"bytes"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"net/http"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"gitea.elara.ws/Hazel/transfem-startpage/backend"
 | 
						"gitea.elara.ws/Hazel/transfem-startpage/internal/rendering"
 | 
				
			||||||
 | 
						"github.com/labstack/echo/v4"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var CurrentRenderingConfig = rendering.DefaultRenderingConfig()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func setConfig(c echo.Context) error {
 | 
				
			||||||
 | 
						err := c.Bind(&CurrentRenderingConfig)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return c.String(http.StatusBadRequest, err.Error())
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return c.String(http.StatusOK, "OK")
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func getIndex(c echo.Context) error {
 | 
				
			||||||
 | 
						var tpl bytes.Buffer
 | 
				
			||||||
 | 
						rendering.IndexTemplate.Execute(&tpl, CurrentRenderingConfig)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return c.HTML(http.StatusOK, tpl.String())
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
	fmt.Println("running transfem startpage")
 | 
						fmt.Println("running transfem startpage")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	listings, err := backend.GetListings()
 | 
						e := echo.New()
 | 
				
			||||||
	if err != nil {
 | 
						e.Static("/assets", "frontend/assets")
 | 
				
			||||||
		fmt.Println(err)
 | 
						e.GET("/", getIndex)
 | 
				
			||||||
		return
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, l := range listings {
 | 
						// this is for me to later setup the ctl such that I can config the running program on the command line
 | 
				
			||||||
		fmt.Println(l)
 | 
						e.POST("/api/config", setConfig)
 | 
				
			||||||
	}
 | 
					
 | 
				
			||||||
 | 
						e.Logger.Fatal(e.Start(":5500"))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user