diff --git a/.forgejo/workflows/bake.yml b/.forgejo/workflows/bake.yml deleted file mode 100644 index 60611ba..0000000 --- a/.forgejo/workflows/bake.yml +++ /dev/null @@ -1,55 +0,0 @@ -on: - push: - branches: - - 'ci-test' - tags: - - 'v*' - paths: - - '**.go' - - '**.html' - - 'Dockerfile' - - 'Dockerfile.*' - - 'docker-bake.hcl' - - '.forgejo/workflows/*.yml' - workflow_dispatch: - -jobs: - bake: - runs-on: docker - steps: - - name: Prepare Registry FQDN - id: registry - run: | - registry=${{ github.server_url }} - registry=${registry##http*://} - echo "registry=${registry}" >> "$GITHUB_OUTPUT" - - - name: Login to Container Registry - uses: https://code.forgejo.org/docker/login-action@v3 - with: - registry: ${{ steps.registry.outputs.registry }} - username: ${{ github.repository_owner }} - password: ${{ secrets.TOKEN }} - - - name: Checkout - uses: https://code.forgejo.org/actions/checkout@v4 - - - name: Set up Docker Buildx - uses: https://code.forgejo.org/docker/setup-buildx-action@v3 - - - name: Extract metadata - id: meta - uses: https://code.forgejo.org/docker/metadata-action@v5 - with: - tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - - - name: Build and push - uses: https://code.forgejo.org/docker/bake-action@v6 - with: - source: . - env: - TAG: ${{ steps.meta.outputs.tags }} diff --git a/cmd/tweeter/webhook.go b/cmd/tweeter/webhook.go index 7995371..0c69601 100644 --- a/cmd/tweeter/webhook.go +++ b/cmd/tweeter/webhook.go @@ -3,7 +3,6 @@ package tweeter import ( "bytes" "encoding/json" - "html" "log" "net/http" "strings" @@ -81,7 +80,7 @@ func (app App) SendToWebhook(tweets []*ts.Tweet) { tweetText = strings.ReplaceAll(tweetText, video.URL, "") } - mainEmbed.SetText(html.UnescapeString(strings.TrimSpace(tweetText))) + mainEmbed.SetText(strings.TrimSpace(tweetText)) for _, data := range webhooksToSend { err := sendRequest(app.config.Webhook, data) diff --git a/config.example.toml b/config.example.toml index fdcd679..36f09a9 100644 --- a/config.example.toml +++ b/config.example.toml @@ -1,19 +1,13 @@ username = "" password = "asd123" #proxyaddr = "socks5://localhost:5555" - -#usewebserver = false -indextarget = "https://discord.gg/Kw4MFGxYEj" # Optional -hostURL = "https://my.domain.tld" # Can be omitted if not using webserver - +hostURL = "https://my.domain.tld" webhook = "https://domain.tld/api/webhooks/" - channels = [ "NinEverything", "NintendoEurope", "NintendoAmerica", ] - # Binary representation for efficient filtering # Bit from left to right (most to least significant bit): IsSelfThread, IsRetweet, IsReply, IsPin, IsQuoted filter = [ diff --git a/docker-bake.hcl b/docker-bake.hcl index 0af347b..e18ac8c 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -8,8 +8,8 @@ variable "TAG" { function "generate_tags" { params = [images, versions] result = distinct(flatten( - [for i in split(",", replace(images, "\n", ",")) : - [for v in split(",", replace(versions, "\n", ",")) : + [for i in split(",", images) : + [for v in split(",", versions) : "${i}:${v}" ] ])) diff --git a/pkg/config/config.go b/pkg/config/config.go index 499badb..dd540fb 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -20,7 +20,6 @@ type Config struct { WebPort uint16 UserAgents []string NitterBase string - IndexTarget string } func ConfigFromFile(filePath string) (*Config, error) { diff --git a/pkg/web/web.go b/pkg/web/web.go index a8b5a5a..11b99f1 100644 --- a/pkg/web/web.go +++ b/pkg/web/web.go @@ -72,19 +72,12 @@ func New(config *config.Config, scraper *ts.Scraper) (*WebServer, error) { WriteTimeout: 30 * time.Second, }, } - sm.HandleFunc("GET /", ws.handleIndex) sm.HandleFunc("GET /avatar/{username}", ws.handleAvatar) sm.HandleFunc("GET /tweet/{id}", ws.handleTweet) sm.HandleFunc("GET /video/{id}", ws.handleVideo) return ws, nil } -func (ws WebServer) handleIndex(w http.ResponseWriter, r *http.Request) { - if ws.config.IndexTarget != "" { - http.Redirect(w, r, ws.config.IndexTarget, http.StatusPermanentRedirect) - } -} - func (ws WebServer) handleAvatar(w http.ResponseWriter, r *http.Request) { username := r.PathValue("username")