Compare commits
11 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cc90b4776 | |||
| d84ab59589 | |||
| 9bc4a73345 | |||
| 67748b058b | |||
| b716c6397e | |||
| 692f44b476 | |||
| e06386bb45 | |||
| 27fdc0a866 | |||
| 4b9c5778f6 | |||
| c02ca1d4ed | |||
| 892015e684 |
49
.drone.yml
|
|
@ -1,38 +1,27 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build-on-push
|
||||||
image: atlassian/default-image:2
|
image: plugins/docker
|
||||||
when:
|
settings:
|
||||||
branch:
|
repo: registry.connermccall.me/personal_api
|
||||||
- main
|
registry: registry.connermccall.me
|
||||||
commands:
|
tags:
|
||||||
- echo $AWS_CREDS | base64 -d > ~/.aws/credentials
|
- ${DRONE_COMMIT_SHA:0:7}
|
||||||
- aws ecr get-login-password | docker login --username AWS --password-stdin $ECR_URL
|
- latest
|
||||||
- docker build . -t $ECR_URL/home_api:latest
|
|
||||||
- docker push $ECR_URL/home_api:latest
|
|
||||||
environment:
|
|
||||||
AWS_CREDS:
|
|
||||||
from_secret: AWS_CREDS
|
|
||||||
ECR_URL:
|
|
||||||
from_secret: ECR_URL
|
|
||||||
- name: build
|
|
||||||
image: atlassian/default-image:2
|
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
|
- push
|
||||||
|
- name: build
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
auto_tag: true
|
||||||
|
repo: registry.connermccall.me/personal_api
|
||||||
|
registry: registry.connermccall.me
|
||||||
|
tags:
|
||||||
|
- ${DRONE_TAG}
|
||||||
|
when:
|
||||||
|
event:
|
||||||
- tag
|
- tag
|
||||||
commands:
|
|
||||||
- echo $AWS_CREDS | base64 -d > ~/.aws/credentials
|
|
||||||
- aws ecr get-login-password | docker login --username AWS --password-stdin $ECR_URL
|
|
||||||
- docker build . -t $ECR_URL/home_api:$DRONE_TAG
|
|
||||||
- docker build . -t $ECR_URL/home_api:latest
|
|
||||||
- docker push $ECR_URL/home_api:$DRONE_TAG
|
|
||||||
- docker build . -t $ECR_URL/home_api:latest
|
|
||||||
environment:
|
|
||||||
AWS_CREDS:
|
|
||||||
from_secret: AWS_CREDS
|
|
||||||
ECR_URL:
|
|
||||||
from_secret: ECR_URL
|
|
||||||
|
|
|
||||||
13
Dockerfile
|
|
@ -1,14 +1,15 @@
|
||||||
FROM golang:1.14
|
FROM golang:1.18
|
||||||
|
|
||||||
RUN go get -u github.com/gin-gonic/gin
|
|
||||||
|
|
||||||
WORKDIR /go/src/app
|
WORKDIR /go/src/app
|
||||||
|
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download && go mod verify
|
||||||
|
|
||||||
COPY src build-src
|
COPY src build-src
|
||||||
|
|
||||||
RUN ls .
|
RUN go build build-src/*.go
|
||||||
RUN go build build-src/main.go
|
COPY static static
|
||||||
|
|
||||||
RUN rm -rf src
|
RUN rm -rf src
|
||||||
|
|
||||||
|
EXPOSE 8080/tcp
|
||||||
ENTRYPOINT ["./main"]
|
ENTRYPOINT ["./main"]
|
||||||
|
|
|
||||||
23
go.mod
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
module connermccall.me
|
||||||
|
|
||||||
|
go 1.17
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/dvcrn/maskedemail-cli v0.0.0-20230603113757-7a0ce82189f6 // indirect
|
||||||
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||||
|
github.com/gin-gonic/gin v1.7.7 // indirect
|
||||||
|
github.com/go-playground/locales v0.13.0 // indirect
|
||||||
|
github.com/go-playground/universal-translator v0.17.0 // indirect
|
||||||
|
github.com/go-playground/validator/v10 v10.4.1 // indirect
|
||||||
|
github.com/golang/protobuf v1.3.3 // indirect
|
||||||
|
github.com/json-iterator/go v1.1.9 // indirect
|
||||||
|
github.com/leodido/go-urn v1.2.0 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.12 // indirect
|
||||||
|
github.com/mitchellh/mapstructure v1.4.3 // indirect
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
|
||||||
|
github.com/ugorji/go/codec v1.1.7 // indirect
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 // indirect
|
||||||
|
gopkg.in/yaml.v2 v2.2.8 // indirect
|
||||||
|
)
|
||||||
53
go.sum
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/dvcrn/maskedemail-cli v0.0.0-20230603113757-7a0ce82189f6 h1:ORgd6cYAg5GdPNNE95vFXyy73rx8xy1XCprpVDGN1jE=
|
||||||
|
github.com/dvcrn/maskedemail-cli v0.0.0-20230603113757-7a0ce82189f6/go.mod h1:TU8E0RslsOUiXYsICzcpPcThV56wOhuGt+5+NNXDx6k=
|
||||||
|
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||||
|
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||||
|
github.com/gin-gonic/gin v1.7.7 h1:3DoBmSbJbZAWqXJC3SLjAPfutPJJRN1U5pALB7EeTTs=
|
||||||
|
github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U=
|
||||||
|
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||||
|
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||||
|
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
|
||||||
|
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
|
||||||
|
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||||
|
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
|
||||||
|
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
|
||||||
|
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||||
|
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||||
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
|
||||||
|
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||||
|
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
|
||||||
|
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
|
||||||
|
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||||
|
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||||
|
github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs=
|
||||||
|
github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
||||||
|
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
|
||||||
|
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
|
||||||
|
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
|
||||||
|
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||||
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
|
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
|
||||||
|
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||||
|
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
55
src/main.go
|
|
@ -1,6 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -35,5 +38,57 @@ func main() {
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
router.GET("backyard_lights", func(c *gin.Context) {
|
||||||
|
var url, host, webhook string
|
||||||
|
host = os.Getenv("HA_HOST")
|
||||||
|
webhook = os.Getenv("BACKYARD_LIGHTS_HOOK")
|
||||||
|
url = host + "/api/webhook/" + webhook
|
||||||
|
log.Print(url)
|
||||||
|
postBody, _ := json.Marshal(map[string]string{
|
||||||
|
"event": "LightChange",
|
||||||
|
})
|
||||||
|
responseBody := bytes.NewBuffer(postBody)
|
||||||
|
resp, err := http.Post(url, "application/json", responseBody)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{
|
||||||
|
"message": "something went wrong",
|
||||||
|
})
|
||||||
|
log.Fatalln("Unable to toggle homeassistant webhook")
|
||||||
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
log.Print(resp)
|
||||||
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
"message": "OK",
|
||||||
|
})
|
||||||
|
})
|
||||||
|
router.Static("/maskedemail", "./static/maskedemail")
|
||||||
|
router.GET("mask", func(c *gin.Context) {
|
||||||
|
description := c.Query("description")
|
||||||
|
if description == "" {
|
||||||
|
// Return an error response if description is not provided
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"error": "Description is required"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
htmlx := c.Query("htmlx")
|
||||||
|
domain := c.Query("domain") // This will be an empty string if not provided
|
||||||
|
|
||||||
|
email, err := CreateMaskedEmail(description, domain)
|
||||||
|
if err != nil {
|
||||||
|
// Log the error and return an error response
|
||||||
|
log.Println("Error:", err)
|
||||||
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to create masked email"})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Print(email)
|
||||||
|
if htmlx != "true" {
|
||||||
|
c.String(http.StatusOK, email)
|
||||||
|
} else {
|
||||||
|
res := fmt.Sprintf("<h1>%s</h1>", email)
|
||||||
|
c.String(http.StatusOK, res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
router.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
|
router.Run() // listen and serve on 0.0.0.0:8080 (for windows "localhost:8080")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
29
src/maskedmail.go
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/dvcrn/maskedemail-cli/pkg"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func CreateMaskedEmail(alias string, domain string) (string, error) {
|
||||||
|
var fastmailAPIKey, fastmailAccountId string
|
||||||
|
fastmailAPIKey = os.Getenv("FASTMAIL_API_KEY")
|
||||||
|
fastmailAccountId = os.Getenv("FASTMAIL_ACCOUNT_ID")
|
||||||
|
// Prepare the request payload
|
||||||
|
client := pkg.NewClient(fastmailAPIKey, "personal-api", "3654417c")
|
||||||
|
session, err := client.Session()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("initializing session: %v", err)
|
||||||
|
}
|
||||||
|
createRes, err := client.CreateMaskedEmail(session, fastmailAccountId, "", alias, "", true)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("error creating masked email: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return createRes.Email, nil
|
||||||
|
}
|
||||||
BIN
static/maskedemail/icon-32x32.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
static/maskedemail/images/icons/icon-128x128.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
static/maskedemail/images/icons/icon-144x144.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
static/maskedemail/images/icons/icon-152x152.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
static/maskedemail/images/icons/icon-192x192.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
0
static/maskedemail/images/icons/icon-384x384.png
Normal file
BIN
static/maskedemail/images/icons/icon-512x512.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
static/maskedemail/images/icons/icon-72x72.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
static/maskedemail/images/icons/icon-96x96.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
142
static/maskedemail/index.html
Normal file
|
|
@ -0,0 +1,142 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<script src="lib/htmx.min.js"></script>
|
||||||
|
<title>Create Masked Email</title>
|
||||||
|
<meta name="viewport"
|
||||||
|
content="width=device-width,initial-scale=1" />
|
||||||
|
<link rel="manifest"
|
||||||
|
href="manifest.json" />
|
||||||
|
<link id="favicon"
|
||||||
|
rel="shortcut icon"
|
||||||
|
sizes="32x32"
|
||||||
|
href="icon-32x32.png">
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--color: #1a40bc;
|
||||||
|
--input-width: 70vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main {
|
||||||
|
min-height: 70vh;
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
input::-webkit-input-placeholder,
|
||||||
|
button {
|
||||||
|
font-family: 'roboto', sans-serif;
|
||||||
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
form {
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
box-shadow: 2px 2px 5px 1px rgba(0, 0, 0, 0.2);
|
||||||
|
padding-bottom: 2rem;
|
||||||
|
padding-top:2rem;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input {
|
||||||
|
margin: 40px 25px;
|
||||||
|
width: var(--input-width);
|
||||||
|
display: block;
|
||||||
|
border: none;
|
||||||
|
padding: 10px 0;
|
||||||
|
border-bottom: solid 1px var(--color);
|
||||||
|
transition: all 0.3s cubic-bezier(.64, .09, .08, 1);
|
||||||
|
background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 96%, var(--color) 4%);
|
||||||
|
background-position: -var(--input-width) 0;
|
||||||
|
background-size: var(--input-width) 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
color: darken(var(--color), 20%);
|
||||||
|
|
||||||
|
&:focus,
|
||||||
|
&:valid {
|
||||||
|
box-shadow: none;
|
||||||
|
outline: none;
|
||||||
|
background-position: 0 0;
|
||||||
|
|
||||||
|
&::-webkit-input-placeholder {
|
||||||
|
color: var(--color);
|
||||||
|
font-size: 11px;
|
||||||
|
transform: translateY(-20px);
|
||||||
|
visibility: visible !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border: none;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
background: var(--color);
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 6px;
|
||||||
|
width: var(--input-width);
|
||||||
|
color: white;
|
||||||
|
margin-left: 25px;
|
||||||
|
box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 6px 6px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.reset {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color: -var(--color);
|
||||||
|
display: block;
|
||||||
|
margin-top:.5rem;
|
||||||
|
}
|
||||||
|
.htmx-indicator{
|
||||||
|
margin: 1rem auto 0;
|
||||||
|
text-align: center;
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
.htmx-request .htmx-indicator{
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
.htmx-request.htmx-indicator{
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="main">
|
||||||
|
<form id="mask-form"
|
||||||
|
hx-get="/mask"
|
||||||
|
hx-on:htmx:load="window.getSelection().selectAllChildren(event.target);document.execCommand('copy');"
|
||||||
|
hx-swap="innerHTML">
|
||||||
|
<input type="text"
|
||||||
|
autofocus
|
||||||
|
name="description"
|
||||||
|
required
|
||||||
|
minlength="2">
|
||||||
|
<input type="text"
|
||||||
|
name="domain">
|
||||||
|
<input type="hidden"
|
||||||
|
name="htmlx"
|
||||||
|
value="true">
|
||||||
|
<button type="submit">
|
||||||
|
Generate Email
|
||||||
|
</button>
|
||||||
|
<div class="htmx-indicator">Loading...</div>
|
||||||
|
</form>
|
||||||
|
<div>
|
||||||
|
<a class="reset" href="/maskedemail">Reset</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
|
||||||
|
</html>
|
||||||
1
static/maskedemail/lib/htmx.min.js
vendored
Normal file
52
static/maskedemail/manifest.json
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"name": "Masked Email Generator",
|
||||||
|
"short_name": "masked",
|
||||||
|
"theme_color": "#1a40bc",
|
||||||
|
"background_color": "#fff",
|
||||||
|
"display": "standalone",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"scope": "/",
|
||||||
|
"start_url": "/maskedemail",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "./images/icons/icon-72x72.png",
|
||||||
|
"sizes": "72x72",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "./images/icons/icon-96x96.png",
|
||||||
|
"sizes": "96x96",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "./images/icons/icon-128x128.png",
|
||||||
|
"sizes": "128x128",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "./images/icons/icon-144x144.png",
|
||||||
|
"sizes": "144x144",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "./images/icons/icon-152x152.png",
|
||||||
|
"sizes": "152x152",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "./images/icons/icon-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "./images/icons/icon-384x384.png",
|
||||||
|
"sizes": "384x384",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "./images/icons/icon-512x512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||