Compare commits

..

No commits in common. "da9a0bca3df6ef4383e2e8686e550526094e12ff" and "8c400ac56441e6cb9ddd9b0bd5cb24931efc89b9" have entirely different histories.

6 changed files with 4 additions and 74 deletions

View file

@ -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 }}

View file

@ -3,7 +3,6 @@ package tweeter
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"html"
"log" "log"
"net/http" "net/http"
"strings" "strings"
@ -81,7 +80,7 @@ func (app App) SendToWebhook(tweets []*ts.Tweet) {
tweetText = strings.ReplaceAll(tweetText, video.URL, "") tweetText = strings.ReplaceAll(tweetText, video.URL, "")
} }
mainEmbed.SetText(html.UnescapeString(strings.TrimSpace(tweetText))) mainEmbed.SetText(strings.TrimSpace(tweetText))
for _, data := range webhooksToSend { for _, data := range webhooksToSend {
err := sendRequest(app.config.Webhook, data) err := sendRequest(app.config.Webhook, data)

View file

@ -1,19 +1,13 @@
username = "" username = ""
password = "asd123" password = "asd123"
#proxyaddr = "socks5://localhost:5555" #proxyaddr = "socks5://localhost:5555"
hostURL = "https://my.domain.tld"
#usewebserver = false
indextarget = "https://discord.gg/Kw4MFGxYEj" # Optional
hostURL = "https://my.domain.tld" # Can be omitted if not using webserver
webhook = "https://domain.tld/api/webhooks/" webhook = "https://domain.tld/api/webhooks/"
channels = [ channels = [
"NinEverything", "NinEverything",
"NintendoEurope", "NintendoEurope",
"NintendoAmerica", "NintendoAmerica",
] ]
# Binary representation for efficient filtering # Binary representation for efficient filtering
# Bit from left to right (most to least significant bit): IsSelfThread, IsRetweet, IsReply, IsPin, IsQuoted # Bit from left to right (most to least significant bit): IsSelfThread, IsRetweet, IsReply, IsPin, IsQuoted
filter = [ filter = [

View file

@ -8,8 +8,8 @@ variable "TAG" {
function "generate_tags" { function "generate_tags" {
params = [images, versions] params = [images, versions]
result = distinct(flatten( result = distinct(flatten(
[for i in split(",", replace(images, "\n", ",")) : [for i in split(",", images) :
[for v in split(",", replace(versions, "\n", ",")) : [for v in split(",", versions) :
"${i}:${v}" "${i}:${v}"
] ]
])) ]))

View file

@ -20,7 +20,6 @@ type Config struct {
WebPort uint16 WebPort uint16
UserAgents []string UserAgents []string
NitterBase string NitterBase string
IndexTarget string
} }
func ConfigFromFile(filePath string) (*Config, error) { func ConfigFromFile(filePath string) (*Config, error) {

View file

@ -72,19 +72,12 @@ func New(config *config.Config, scraper *ts.Scraper) (*WebServer, error) {
WriteTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second,
}, },
} }
sm.HandleFunc("GET /", ws.handleIndex)
sm.HandleFunc("GET /avatar/{username}", ws.handleAvatar) sm.HandleFunc("GET /avatar/{username}", ws.handleAvatar)
sm.HandleFunc("GET /tweet/{id}", ws.handleTweet) sm.HandleFunc("GET /tweet/{id}", ws.handleTweet)
sm.HandleFunc("GET /video/{id}", ws.handleVideo) sm.HandleFunc("GET /video/{id}", ws.handleVideo)
return ws, nil 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) { func (ws WebServer) handleAvatar(w http.ResponseWriter, r *http.Request) {
username := r.PathValue("username") username := r.PathValue("username")