Compare commits
No commits in common. "1892da9682abe72b19d78bf1a4088911f6b43e77" and "3f359d0c57e99db10ad60120442a459f20497d9a" have entirely different histories.
1892da9682
...
3f359d0c57
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"cSpell.words": [
|
|
||||||
"diyhrt",
|
|
||||||
"transfem"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package diyhrt
|
package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -1,4 +1,4 @@
|
|||||||
package diyhrt
|
package backend
|
||||||
|
|
||||||
type ActiveIngredient struct {
|
type ActiveIngredient struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
@ -3,25 +3,28 @@
|
|||||||
<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>{{ .PageTitle }}</title>
|
<title>NewTab</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="{{ .SearchFormAction }}">
|
<form class="search-grid" action="https://duckduckgo.com/">
|
||||||
<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"></h2>
|
<h2 class="phrases">GirlJuice.Inject()</h2>
|
||||||
<img als="girl_juice" src="assets/girl_juice.png" />
|
<img als="girl_juice" src="assets/girl_juice.png" />
|
||||||
</div>
|
</div>
|
||||||
<input name="{{ .SearchInputName }}" type="text" class="grid-item" class="search" placeholder="{{ .SearchPlaceholder }}" />
|
<input name="q" type="text" class="grid-item" class="search" placeholder="Search DuckDuckGo :3 :3 :3" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const phrases = [
|
const phrases = [
|
||||||
{{range $Phrase := .HeaderPhrases }}
|
"GirlJuice.Inject()",
|
||||||
"{{ $Phrase }}",
|
"Child.CrowdKill()",
|
||||||
{{- end }}
|
"CopCar.Burn()",
|
||||||
|
"You.Cute = true",
|
||||||
|
"You.Gay = true",
|
||||||
|
"Nazi.Punch()",
|
||||||
]
|
]
|
||||||
|
|
||||||
Array.from(document.querySelectorAll(".phrases")).forEach(element => {
|
Array.from(document.querySelectorAll(".phrases")).forEach(element => {
|
||||||
@ -30,24 +33,18 @@
|
|||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
const marqueeElement = document.body;
|
const marqueeElement = document.body;
|
||||||
let xPosition = 0;
|
let position = 0;
|
||||||
let yPosition = 0;
|
const speed = 1; // Adjust speed here (lower is slower)
|
||||||
const xSpeed = {{ .BackgroundScrollX }}; // Adjust speed here (lower is slower)
|
|
||||||
const ySpeed = {{ .BackgroundScrollY }};
|
|
||||||
|
|
||||||
function animateMarquee() {
|
function animateMarquee() {
|
||||||
xPosition -= xSpeed;
|
position -= speed;
|
||||||
yPosition -= ySpeed;
|
|
||||||
|
|
||||||
// Reset position when the image has scrolled completely
|
// Reset position when the image has scrolled completely
|
||||||
if (Math.abs(xPosition) >= marqueeElement.offsetWidth) {
|
if (Math.abs(position) >= marqueeElement.offsetWidth) {
|
||||||
xPosition = 0;
|
position = 0;
|
||||||
}
|
|
||||||
if (Math.abs(yPosition) >= marqueeElement.offsetHeight) {
|
|
||||||
yPosition = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
marqueeElement.style.backgroundPosition = `${xPosition}px ${yPosition}px`;
|
marqueeElement.style.backgroundPosition = `${position}px 0`;
|
||||||
requestAnimationFrame(animateMarquee);
|
requestAnimationFrame(animateMarquee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
go.mod
13
go.mod
@ -1,16 +1,3 @@
|
|||||||
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
21
go.sum
@ -1,21 +0,0 @@
|
|||||||
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,42 +0,0 @@
|
|||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
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()))
|
|
40
main.go
40
main.go
@ -1,41 +1,21 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"gitea.elara.ws/Hazel/transfem-startpage/internal/rendering"
|
"gitea.elara.ws/Hazel/transfem-startpage/backend"
|
||||||
"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")
|
||||||
|
|
||||||
e := echo.New()
|
listings, err := backend.GetListings()
|
||||||
e.Static("/assets", "frontend/assets")
|
if err != nil {
|
||||||
e.GET("/", getIndex)
|
fmt.Println(err)
|
||||||
|
return
|
||||||
// this is for me to later setup the ctl such that I can config the running program on the command line
|
}
|
||||||
e.POST("/api/config", setConfig)
|
|
||||||
|
for _, l := range listings {
|
||||||
e.Logger.Fatal(e.Start(":5500"))
|
fmt.Println(l)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user