├── .gitignore ├── LICENSE ├── README.md ├── assets ├── edit.png ├── home.png ├── manage.png └── rss.png ├── back ├── Dockerfile ├── api │ ├── add.go │ ├── auto.go │ ├── auto │ │ ├── gemini.go │ │ ├── html.go │ │ └── result.go │ ├── delete.go │ ├── edit.go │ ├── load.go │ └── rss.go ├── database │ ├── data.go │ ├── history.go │ └── xpath.go ├── go.mod ├── go.sum ├── main.go └── proxy │ └── proxy.go ├── db └── dummy.txt ├── docker-compose.yml ├── front ├── Makefile ├── bun.lock ├── components.json ├── dist │ ├── favicon.ico │ ├── iframe.css │ ├── index.html │ ├── index_1bea.ba14ab80.js │ ├── index_4333.5bb370d3.js │ ├── index_736c.9001fb4f.js │ ├── index_736c.9001fb4f.js.map │ ├── index_81c6.eefa9b4b.js │ ├── index_85da.34040542.css │ ├── index_85da.34040542.css.map │ ├── index_9696.1983f979.js │ ├── index_9bd9.3f55ca3f.js │ ├── index_a050.6d290edc.js │ ├── index_a5c5.156a6282.js │ ├── index_aab1.54e399c3.js │ └── index_b8b9.fde05894.js ├── farm.config.ts ├── index.html ├── package.json ├── postcss.config.js ├── public │ ├── favicon.ico │ └── iframe.css ├── src │ ├── class │ │ ├── data.tsx │ │ └── xpath.tsx │ ├── components │ │ ├── app-sidebar.tsx │ │ ├── hooks │ │ │ ├── use-mobile.tsx │ │ │ └── use-toast.ts │ │ ├── lib │ │ │ └── utils.ts │ │ └── ui │ │ │ ├── alert-dialog.tsx │ │ │ ├── button.tsx │ │ │ ├── dialog.tsx │ │ │ ├── dropdown-menu.tsx │ │ │ ├── input.tsx │ │ │ ├── label.tsx │ │ │ ├── mydialog.tsx │ │ │ ├── separator.tsx │ │ │ ├── sheet.tsx │ │ │ ├── sidebar.tsx │ │ │ ├── skeleton.tsx │ │ │ ├── sonner.tsx │ │ │ ├── table.tsx │ │ │ ├── toast.tsx │ │ │ ├── toaster.tsx │ │ │ └── tooltip.tsx │ ├── hooks │ │ ├── use-mobile.tsx │ │ └── use-toast.ts │ ├── index.css │ ├── index.tsx │ ├── layout.tsx │ ├── lib │ │ └── utils.ts │ ├── pages │ │ ├── edit │ │ │ └── index.tsx │ │ ├── home │ │ │ └── index.tsx │ │ └── manage │ │ │ ├── columns.tsx │ │ │ ├── data-table.tsx │ │ │ └── index.tsx │ └── typings.d.ts ├── tailwind.config.js ├── tsconfig.json └── tsconfig.node.json └── nginx.conf /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 projects-shelf 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # shelf | RSS_Generator 2 | 3 | ### A lightweight RSS feed generator with an intuitive UI 4 | 5 | ## Quickstart 6 | 7 | ```shell 8 | git clone https://github.com/projects-shelf/RSS_Generator.git 9 | cd RSS_Generator 10 | docker-compose up -d 11 | ``` 12 | 13 | ## Features 14 | 15 | ### RSS Feed Generation 16 | 17 | Generate RSS feeds from websites that do not natively provide them. 18 | 19 | ![rss](./assets/rss.png) 20 | 21 | ### Easy-to-use 22 | 23 | A user-friendly interface that makes the process straightforward and accessible. 24 | 25 | ![edit](./assets/edit.png) 26 | 27 | ![manage](./assets/manage.png) 28 | 29 | ### AI-Powered 30 | 31 | Utilizes the Gemini API to automatically extract the required XPath for generating RSS feeds. 32 | 33 | ### Lightweight 34 | 35 | Built with Go and SQLite, it consumes minimal system resources. 36 | 37 | ``` 38 | CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 39 | e3b23edaef2c shelf_rssgen_nginx 0.00% 2.23MiB / 3.88GiB 0.06% 8.41MB / 8.44MB 15.4MB / 475kB 2 40 | b89a68bf41b6 shelf_rssgen_go 0.04% 10.49MiB / 3.88GiB 0.26% 2.16MB / 6.7MB 41.8MB / 0B 11 41 | c0044a5a6190 politepol 1.55% 148.4MiB / 3.88GiB 3.74% 98.5MB / 64.7MB 8.79GB / 26.4MB 16 42 | f7e416a540c8 dbpolitepol 0.13% 174.6MiB / 3.88GiB 4.39% 15.8MB / 28.6MB 7.22GB / 303kB 29 43 | ``` 44 | 45 | ## Note 46 | 47 | - To use the automatic extraction feature powered by AI, a Gemini API KEY is required. 48 | - HTTPS connection is required to copy links to the clipboard. 49 | 50 | ## License 51 | 52 | RSS_Generatot is licensed under [MIT License](https://github.com/projects-shelf/RSS_Generator/blob/main/LICENSE). 53 | 54 | ## Author 55 | 56 | Developed by [PepperCat](https://github.com/PepperCat-YamanekoVillage). 57 | -------------------------------------------------------------------------------- /assets/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projects-shelf/RSS_Generator/ecd5c72439173e429727a9275912af249e224d8b/assets/edit.png -------------------------------------------------------------------------------- /assets/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projects-shelf/RSS_Generator/ecd5c72439173e429727a9275912af249e224d8b/assets/home.png -------------------------------------------------------------------------------- /assets/manage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projects-shelf/RSS_Generator/ecd5c72439173e429727a9275912af249e224d8b/assets/manage.png -------------------------------------------------------------------------------- /assets/rss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projects-shelf/RSS_Generator/ecd5c72439173e429727a9275912af249e224d8b/assets/rss.png -------------------------------------------------------------------------------- /back/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.24.3-alpine 2 | 3 | WORKDIR /back 4 | COPY . . 5 | 6 | RUN apk add --no-cache git \ 7 | && go mod tidy \ 8 | && go build -o main . 9 | 10 | CMD ["./main"] -------------------------------------------------------------------------------- /back/api/add.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "back/database" 5 | "database/sql" 6 | "net/http" 7 | nurl "net/url" 8 | 9 | "github.com/gin-gonic/gin" 10 | "github.com/google/uuid" 11 | ) 12 | 13 | func AddHandler(dataDB *sql.DB, xpathDB *sql.DB) gin.HandlerFunc { 14 | return func(c *gin.Context) { 15 | url := c.Query("url") 16 | titleXPath := c.Query("titleX") 17 | descriptionXPath := c.Query("descriptionX") 18 | dateXPath := c.Query("dateX") 19 | thumbnailXPath := c.Query("thumbnailX") 20 | if url == "" { 21 | c.JSON(http.StatusBadRequest, gin.H{"error": "missing url"}) 22 | return 23 | } 24 | decodedUrl, err := nurl.QueryUnescape(url) 25 | if err != nil { 26 | c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid URL"}) 27 | return 28 | } 29 | 30 | id := uuid.New().String() 31 | 32 | // data 33 | data := database.Data{ 34 | ID: id, 35 | STATUS: 0, 36 | URL: decodedUrl, 37 | } 38 | 39 | err = database.WriteData(dataDB, data) 40 | 41 | if err != nil { 42 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to insert data"}) 43 | return 44 | } 45 | 46 | // xpath 47 | 48 | xpath := database.Xpath{ 49 | ID: id, 50 | Title: titleXPath, 51 | Description: descriptionXPath, 52 | Date: dateXPath, 53 | Thumbnail: thumbnailXPath, 54 | } 55 | 56 | err = database.UpdateXPath(xpathDB, xpath) 57 | 58 | if err != nil { 59 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to insert xpath"}) 60 | return 61 | } 62 | 63 | c.JSON(http.StatusOK, data) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /back/api/auto.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "back/api/auto" 5 | "net/http" 6 | "os" 7 | 8 | "github.com/gin-gonic/gin" 9 | ) 10 | 11 | func AutoHandler() gin.HandlerFunc { 12 | return func(c *gin.Context) { 13 | url := c.Query("url") 14 | if url == "" { 15 | c.JSON(http.StatusBadRequest, gin.H{"error": "missing url"}) 16 | return 17 | } 18 | 19 | // Gemini 20 | key := os.Getenv("Gemini") 21 | if key != "" { 22 | result, err := auto.Gemini(key, url) 23 | if err != nil { 24 | c.JSON(http.StatusInternalServerError, gin.H{"error": err}) 25 | return 26 | } 27 | c.JSON(http.StatusOK, result) 28 | } 29 | 30 | c.Status(http.StatusOK) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /back/api/auto/gemini.go: -------------------------------------------------------------------------------- 1 | package auto 2 | 3 | import ( 4 | "context" 5 | "encoding/json" 6 | "net/http" 7 | 8 | "golang.org/x/net/html" 9 | "google.golang.org/genai" 10 | ) 11 | 12 | func Gemini(key string, url string) (Result, error) { 13 | ctx := context.Background() 14 | 15 | client, _ := genai.NewClient(ctx, &genai.ClientConfig{ 16 | APIKey: key, 17 | Backend: genai.BackendGeminiAPI, 18 | }) 19 | 20 | config := &genai.GenerateContentConfig{ 21 | ResponseMIMEType: "application/json", 22 | ResponseSchema: &genai.Schema{ 23 | Type: genai.TypeObject, 24 | Properties: map[string]*genai.Schema{ 25 | "title": { 26 | Type: genai.TypeString, 27 | }, 28 | "description": { 29 | Type: genai.TypeString, 30 | }, 31 | "date": { 32 | Type: genai.TypeString, 33 | }, 34 | "thumbnail": { 35 | Type: genai.TypeString, 36 | }, 37 | }, 38 | Required: []string{"title", "description", "date", "thumbnail"}, 39 | }, 40 | } 41 | 42 | resp, err := http.Get(url) 43 | if err != nil { 44 | return Result{}, err 45 | } 46 | defer resp.Body.Close() 47 | 48 | doc, err := html.Parse(resp.Body) 49 | if err != nil { 50 | return Result{}, err 51 | } 52 | 53 | html := shapeupDoc(doc) 54 | 55 | result, err := client.Models.GenerateContent( 56 | ctx, 57 | "gemini-2.0-flash", 58 | genai.Text( 59 | "Generate the shortest XPath expressions for the elements that represent the articles' Title, Description, Date, and Thumbnail\n"+ 60 | "Do not include attribute access like `/@src`,`/text()` in the XPath\n"+ 61 | "---\n"+ 62 | "HTML is\n"+ 63 | html+ 64 | "---\n"+ 65 | "Using this JSON schema", 66 | ), 67 | config, 68 | ) 69 | if err != nil { 70 | return Result{}, err 71 | } 72 | 73 | text := result.Text() 74 | var r Result 75 | err = json.Unmarshal([]byte(text), &r) 76 | if err != nil { 77 | return Result{}, err 78 | } 79 | 80 | return r, nil 81 | } 82 | -------------------------------------------------------------------------------- /back/api/auto/html.go: -------------------------------------------------------------------------------- 1 | package auto 2 | 3 | import ( 4 | "strings" 5 | 6 | "golang.org/x/net/html" 7 | ) 8 | 9 | func removeScript(n *html.Node) { 10 | for c := n.FirstChild; c != nil; { 11 | next := c.NextSibling 12 | if c.Type == html.ElementNode && c.Data == "script" { 13 | n.RemoveChild(c) 14 | } else { 15 | removeScript(c) 16 | } 17 | c = next 18 | } 19 | } 20 | 21 | func removeComments(n *html.Node) { 22 | for c := n.FirstChild; c != nil; { 23 | next := c.NextSibling 24 | if c.Type == html.CommentNode { 25 | n.RemoveChild(c) 26 | } else { 27 | removeComments(c) 28 | } 29 | c = next 30 | } 31 | } 32 | 33 | func removeHead(n *html.Node) { 34 | for c := n.FirstChild; c != nil; { 35 | next := c.NextSibling 36 | if c.Type == html.ElementNode && c.Data == "head" { 37 | n.RemoveChild(c) 38 | } else { 39 | removeHead(c) 40 | } 41 | c = next 42 | } 43 | } 44 | 45 | func removeOtherAttributes(n *html.Node) { 46 | if n.Type == html.ElementNode { 47 | for i := len(n.Attr) - 1; i >= 0; i-- { 48 | attr := n.Attr[i] 49 | if !(attr.Key == "class" || attr.Key == "id" || attr.Key == "src" || attr.Key == "href") { 50 | n.Attr = append(n.Attr[:i], n.Attr[i+1:]...) 51 | } 52 | } 53 | } 54 | 55 | for c := n.FirstChild; c != nil; c = c.NextSibling { 56 | removeOtherAttributes(c) 57 | } 58 | } 59 | 60 | func renderNode(n *html.Node) string { 61 | var b strings.Builder 62 | if err := html.Render(&b, n); err != nil { 63 | return "" 64 | } 65 | return b.String() 66 | } 67 | 68 | func shapeupDoc(doc *html.Node) string { 69 | removeScript(doc) 70 | removeComments(doc) 71 | removeHead(doc) 72 | removeOtherAttributes(doc) 73 | 74 | return renderNode(doc) 75 | } 76 | -------------------------------------------------------------------------------- /back/api/auto/result.go: -------------------------------------------------------------------------------- 1 | package auto 2 | 3 | type Result struct { 4 | Title string `json:"title"` 5 | Description string `json:"description"` 6 | Date string `json:"date"` 7 | Thumbnail string `json:"thumbnail"` 8 | } 9 | -------------------------------------------------------------------------------- /back/api/delete.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "back/database" 5 | "database/sql" 6 | "net/http" 7 | 8 | "github.com/gin-gonic/gin" 9 | ) 10 | 11 | func DeleteHandler(dataDB *sql.DB, xpathDB *sql.DB) gin.HandlerFunc { 12 | return func(c *gin.Context) { 13 | id := c.Query("id") 14 | if id == "" { 15 | c.JSON(http.StatusBadRequest, gin.H{"error": "missing id"}) 16 | return 17 | } 18 | 19 | // データベースから削除 20 | err := database.DeleteData(dataDB, id) 21 | if err != nil { 22 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete from data"}) 23 | return 24 | } 25 | 26 | err = database.DeleteXpath(xpathDB, id) 27 | if err != nil { 28 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to delete from xpath"}) 29 | return 30 | } 31 | 32 | c.Status(http.StatusOK) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /back/api/edit.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "back/database" 5 | "database/sql" 6 | "net/http" 7 | 8 | "github.com/gin-gonic/gin" 9 | ) 10 | 11 | func EditHandler(dataDB *sql.DB, xpathDB *sql.DB) gin.HandlerFunc { 12 | return func(c *gin.Context) { 13 | id := c.Query("id") 14 | titleXPath := c.Query("titleX") 15 | descriptionXPath := c.Query("descriptionX") 16 | dateXPath := c.Query("dateX") 17 | thumbnailXPath := c.Query("thumbnailX") 18 | if id == "" { 19 | c.JSON(http.StatusBadRequest, gin.H{"error": "missing id"}) 20 | return 21 | } 22 | 23 | // data 24 | 25 | database.UpdateDataStatus(dataDB, id, 0) 26 | 27 | // xpath 28 | 29 | xpath := database.Xpath{ 30 | ID: id, 31 | Title: titleXPath, 32 | Description: descriptionXPath, 33 | Date: dateXPath, 34 | Thumbnail: thumbnailXPath, 35 | } 36 | 37 | err := database.UpdateXPath(xpathDB, xpath) 38 | 39 | if err != nil { 40 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to insert xpath"}) 41 | return 42 | } 43 | 44 | c.JSON(http.StatusOK, "") 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /back/api/load.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "back/database" 5 | "database/sql" 6 | "net/http" 7 | 8 | "github.com/gin-gonic/gin" 9 | ) 10 | 11 | func LoadDataListHandler(db *sql.DB) gin.HandlerFunc { 12 | return func(c *gin.Context) { 13 | dataList, err := database.ReadAllData(db) 14 | if err != nil { 15 | c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to retrieve data"}) 16 | return 17 | } 18 | c.JSON(http.StatusOK, dataList) 19 | } 20 | } 21 | 22 | func LoadXPathHandler(db *sql.DB) gin.HandlerFunc { 23 | return func(c *gin.Context) { 24 | id := c.Query("id") 25 | if id == "" { 26 | c.JSON(http.StatusBadRequest, gin.H{"error": "missing id"}) 27 | return 28 | } 29 | 30 | xpath, err := database.ReadXpath(db, id) 31 | if err != nil { 32 | c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to retrieve data"}) 33 | return 34 | } 35 | c.JSON(http.StatusOK, xpath) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /back/api/rss.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "back/database" 5 | "database/sql" 6 | "encoding/xml" 7 | "errors" 8 | "fmt" 9 | "net/http" 10 | "net/url" 11 | "strings" 12 | "time" 13 | 14 | "github.com/antchfx/htmlquery" 15 | "github.com/gin-gonic/gin" 16 | "golang.org/x/net/html" 17 | ) 18 | 19 | type RSS struct { 20 | XMLName xml.Name `xml:"rss"` 21 | Version string `xml:"version,attr"` 22 | Media string `xml:"xmlns:media,attr"` 23 | Channel RSSChannel `xml:"channel"` 24 | } 25 | 26 | type RSSChannel struct { 27 | Title string `xml:"title"` 28 | Description string `xml:"description"` 29 | Link string `xml:"link"` 30 | PubDate string `xml:"pubDate"` 31 | Item []RSSItem `xml:"item"` 32 | } 33 | 34 | type RSSItem struct { 35 | Title string `xml:"title"` 36 | Link string `xml:"link"` 37 | GUID string `xml:"guid"` 38 | Description string `xml:"description,omitempty"` 39 | PubDate string `xml:"pubDate,omitempty"` 40 | 41 | Thumbnail *MediaThumbnail `xml:"media:thumbnail,omitempty"` 42 | } 43 | 44 | type MediaThumbnail struct { 45 | URL string `xml:"url,attr"` 46 | } 47 | 48 | func RSSHandler(dataDB *sql.DB, xpathDB *sql.DB) gin.HandlerFunc { 49 | return func(c *gin.Context) { 50 | id := c.Query("id") 51 | isView := c.Query("isView") 52 | if id == "" { 53 | c.JSON(http.StatusBadRequest, gin.H{"error": "missing id"}) 54 | return 55 | } 56 | 57 | data, err := database.ReadData(dataDB, id) 58 | if err != nil { 59 | database.UpdateDataStatus(dataDB, id, 2) 60 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to read data"}) 61 | return 62 | } 63 | 64 | xpath, err := database.ReadXpath(xpathDB, id) 65 | if err != nil { 66 | database.UpdateDataStatus(dataDB, id, 2) 67 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to read xpath"}) 68 | return 69 | } 70 | 71 | rss, err := generateRSS(data.URL, id, xpath) 72 | if err != nil { 73 | database.UpdateDataStatus(dataDB, id, 2) 74 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to generate rss"}) 75 | return 76 | } 77 | 78 | if isView == "1" { 79 | c.Header("Content-Type", "text/xml") 80 | } else { 81 | c.Header("Content-Type", "application/rss+xml") 82 | } 83 | xmlData, err := xml.MarshalIndent(rss, "", " ") 84 | if err != nil { 85 | database.UpdateDataStatus(dataDB, id, 2) 86 | c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to marshal RSS"}) 87 | return 88 | } 89 | 90 | database.UpdateDataStatus(dataDB, id, 1) 91 | c.String(http.StatusOK, xml.Header+string(xmlData)) 92 | } 93 | } 94 | 95 | func generateRSS(url string, id string, xpath database.Xpath) (RSS, error) { 96 | doc, err := downloadHtml(url) 97 | if err != nil { 98 | return RSS{}, err 99 | } 100 | 101 | var items []RSSItem 102 | titleNodes, err := htmlquery.QueryAll(doc, xpath.Title) 103 | if err != nil { 104 | return RSS{}, err 105 | } 106 | descriptionNodes, errDes := htmlquery.QueryAll(doc, xpath.Description) 107 | dateNodes, errDat := htmlquery.QueryAll(doc, xpath.Date) 108 | thumbnailNodes, errTha := htmlquery.QueryAll(doc, xpath.Thumbnail) 109 | 110 | historyDB := database.OpenHistoryDB(id) 111 | defer historyDB.Close() 112 | 113 | for i, titleNode := range titleNodes { 114 | item := RSSItem{ 115 | Title: htmlquery.InnerText(titleNode), 116 | } 117 | 118 | aNode := htmlquery.FindOne(titleNode, "ancestor-or-self::a[1]") 119 | if aNode == nil { 120 | aNode = htmlquery.FindOne(titleNode, ".//a[1]") 121 | if aNode == nil { 122 | return RSS{}, errors.New("No link found") 123 | } 124 | } 125 | item.Link = restoreFullURL(url, htmlquery.SelectAttr(aNode, "href")) 126 | item.GUID = item.Link 127 | 128 | if errDes == nil && i < len(descriptionNodes) { 129 | item.Description = htmlquery.InnerText(descriptionNodes[i]) 130 | } 131 | 132 | if errDat == nil && i < len(dateNodes) { 133 | date, err := ParseAnyDateToRFC1123Z(htmlquery.InnerText(dateNodes[i])) 134 | if err == nil { 135 | item.PubDate = date 136 | } else { 137 | timestamp, err := database.ReadHistory(historyDB, item.GUID) 138 | if err == nil { 139 | item.PubDate = timestamp 140 | } 141 | } 142 | } else { 143 | timestamp, err := database.ReadHistory(historyDB, item.GUID) 144 | if err == nil { 145 | item.PubDate = timestamp 146 | } 147 | } 148 | 149 | if errTha == nil && i < len(thumbnailNodes) { 150 | item.Thumbnail = &MediaThumbnail{ 151 | URL: restoreFullURL(url, htmlquery.SelectAttr(thumbnailNodes[i], "src")), 152 | } 153 | } 154 | 155 | items = append(items, item) 156 | } 157 | 158 | node := htmlquery.FindOne(doc, "//title") 159 | title := "" 160 | if node != nil { 161 | title = htmlquery.InnerText(node) 162 | } 163 | 164 | return RSS{ 165 | Version: "2.0", 166 | Media: "http://search.yahoo.com/mrss/", 167 | Channel: RSSChannel{ 168 | Title: title, 169 | Description: "Generated by shelf|RSS_Generator", 170 | Link: url, 171 | PubDate: time.Now().Format(time.RFC1123Z), 172 | Item: items, 173 | }, 174 | }, nil 175 | } 176 | 177 | func downloadHtml(url string) (*html.Node, error) { 178 | doc, err := htmlquery.LoadURL(url) 179 | if err != nil { 180 | return nil, err 181 | } 182 | return doc, nil 183 | } 184 | 185 | func extractElementFromHTML(doc *html.Node, xpath string) (string, error) { 186 | node, err := htmlquery.Query(doc, xpath) 187 | if err != nil { 188 | return "", err 189 | } 190 | 191 | if node != nil { 192 | return htmlquery.InnerText(node), nil 193 | } 194 | return "", err 195 | } 196 | 197 | func restoreFullURL(page_url, link_url string) string { 198 | parsedPageURL, err := url.Parse(page_url) 199 | if err != nil { 200 | return "" 201 | } 202 | 203 | if !strings.HasPrefix(link_url, "http://") && !strings.HasPrefix(link_url, "https://") { 204 | parsedLinkURL, err := parsedPageURL.Parse(link_url) 205 | if err != nil { 206 | return "" 207 | } 208 | return parsedLinkURL.String() 209 | } 210 | 211 | return link_url 212 | } 213 | 214 | func ParseAnyDateToRFC1123Z(dateStr string) (string, error) { 215 | layouts := []string{ 216 | time.RFC1123Z, 217 | time.RFC3339, 218 | "2006-1-2", 219 | "2006-1-02", 220 | "2006-01-2", 221 | "2006-01-02", 222 | "2006/1/2", 223 | "2006/1/02", 224 | "2006/01/2", 225 | "2006/01/02", 226 | "2006-01-02 15:04:05", 227 | "2006/01/02 15:04:05", 228 | } 229 | 230 | for _, layout := range layouts { 231 | if t, err := time.Parse(layout, dateStr); err == nil { 232 | return t.Format(time.RFC1123Z), nil 233 | } 234 | } 235 | 236 | return "", fmt.Errorf("unsupported date format: %s", dateStr) 237 | } 238 | -------------------------------------------------------------------------------- /back/database/data.go: -------------------------------------------------------------------------------- 1 | package database 2 | 3 | import ( 4 | "database/sql" 5 | 6 | _ "modernc.org/sqlite" 7 | ) 8 | 9 | type Data struct { 10 | ID string `json:"id"` 11 | STATUS int `json:"status"` 12 | URL string `json:"url"` 13 | } 14 | 15 | func OpenDataDB() *sql.DB { 16 | db, err := sql.Open("sqlite", "/db/data.db") 17 | if err != nil { 18 | panic(err) 19 | } 20 | 21 | _, err = db.Exec(` 22 | CREATE TABLE IF NOT EXISTS data ( 23 | id TEXT PRIMARY KEY, 24 | status INTEGER, 25 | url TEXT 26 | ); 27 | `) 28 | if err != nil { 29 | panic(err) 30 | } 31 | 32 | return db 33 | } 34 | 35 | func WriteData(db *sql.DB, data Data) error { 36 | _, err := db.Exec("INSERT INTO data (id, status, url) VALUES (?, ?, ?)", 37 | data.ID, data.STATUS, data.URL) 38 | return err 39 | } 40 | 41 | func DeleteData(db *sql.DB, id string) error { 42 | _, err := db.Exec("DELETE FROM data WHERE id = ?", id) 43 | return err 44 | } 45 | 46 | func UpdateDataStatus(db *sql.DB, id string, status int) error { 47 | _, err := db.Exec("UPDATE data SET status = ? WHERE id = ?", status, id) 48 | return err 49 | } 50 | 51 | func ReadAllData(db *sql.DB) ([]Data, error) { 52 | rows, err := db.Query("SELECT id, status, url FROM data") 53 | if err != nil { 54 | return nil, err 55 | } 56 | defer rows.Close() 57 | 58 | var dataList []Data 59 | for rows.Next() { 60 | var d Data 61 | if err := rows.Scan(&d.ID, &d.STATUS, &d.URL); err != nil { 62 | return nil, err 63 | } 64 | dataList = append(dataList, d) 65 | } 66 | 67 | if err := rows.Err(); err != nil { 68 | return nil, err 69 | } 70 | 71 | return dataList, nil 72 | } 73 | 74 | func ReadData(db *sql.DB, id string) (Data, error) { 75 | var d Data 76 | err := db.QueryRow("SELECT id, status, url FROM data WHERE id = ?", id). 77 | Scan(&d.ID, &d.STATUS, &d.URL) 78 | return d, err 79 | } 80 | -------------------------------------------------------------------------------- /back/database/history.go: -------------------------------------------------------------------------------- 1 | package database 2 | 3 | import ( 4 | "database/sql" 5 | "time" 6 | 7 | _ "modernc.org/sqlite" 8 | ) 9 | 10 | type History struct { 11 | GUID string `json:"guid"` // GUID 12 | Timestamp string `json:"timestamp"` // RFC1123Z形式 13 | } 14 | 15 | func OpenHistoryDB(id string) *sql.DB { 16 | db, err := sql.Open("sqlite", "/db/history/"+id+".db") 17 | if err != nil { 18 | panic(err) 19 | } 20 | 21 | _, err = db.Exec(` 22 | CREATE TABLE IF NOT EXISTS history ( 23 | guid TEXT PRIMARY KEY, 24 | timestamp TEXT 25 | ); 26 | `) 27 | if err != nil { 28 | panic(err) 29 | } 30 | 31 | return db 32 | } 33 | 34 | func AddHistory(db *sql.DB, guid string) (string, error) { 35 | timestamp := time.Now().Format(time.RFC1123Z) 36 | _, err := db.Exec("INSERT INTO history (guid, timestamp) VALUES (?, ?)", guid, timestamp) 37 | return timestamp, err 38 | } 39 | 40 | func ReadHistory(db *sql.DB, guid string) (string, error) { 41 | var h History 42 | err := db.QueryRow("SELECT guid, timestamp FROM history WHERE guid = ?", guid). 43 | Scan(&h.GUID, &h.Timestamp) 44 | if err != nil { 45 | return AddHistory(db, guid) 46 | } 47 | return h.Timestamp, nil 48 | } 49 | -------------------------------------------------------------------------------- /back/database/xpath.go: -------------------------------------------------------------------------------- 1 | package database 2 | 3 | import ( 4 | "database/sql" 5 | ) 6 | 7 | type Xpath struct { 8 | ID string `json:"id"` 9 | Title string `json:"title"` 10 | Description string `json:"description"` 11 | Date string `json:"date"` 12 | Thumbnail string `json:"thumbnail"` 13 | } 14 | 15 | func OpenXPathDB() *sql.DB { 16 | db, err := sql.Open("sqlite", "/db/xpath.db") 17 | if err != nil { 18 | panic(err) 19 | } 20 | 21 | _, err = db.Exec(` 22 | CREATE TABLE IF NOT EXISTS xpath ( 23 | id TEXT PRIMARY KEY, 24 | title TEXT, 25 | description TEXT, 26 | date TEXT, 27 | thumbnail TEXT 28 | ); 29 | `) 30 | if err != nil { 31 | panic(err) 32 | } 33 | 34 | return db 35 | } 36 | 37 | func UpdateXPath(db *sql.DB, x Xpath) error { 38 | _, err := db.Exec(` 39 | INSERT INTO xpath (id, title, description, date, thumbnail) 40 | VALUES (?, ?, ?, ?, ?) 41 | ON CONFLICT(id) DO UPDATE SET 42 | title = excluded.title, 43 | description = excluded.description, 44 | date = excluded.date, 45 | thumbnail = excluded.thumbnail; 46 | `, x.ID, x.Title, x.Description, x.Date, x.Thumbnail) 47 | return err 48 | } 49 | 50 | func ReadXpath(db *sql.DB, id string) (Xpath, error) { 51 | var x Xpath 52 | row := db.QueryRow(` 53 | SELECT id, title, description, date, thumbnail 54 | FROM xpath WHERE id = ? 55 | `, id) 56 | err := row.Scan(&x.ID, &x.Title, &x.Description, &x.Date, &x.Thumbnail) 57 | return x, err 58 | } 59 | 60 | func DeleteXpath(db *sql.DB, id string) error { 61 | _, err := db.Exec(`DELETE FROM xpath WHERE id = ?`, id) 62 | return err 63 | } 64 | -------------------------------------------------------------------------------- /back/go.mod: -------------------------------------------------------------------------------- 1 | module back 2 | 3 | go 1.24.2 4 | 5 | require ( 6 | github.com/antchfx/htmlquery v1.3.4 7 | github.com/gin-gonic/gin v1.10.0 8 | github.com/google/uuid v1.6.0 9 | golang.org/x/net v0.38.0 10 | google.golang.org/genai v1.3.0 11 | modernc.org/sqlite v1.37.0 12 | ) 13 | 14 | require ( 15 | cloud.google.com/go v0.116.0 // indirect 16 | cloud.google.com/go/auth v0.9.3 // indirect 17 | cloud.google.com/go/compute/metadata v0.5.0 // indirect 18 | github.com/antchfx/xpath v1.3.4 // indirect 19 | github.com/bytedance/sonic v1.13.2 // indirect 20 | github.com/bytedance/sonic/loader v0.2.4 // indirect 21 | github.com/cloudwego/base64x v0.1.5 // indirect 22 | github.com/dustin/go-humanize v1.0.1 // indirect 23 | github.com/gabriel-vasile/mimetype v1.4.8 // indirect 24 | github.com/gin-contrib/sse v1.0.0 // indirect 25 | github.com/go-playground/locales v0.14.1 // indirect 26 | github.com/go-playground/universal-translator v0.18.1 // indirect 27 | github.com/go-playground/validator/v10 v10.26.0 // indirect 28 | github.com/goccy/go-json v0.10.5 // indirect 29 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect 30 | github.com/google/go-cmp v0.6.0 // indirect 31 | github.com/google/s2a-go v0.1.8 // indirect 32 | github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect 33 | github.com/gorilla/websocket v1.5.3 // indirect 34 | github.com/json-iterator/go v1.1.12 // indirect 35 | github.com/klauspost/cpuid/v2 v2.2.10 // indirect 36 | github.com/kr/pretty v0.3.0 // indirect 37 | github.com/leodido/go-urn v1.4.0 // indirect 38 | github.com/mattn/go-isatty v0.0.20 // indirect 39 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 40 | github.com/modern-go/reflect2 v1.0.2 // indirect 41 | github.com/ncruces/go-strftime v0.1.9 // indirect 42 | github.com/pelletier/go-toml/v2 v2.2.3 // indirect 43 | github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect 44 | github.com/rogpeppe/go-internal v1.8.0 // indirect 45 | github.com/twitchyliquid64/golang-asm v0.15.1 // indirect 46 | github.com/ugorji/go/codec v1.2.12 // indirect 47 | go.opencensus.io v0.24.0 // indirect 48 | golang.org/x/arch v0.15.0 // indirect 49 | golang.org/x/crypto v0.36.0 // indirect 50 | golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect 51 | golang.org/x/sys v0.31.0 // indirect 52 | golang.org/x/text v0.23.0 // indirect 53 | google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect 54 | google.golang.org/grpc v1.66.2 // indirect 55 | google.golang.org/protobuf v1.36.6 // indirect 56 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect 57 | gopkg.in/yaml.v3 v3.0.1 // indirect 58 | modernc.org/libc v1.62.1 // indirect 59 | modernc.org/mathutil v1.7.1 // indirect 60 | modernc.org/memory v1.9.1 // indirect 61 | ) 62 | -------------------------------------------------------------------------------- /back/go.sum: -------------------------------------------------------------------------------- 1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= 2 | cloud.google.com/go v0.116.0 h1:B3fRrSDkLRt5qSHWe40ERJvhvnQwdZiHu0bJOpldweE= 3 | cloud.google.com/go v0.116.0/go.mod h1:cEPSRWPzZEswwdr9BxE6ChEn01dWlTaF05LiC2Xs70U= 4 | cloud.google.com/go/auth v0.9.3 h1:VOEUIAADkkLtyfr3BLa3R8Ed/j6w1jTBmARx+wb5w5U= 5 | cloud.google.com/go/auth v0.9.3/go.mod h1:7z6VY+7h3KUdRov5F1i8NDP5ZzWKYmEPO842BgCsmTk= 6 | cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY= 7 | cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY= 8 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 9 | github.com/antchfx/htmlquery v1.3.4 h1:Isd0srPkni2iNTWCwVj/72t7uCphFeor5Q8nCzj1jdQ= 10 | github.com/antchfx/htmlquery v1.3.4/go.mod h1:K9os0BwIEmLAvTqaNSua8tXLWRWZpocZIH73OzWQbwM= 11 | github.com/antchfx/xpath v1.3.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= 12 | github.com/antchfx/xpath v1.3.4 h1:1ixrW1VnXd4HurCj7qnqnR0jo14g8JMe20Fshg1Vgz4= 13 | github.com/antchfx/xpath v1.3.4/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= 14 | github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ= 15 | github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4= 16 | github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= 17 | github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY= 18 | github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= 19 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 20 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= 21 | github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= 22 | github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= 23 | github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= 24 | github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= 25 | github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 26 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 27 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 28 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 29 | github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= 30 | github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= 31 | github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 32 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= 33 | github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= 34 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= 35 | github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= 36 | github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= 37 | github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E= 38 | github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0= 39 | github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= 40 | github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= 41 | github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= 42 | github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= 43 | github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= 44 | github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= 45 | github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= 46 | github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= 47 | github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k= 48 | github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= 49 | github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= 50 | github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= 51 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= 52 | github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 53 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= 54 | github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= 55 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= 56 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 57 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 58 | github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= 59 | github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= 60 | github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= 61 | github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= 62 | github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= 63 | github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 64 | github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= 65 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= 66 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 67 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= 68 | github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 69 | github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 70 | github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 71 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 72 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 73 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 74 | github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs= 75 | github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= 76 | github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= 77 | github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= 78 | github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 79 | github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= 80 | github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 81 | github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= 82 | github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= 83 | github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= 84 | github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 85 | github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= 86 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= 87 | github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= 88 | github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= 89 | github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= 90 | github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= 91 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= 92 | github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= 93 | github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= 94 | github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= 95 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= 96 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= 97 | github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= 98 | github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= 99 | github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= 100 | github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= 101 | github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= 102 | github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= 103 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 104 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= 105 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 106 | github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 107 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= 108 | github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= 109 | github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= 110 | github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= 111 | github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= 112 | github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= 113 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 114 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 115 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= 116 | github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= 117 | github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= 118 | github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= 119 | github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= 120 | github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= 121 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 122 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 123 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 124 | github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= 125 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 126 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 127 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 128 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 129 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 130 | github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= 131 | github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= 132 | github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= 133 | github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= 134 | github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= 135 | github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= 136 | github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= 137 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 138 | go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= 139 | go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= 140 | golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw= 141 | golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= 142 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 143 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 144 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 145 | golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= 146 | golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= 147 | golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= 148 | golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= 149 | golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= 150 | golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= 151 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= 152 | golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= 153 | golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= 154 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= 155 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= 156 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 157 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 158 | golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 159 | golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= 160 | golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 161 | golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= 162 | golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= 163 | golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= 164 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 165 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 166 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 167 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 168 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= 169 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 170 | golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= 171 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 172 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 173 | golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= 174 | golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 175 | golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= 176 | golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= 177 | golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= 178 | golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= 179 | golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= 180 | golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= 181 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= 182 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 183 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 184 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 185 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 186 | golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 187 | golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= 188 | golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 189 | golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 190 | golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= 191 | golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= 192 | golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= 193 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 194 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 195 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 196 | golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 197 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 198 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 199 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 200 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 201 | golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 202 | golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 203 | golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 204 | golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 205 | golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 206 | golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 207 | golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 208 | golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= 209 | golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= 210 | golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= 211 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 212 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 213 | golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= 214 | golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= 215 | golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= 216 | golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= 217 | golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= 218 | golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= 219 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 220 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 221 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 222 | golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= 223 | golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= 224 | golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= 225 | golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 226 | golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 227 | golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= 228 | golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= 229 | golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= 230 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 231 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 232 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= 233 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= 234 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 235 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 236 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 237 | golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= 238 | golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= 239 | golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= 240 | golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= 241 | golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= 242 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 243 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 244 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 245 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= 246 | google.golang.org/genai v1.3.0 h1:tXhPJF30skOjnnDY7ZnjK3q7IKy4PuAlEA0fk7uEaEI= 247 | google.golang.org/genai v1.3.0/go.mod h1:TyfOKRz/QyCaj6f/ZDt505x+YreXnY40l2I6k8TvgqY= 248 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= 249 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= 250 | google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= 251 | google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= 252 | google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= 253 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= 254 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= 255 | google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= 256 | google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= 257 | google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= 258 | google.golang.org/grpc v1.66.2 h1:3QdXkuq3Bkh7w+ywLdLvM56cmGvQHUMZpiCzt6Rqaoo= 259 | google.golang.org/grpc v1.66.2/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= 260 | google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= 261 | google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= 262 | google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= 263 | google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= 264 | google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= 265 | google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 266 | google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 267 | google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= 268 | google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= 269 | google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= 270 | google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= 271 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 272 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 273 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= 274 | gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= 275 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= 276 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 277 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 278 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 279 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 280 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= 281 | modernc.org/cc/v4 v4.25.2 h1:T2oH7sZdGvTaie0BRNFbIYsabzCxUQg8nLqCdQ2i0ic= 282 | modernc.org/cc/v4 v4.25.2/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= 283 | modernc.org/ccgo/v4 v4.25.1 h1:TFSzPrAGmDsdnhT9X2UrcPMI3N/mJ9/X9ykKXwLhDsU= 284 | modernc.org/ccgo/v4 v4.25.1/go.mod h1:njjuAYiPflywOOrm3B7kCB444ONP5pAVr8PIEoE0uDw= 285 | modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= 286 | modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= 287 | modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= 288 | modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= 289 | modernc.org/libc v1.62.1 h1:s0+fv5E3FymN8eJVmnk0llBe6rOxCu/DEU+XygRbS8s= 290 | modernc.org/libc v1.62.1/go.mod h1:iXhATfJQLjG3NWy56a6WVU73lWOcdYVxsvwCgoPljuo= 291 | modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= 292 | modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= 293 | modernc.org/memory v1.9.1 h1:V/Z1solwAVmMW1yttq3nDdZPJqV1rM05Ccq6KMSZ34g= 294 | modernc.org/memory v1.9.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= 295 | modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8= 296 | modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= 297 | modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= 298 | modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE= 299 | modernc.org/sqlite v1.37.0 h1:s1TMe7T3Q3ovQiK2Ouz4Jwh7dw4ZDqbebSDTlSJdfjI= 300 | modernc.org/sqlite v1.37.0/go.mod h1:5YiWv+YviqGMuGw4V+PNplcyaJ5v+vQd7TQOgkACoJM= 301 | modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= 302 | modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= 303 | modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= 304 | modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= 305 | nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= 306 | -------------------------------------------------------------------------------- /back/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "back/api" 5 | "back/database" 6 | "back/proxy" 7 | "os" 8 | "runtime" 9 | 10 | "github.com/gin-gonic/gin" 11 | ) 12 | 13 | func main() { 14 | if err := os.MkdirAll("/db/history", 0755); err != nil { 15 | panic(err) 16 | } 17 | 18 | gin.SetMode(gin.ReleaseMode) 19 | r := gin.Default() 20 | 21 | dataDB := database.OpenDataDB() 22 | defer dataDB.Close() 23 | xpathDB := database.OpenXPathDB() 24 | defer xpathDB.Close() 25 | 26 | // proxy 27 | r.GET("/proxy_init/:scheme/:domain/*path", withGC(proxy.ProxyInitHandler)) 28 | r.GET("/proxy/*path", withGC(proxy.ProxyHandler)) 29 | 30 | // api 31 | r.GET("/api/add", withGC(api.AddHandler(dataDB, xpathDB))) 32 | r.GET("/api/edit", withGC(api.EditHandler(dataDB, xpathDB))) 33 | r.GET("/api/delete", withGC(api.DeleteHandler(dataDB, xpathDB))) 34 | 35 | r.GET("/api/load/data", withGC(api.LoadDataListHandler(dataDB))) 36 | r.GET("/api/load/xpath", withGC(api.LoadXPathHandler(xpathDB))) 37 | 38 | r.GET("/api/auto", withGC(api.AutoHandler())) 39 | r.GET("/api/rss", withGC(api.RSSHandler(dataDB, xpathDB))) 40 | 41 | r.Run(":8080") 42 | } 43 | 44 | func withGC(handler gin.HandlerFunc) gin.HandlerFunc { 45 | return func(c *gin.Context) { 46 | handler(c) 47 | runtime.GC() 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /back/proxy/proxy.go: -------------------------------------------------------------------------------- 1 | package proxy 2 | 3 | import ( 4 | "fmt" 5 | "io" 6 | "log" 7 | "net/http" 8 | "time" 9 | 10 | "github.com/gin-gonic/gin" 11 | ) 12 | 13 | var lastdomain = "" 14 | 15 | func ProxyInitHandler(c *gin.Context) { 16 | scheme := c.Param("scheme") 17 | domain := c.Param("domain") 18 | path := c.Param("path") 19 | 20 | targetURL := scheme + "://" + domain + path 21 | lastdomain = scheme + "://" + domain 22 | proxyURL := "http://nginx:80/proxy/?url=" + targetURL 23 | fmt.Println("ProxyInit: " + proxyURL) 24 | 25 | client := &http.Client{ 26 | Timeout: 10 * time.Second, 27 | Transport: &http.Transport{ 28 | DisableKeepAlives: true, 29 | }, 30 | } 31 | resp, err := client.Get(proxyURL) 32 | if err != nil { 33 | log.Println("Error fetching target URL:", err) 34 | c.JSON(http.StatusBadGateway, gin.H{"error": "Failed to fetch target URL"}) 35 | return 36 | } 37 | defer resp.Body.Close() 38 | 39 | for key, value := range resp.Header { 40 | for _, v := range value { 41 | c.Header(key, v) 42 | } 43 | } 44 | 45 | c.Status(resp.StatusCode) 46 | 47 | buf := make([]byte, 32*1024) // 32KB 48 | _, err = io.CopyBuffer(c.Writer, resp.Body, buf) 49 | if err != nil { 50 | log.Println("Error copying response body:", err) 51 | } 52 | } 53 | 54 | func ProxyHandler(c *gin.Context) { 55 | path := c.Param("path") 56 | 57 | if path == "/edit" || path == "/manage" { 58 | client := &http.Client{ 59 | Timeout: 10 * time.Second, 60 | Transport: &http.Transport{ 61 | DisableKeepAlives: true, 62 | }, 63 | } 64 | resp, err := client.Get("http://nginx:80/return_index/") 65 | if err != nil { 66 | log.Println("Error fetching target URL:", err) 67 | c.JSON(http.StatusBadGateway, gin.H{"error": "Failed to fetch target URL"}) 68 | return 69 | } 70 | defer resp.Body.Close() 71 | 72 | for key, value := range resp.Header { 73 | for _, v := range value { 74 | c.Header(key, v) 75 | } 76 | } 77 | 78 | c.Status(resp.StatusCode) 79 | 80 | buf := make([]byte, 32*1024) // 32KB 81 | _, err = io.CopyBuffer(c.Writer, resp.Body, buf) 82 | if err != nil { 83 | log.Println("Error copying response body:", err) 84 | } 85 | 86 | return 87 | } 88 | 89 | targetURL := lastdomain + path 90 | proxyURL := "http://nginx:80/proxy/?url=" + targetURL 91 | 92 | fmt.Println("Proxy: " + proxyURL) 93 | 94 | client := &http.Client{ 95 | Timeout: 10 * time.Second, 96 | Transport: &http.Transport{ 97 | DisableKeepAlives: true, 98 | }, 99 | } 100 | resp, err := client.Get(proxyURL) 101 | if err != nil { 102 | log.Println("Error fetching target URL:", err) 103 | c.JSON(http.StatusBadGateway, gin.H{"error": "Failed to fetch target URL"}) 104 | return 105 | } 106 | defer resp.Body.Close() 107 | 108 | for key, value := range resp.Header { 109 | for _, v := range value { 110 | c.Header(key, v) 111 | } 112 | } 113 | 114 | c.Status(resp.StatusCode) 115 | 116 | buf := make([]byte, 32*1024) // 32KB 117 | _, err = io.CopyBuffer(c.Writer, resp.Body, buf) 118 | if err != nil { 119 | log.Println("Error copying response body:", err) 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /db/dummy.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projects-shelf/RSS_Generator/ecd5c72439173e429727a9275912af249e224d8b/db/dummy.txt -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | 3 | services: 4 | nginx: 5 | image: nginx:alpine 6 | container_name: shelf_rssgen_nginx 7 | networks: 8 | - shelf-rssgen-network 9 | ports: 10 | - "50048:80" 11 | volumes: 12 | - ./nginx.conf:/etc/nginx/nginx.conf 13 | - ./front/dist:/front 14 | depends_on: 15 | - go 16 | restart: unless-stopped 17 | 18 | go: 19 | build: 20 | context: ./back 21 | container_name: shelf_rssgen_go 22 | networks: 23 | - shelf-rssgen-network 24 | volumes: 25 | - ./db:/db 26 | environment: 27 | - TZ=UTC 28 | - Gemini=APIKEY 29 | restart: unless-stopped 30 | 31 | networks: 32 | shelf-rssgen-network: 33 | driver: bridge -------------------------------------------------------------------------------- /front/Makefile: -------------------------------------------------------------------------------- 1 | setup: 2 | bun install 3 | 4 | dev: 5 | bun farm dev 6 | 7 | build: 8 | bun farm build -------------------------------------------------------------------------------- /front/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": false, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.js", 8 | "css": "src/index.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /front/dist/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projects-shelf/RSS_Generator/ecd5c72439173e429727a9275912af249e224d8b/front/dist/favicon.ico -------------------------------------------------------------------------------- /front/dist/iframe.css: -------------------------------------------------------------------------------- 1 | .xpath-highlight-red { 2 | outline: 2px solid rgba(255, 0, 0, 0.7); 3 | background-color: rgba(255, 0, 0, 0.5); 4 | } 5 | 6 | .xpath-highlight-blue { 7 | outline: 2px solid rgba(0, 0, 255, 0.7); 8 | background-color: rgba(0, 0, 255, 0.5); 9 | } 10 | 11 | .xpath-highlight-green { 12 | outline: 2px solid rgba(0, 255, 0, 0.7); 13 | background-color: rgba(0, 255, 0, 0.5); 14 | } 15 | 16 | .xpath-highlight-yellow { 17 | outline: 2.5px solid rgba(255, 255, 0, 0.7); 18 | background-color: rgba(255, 255, 0, 0.4); 19 | } -------------------------------------------------------------------------------- /front/dist/index_9696.1983f979.js: -------------------------------------------------------------------------------- 1 | (function(_){var filename = ((function(){var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;return typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.src || new URL("index_9696.js", document.baseURI).href})());for(var r in _){_[r].__farm_resource_pot__=filename;window['2567a5ec9705eb7ac2c984033e06189d'].__farm_module_system__.register(r,_[r])}})({"02757c19":/** 2 | * @license lucide-react v0.503.0 - ISC 3 | * 4 | * This source code is licensed under the ISC license. 5 | * See the LICENSE file in the root directory of this source tree. 6 | */function d(d,t,a,e){d._m(t),d.o(t,"default",()=>k);var f=d.i(a("358dc4d0"));let k=d.f(f)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);},"0c3d2612":/** 7 | * @license lucide-react v0.503.0 - ISC 8 | * 9 | * This source code is licensed under the ISC license. 10 | * See the LICENSE file in the root directory of this source tree. 11 | */function c(c,e,i,l){c._m(e),c.o(e,"default",()=>y);var r=c.i(i("358dc4d0"));let y=c.f(r)("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);},"0cc6e6c3":/** 12 | * @license lucide-react v0.503.0 - ISC 13 | * 14 | * This source code is licensed under the ISC license. 15 | * See the LICENSE file in the root directory of this source tree. 16 | */function c(c,e,l,i){c._m(e),c.o(e,"default",()=>a);var r=c.i(l("358dc4d0"));let a=c.f(r)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);},"0f15ea7c":/** 17 | * @license lucide-react v0.503.0 - ISC 18 | * 19 | * This source code is licensed under the ISC license. 20 | * See the LICENSE file in the root directory of this source tree. 21 | */function c(c,e,t,y){c._m(e),c.o(e,"default",()=>h);var d=c.i(t("358dc4d0"));let h=c.f(d)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);},"2d21c08d":/** 22 | * @license lucide-react v0.503.0 - ISC 23 | * 24 | * This source code is licensed under the ISC license. 25 | * See the LICENSE file in the root directory of this source tree. 26 | */function e(e,t,r,a){e._m(t),e.o(t,"hasA11yProp",()=>n),e.o(t,"mergeClasses",()=>l),e.o(t,"toKebabCase",()=>o),e.o(t,"toPascalCase",()=>i);let o=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),i=e=>{let t=s(e);return t.charAt(0).toUpperCase()+t.slice(1);},l=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim(),n=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;};},"358dc4d0":/** 27 | * @license lucide-react v0.503.0 - ISC 28 | * 29 | * This source code is licensed under the ISC license. 30 | * See the LICENSE file in the root directory of this source tree. 31 | */function e(e,a,c,l){e._m(a),e.o(a,"default",()=>f);var s=c("a0fc9dfd"),d=c("2d21c08d"),t=e.i(c("acec4dc3"));let f=(a,c)=>{let l=s.forwardRef(({className:l,...f},r)=>s.createElement(e.f(t),{ref:r,iconNode:c,className:d.mergeClasses(`lucide-${d.toKebabCase(d.toPascalCase(a))}`,`lucide-${a}`,l),...f}));return l.displayName=d.toPascalCase(a),l;};},"38ed7121":/** 32 | * @license lucide-react v0.503.0 - ISC 33 | * 34 | * This source code is licensed under the ISC license. 35 | * See the LICENSE file in the root directory of this source tree. 36 | */function a(a,d,t,e){a._m(d),a.o(d,"default",()=>h);var l=a.i(t("358dc4d0"));let h=a.f(l)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);},"51d03fb9":/** 37 | * @license lucide-react v0.503.0 - ISC 38 | * 39 | * This source code is licensed under the ISC license. 40 | * See the LICENSE file in the root directory of this source tree. 41 | */function a(a,t,e,d){a._m(t),a.o(t,"default",()=>l);var h=a.i(e("358dc4d0"));let l=a.f(h)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);},"51fd72a9":/** 42 | * @license lucide-react v0.503.0 - ISC 43 | * 44 | * This source code is licensed under the ISC license. 45 | * See the LICENSE file in the root directory of this source tree. 46 | */function d(d,a,e,t){d._m(a),d.o(a,"default",()=>h);var f=d.i(e("358dc4d0"));let h=d.f(f)("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);},"6170980f":/** 47 | * @license lucide-react v0.503.0 - ISC 48 | * 49 | * This source code is licensed under the ISC license. 50 | * See the LICENSE file in the root directory of this source tree. 51 | */function o(o,t,e,n){o._m(t),o.o(t,"default",()=>r);var r={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};},"7d552b60":/** 52 | * @license lucide-react v0.503.0 - ISC 53 | * 54 | * This source code is licensed under the ISC license. 55 | * See the LICENSE file in the root directory of this source tree. 56 | */function t(t,e,a,f){t._m(e),t.o(e,"default",()=>d);var h=t.i(a("358dc4d0"));let d=t.f(h)("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);},"88550a32":/** 57 | * @license lucide-react v0.503.0 - ISC 58 | * 59 | * This source code is licensed under the ISC license. 60 | * See the LICENSE file in the root directory of this source tree. 61 | */function c(c,d,e,f){c._m(d),c.o(d,"default",()=>a);var t=c.i(e("358dc4d0"));let a=c.f(t)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);},"acec4dc3":/** 62 | * @license lucide-react v0.503.0 - ISC 63 | * 64 | * This source code is licensed under the ISC license. 65 | * See the LICENSE file in the root directory of this source tree. 66 | */function e(e,r,a,t){e._m(r),e.o(r,"default",()=>c);var d=a("a0fc9dfd"),s=e.i(a("6170980f")),i=a("2d21c08d");let c=d.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:c,className:f="",children:l,iconNode:m,...o},u)=>d.createElement("svg",{ref:u,...e.f(s),width:a,height:a,stroke:r,strokeWidth:c?24*Number(t)/Number(a):t,className:i.mergeClasses("lucide",f),...!l&&!i.hasA11yProp(o)&&{"aria-hidden":"true"},...o},[...m.map(([e,r])=>d.createElement(e,r)),...Array.isArray(l)?l:[l]]));},"bb140a95":/** 67 | * @license lucide-react v0.503.0 - ISC 68 | * 69 | * This source code is licensed under the ISC license. 70 | * See the LICENSE file in the root directory of this source tree. 71 | */function e(e,a,d,l){e._m(a);var u=e.i(d("0c3d2612"));e._(a,"Ellipsis",u,"default"),e._(a,"EllipsisIcon",u,"default"),e._(a,"LucideEllipsis",u,"default"),e._(a,"LucideMoreHorizontal",u,"default"),e._(a,"MoreHorizontal",u,"default"),e._(a,"MoreHorizontalIcon",u,"default");var t=e.i(d("38ed7121"));e._(a,"Home",t,"default"),e._(a,"HomeIcon",t,"default"),e._(a,"House",t,"default"),e._(a,"HouseIcon",t,"default"),e._(a,"LucideHome",t,"default"),e._(a,"LucideHouse",t,"default");var f=e.i(d("7d552b60"));e._(a,"LucidePanelLeft",f,"default"),e._(a,"LucideSidebar",f,"default"),e._(a,"PanelLeft",f,"default"),e._(a,"PanelLeftIcon",f,"default"),e._(a,"Sidebar",f,"default"),e._(a,"SidebarIcon",f,"default");var i=e.i(d("51fd72a9"));e._(a,"ArrowUpDown",i,"default"),e._(a,"ArrowUpDownIcon",i,"default"),e._(a,"LucideArrowUpDown",i,"default");var o=e.i(d("88550a32"));e._(a,"Check",o,"default"),e._(a,"CheckIcon",o,"default"),e._(a,"LucideCheck",o,"default");var c=e.i(d("c175c5e5"));e._(a,"ChevronRight",c,"default"),e._(a,"ChevronRightIcon",c,"default"),e._(a,"LucideChevronRight",c,"default");var _=e.i(d("0cc6e6c3"));e._(a,"Circle",_,"default"),e._(a,"CircleIcon",_,"default"),e._(a,"LucideCircle",_,"default");var r=e.i(d("0f15ea7c"));e._(a,"Copy",r,"default"),e._(a,"CopyIcon",r,"default"),e._(a,"LucideCopy",r,"default");var n=e.i(d("51d03fb9"));e._(a,"ExternalLink",n,"default"),e._(a,"ExternalLinkIcon",n,"default"),e._(a,"LucideExternalLink",n,"default");var L=e.i(d("e84baa7d"));e._(a,"Folder",L,"default"),e._(a,"FolderIcon",L,"default"),e._(a,"LucideFolder",L,"default");var v=e.i(d("02757c19"));e._(a,"LucideX",v,"default"),e._(a,"X",v,"default"),e._(a,"XIcon",v,"default");},"c175c5e5":/** 72 | * @license lucide-react v0.503.0 - ISC 73 | * 74 | * This source code is licensed under the ISC license. 75 | * See the LICENSE file in the root directory of this source tree. 76 | */function t(t,h,d,e){t._m(h),t.o(h,"default",()=>c);var a=t.i(d("358dc4d0"));let c=t.f(a)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);},"e84baa7d":/** 77 | * @license lucide-react v0.503.0 - ISC 78 | * 79 | * This source code is licensed under the ISC license. 80 | * See the LICENSE file in the root directory of this source tree. 81 | */function a(a,d,t,e){a._m(d),a.o(d,"default",()=>l);var f=a.i(t("358dc4d0"));let l=a.f(f)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);},}); -------------------------------------------------------------------------------- /front/dist/index_a050.6d290edc.js: -------------------------------------------------------------------------------- 1 | (function(_){var filename = ((function(){var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;return typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.src || new URL("index_a050.js", document.baseURI).href})());for(var r in _){_[r].__farm_resource_pot__=filename;window['2567a5ec9705eb7ac2c984033e06189d'].__farm_module_system__.register(r,_[r])}})({"e6963ceb":/** 2 | * @remix-run/router v1.9.0 3 | * 4 | * Copyright (c) Remix Software Inc. 5 | * 6 | * This source code is licensed under the MIT license found in the 7 | * LICENSE.md file in the root directory of this source tree. 8 | * 9 | * @license MIT 10 | */function e(e,t,n,a){var r,i,o,l;function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;tr),e.o(t,"UNSAFE_getPathContributingMatches",()=>$),e.o(t,"UNSAFE_invariant",()=>u),e.o(t,"UNSAFE_warning",()=>p),e.o(t,"createBrowserHistory",()=>c),e.o(t,"createPath",()=>g),e.o(t,"isRouteErrorResponse",()=>L),e.o(t,"joinPaths",()=>E),e.o(t,"matchRoutes",()=>v),e.o(t,"parsePath",()=>m),e.o(t,"resolveTo",()=>x),e.o(t,"stripBasename",()=>w),(o=r||(r={})).Pop="POP",o.Push="PUSH",o.Replace="REPLACE";let h="popstate";function c(e){return void 0===e&&(e={}),function(e,t,n,a){void 0===a&&(a={});let{window:i=document.defaultView,v5Compat:o=!1}=a,l=i.history,c=r.Pop,p=null,m=v();function v(){return(l.state||{idx:null}).idx;}function y(){c=r.Pop;let e=v(),t=null==e?null:e-m;m=e,p&&p({action:c,location:w.location,delta:t});}function b(e){let t="null"!==i.location.origin?i.location.origin:i.location.href,n="string"==typeof e?e:g(e);return u(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t);}null==m&&(m=0,l.replaceState(s({},l.state,{idx:m}),""));let w={get action(){return c;},get location(){return e(i,l);},listen(e){if(p)throw Error("A history only accepts one active listener");return i.addEventListener(h,y),p=e,()=>{i.removeEventListener(h,y),p=null;};},createHref:e=>t(i,e),createURL:b,encodeLocation(e){let t=b(e);return{pathname:t.pathname,search:t.search,hash:t.hash};},push:function(e,t){c=r.Push;let n=f(w.location,e,t),a=d(n,m=v()+1),s=w.createHref(n);try{l.pushState(a,"",s);}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;i.location.assign(s);}o&&p&&p({action:c,location:w.location,delta:1});},replace:function(e,t){c=r.Replace;let n=f(w.location,e,t),a=d(n,m=v()),i=w.createHref(n);l.replaceState(a,"",i),o&&p&&p({action:c,location:w.location,delta:0});},go:e=>l.go(e)};return w;}(function(e,t){let{pathname:n,search:a,hash:r}=e.location;return f("",{pathname:n,search:a,hash:r},t.state&&t.state.usr||null,t.state&&t.state.key||"default");},function(e,t){return"string"==typeof t?t:g(t);},null,e);}function u(e,t){if(!1===e||null==e)throw Error(t);}function p(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw Error(t);}catch(e){}}}function d(e,t){return{usr:e.state,key:e.key,idx:t};}function f(e,t,n,a){return void 0===n&&(n=null),s({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?m(t):t,{state:n,key:t&&t.key||a||Math.random().toString(36).substr(2,8)});}function g(e){let{pathname:t="/",search:n="",hash:a=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t;}function m(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e);}return t;}function v(e,t,n){void 0===n&&(n="/");let a=w(("string"==typeof t?m(t):t).pathname||"/",n);if(null==a)return null;let r=function e(t,n,a,r){void 0===n&&(n=[]),void 0===a&&(a=[]),void 0===r&&(r="");let i=(t,i,o)=>{let l={relativePath:void 0===o?t.path||"":o,caseSensitive:!0===t.caseSensitive,childrenIndex:i,route:t};l.relativePath.startsWith("/")&&(u(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),l.relativePath=l.relativePath.slice(r.length));let s=E([r,l.relativePath]),h=a.concat(l);if(t.children&&t.children.length>0&&(u(!0!==t.index,'Index routes must not have child routes. Please remove all child routes from route path "'+s+'".'),e(t.children,n,h,s)),null!=t.path||t.index){var c;let e,a;n.push({path:s,score:(c=t.index,a=(e=s.split("/")).length,e.some(b)&&(a+=-2),c&&(a+=2),e.filter(e=>!b(e)).reduce((e,t)=>e+(y.test(t)?3:""===t?1:10),a)),routesMeta:h});}};return t.forEach((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let n of function e(t){let n=t.split("/");if(0===n.length)return[];let[a,...r]=n,i=a.endsWith("?"),o=a.replace(/\?$/,"");if(0===r.length)return i?[o,""]:[o];let l=e(r.join("/")),s=[];return s.push(...l.map(e=>""===e?o:[o,e].join("/"))),i&&s.push(...l),s.map(e=>t.startsWith("/")&&""===e?"/":e);}(e.path))i(e,t,n);else i(e,t);}),n;}(e);!function(e){e.sort((e,t)=>{var n,a;return e.score!==t.score?t.score-e.score:(n=e.routesMeta.map(e=>e.childrenIndex),a=t.routesMeta.map(e=>e.childrenIndex),n.length===a.length&&n.slice(0,-1).every((e,t)=>e===a[t])?n[n.length-1]-a[a.length-1]:0);});}(r);let i=null;for(let e=0;null==i&&e(a.push(t),"/([^\\/]+)"));return e.endsWith("*")?(a.push("*"),r+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":""!==e&&"/"!==e&&(r+="(?:(?=\\/|$))"),[new RegExp(r,t?void 0:"i"),a];}(e.path,e.caseSensitive,e.end),r=t.match(n);if(!r)return null;let i=r[0],o=i.replace(/(.)\/+$/,"$1"),l=r.slice(1);return{params:a.reduce((e,t,n)=>{if("*"===t){let e=l[n]||"";o=i.slice(0,i.length-e.length).replace(/(.)\/+$/,"$1");}return e[t]=function(e,t){try{return decodeURIComponent(e);}catch(n){return p(!1,'The value for the URL param "'+t+'" will not be decoded because the string "'+e+'" is a malformed URL segment. This is probably due to a bad percent encoding ('+n+")."),e;}}(l[n]||"",t),e;},{}),pathname:i,pathnameBase:o,pattern:e};}({path:o.relativePath,caseSensitive:o.caseSensitive,end:l},s);if(!h)return null;Object.assign(a,h.params);let c=o.route;i.push({params:a,pathname:E([r,h.pathname]),pathnameBase:R(E([r,h.pathnameBase])),route:c}),"/"!==h.pathnameBase&&(r=E([r,h.pathnameBase]));}return i;}(r[e],function(e){try{return decodeURI(e);}catch(t){return p(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e;}}(a));return i;}(l=i||(i={})).data="data",l.deferred="deferred",l.redirect="redirect",l.error="error";let y=/^:\w+$/,b=e=>"*"===e;function w(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&"/"!==a?null:e.slice(n)||"/";}function P(e,t,n,a){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t)+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in and the router will parse it for you.';}function $(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0);}function x(e,t,n,a){let r,i;void 0===a&&(a=!1),"string"==typeof e?r=m(e):(u(!(r=s({},e)).pathname||!r.pathname.includes("?"),P("?","pathname","search",r)),u(!r.pathname||!r.pathname.includes("#"),P("#","pathname","hash",r)),u(!r.search||!r.search.includes("#"),P("#","search","hash",r)));let o=""===e||""===r.pathname,l=o?"/":r.pathname;if(a||null==l)i=n;else{let e=t.length-1;if(l.startsWith("..")){let t=l.split("/");for(;".."===t[0];)t.shift(),e-=1;r.pathname=t.join("/");}i=e>=0?t[e]:"/";}let h=function(e,t){let n;void 0===t&&(t="/");let{pathname:a,search:r="",hash:i=""}="string"==typeof e?m(e):e;return{pathname:a?a.startsWith("/")?a:(n=t.replace(/\/+$/,"").split("/"),a.split("/").forEach(e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e);}),n.length>1?n.join("/"):"/"):t,search:S(r),hash:W(i)};}(r,i),c=l&&"/"!==l&&l.endsWith("/"),p=(o||"."===l)&&n.endsWith("/");return!h.pathname.endsWith("/")&&(c||p)&&(h.pathname+="/"),h;}let E=e=>e.join("/").replace(/\/\/+/g,"/"),R=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),S=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",W=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";function L(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e;}Symbol("deferred");},}); -------------------------------------------------------------------------------- /front/farm.config.ts: -------------------------------------------------------------------------------- 1 | import path from "node:path"; 2 | import { defineConfig } from "@farmfe/core"; 3 | import postcss from "@farmfe/js-plugin-postcss"; 4 | 5 | export default defineConfig({ 6 | plugins: [ 7 | [ 8 | "@farmfe/plugin-react", 9 | { 10 | runtime: "automatic", 11 | }, 12 | ], 13 | postcss(), 14 | ], 15 | compilation: { 16 | resolve: { 17 | alias: { 18 | "@": path.resolve(__dirname, "./src"), 19 | }, 20 | }, 21 | }, 22 | }); 23 | -------------------------------------------------------------------------------- /front/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | shelf | RSS_Generator 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /front/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web", 3 | "version": "1.0.0", 4 | "scripts": { 5 | "dev": "farm start", 6 | "start": "farm start", 7 | "build": "farm build", 8 | "preview": "farm preview", 9 | "clean": "farm clean" 10 | }, 11 | "dependencies": { 12 | "@radix-ui/react-alert-dialog": "^1.1.11", 13 | "@radix-ui/react-dialog": "^1.1.11", 14 | "@radix-ui/react-dropdown-menu": "^2.1.12", 15 | "@radix-ui/react-label": "^2.1.4", 16 | "@radix-ui/react-separator": "^1.1.4", 17 | "@radix-ui/react-slot": "^1.2.0", 18 | "@radix-ui/react-toast": "^1.2.11", 19 | "@radix-ui/react-tooltip": "^1.2.4", 20 | "@tanstack/react-table": "^8.21.3", 21 | "class-variance-authority": "^0.7.1", 22 | "clsx": "2.1.1", 23 | "lucide-react": "^0.503.0", 24 | "next-themes": "^0.4.6", 25 | "react": "19.1.0", 26 | "react-dom": "19.1.0", 27 | "react-hook-form": "7.56.1", 28 | "react-router-dom": "6.16.0", 29 | "sonner": "^2.0.3", 30 | "tailwind-merge": "2.6.0", 31 | "tailwindcss-animate": "1.0.7" 32 | }, 33 | "devDependencies": { 34 | "@farmfe/cli": "1.0.4", 35 | "@farmfe/core": "1.7.4", 36 | "@farmfe/js-plugin-postcss": "1.12.0", 37 | "@farmfe/plugin-react": "1.2.6", 38 | "@hookform/devtools": "4.4.0", 39 | "@types/node": "22.15.3", 40 | "@types/react": "19.1.2", 41 | "@types/react-dom": "19.1.2", 42 | "autoprefixer": "10.4.21", 43 | "postcss": "8.5.3", 44 | "react-refresh": "0.17.0", 45 | "tailwindcss": "3.4.17" 46 | } 47 | } -------------------------------------------------------------------------------- /front/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /front/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/projects-shelf/RSS_Generator/ecd5c72439173e429727a9275912af249e224d8b/front/public/favicon.ico -------------------------------------------------------------------------------- /front/public/iframe.css: -------------------------------------------------------------------------------- 1 | .xpath-highlight-red { 2 | outline: 2px solid rgba(255, 0, 0, 0.7); 3 | background-color: rgba(255, 0, 0, 0.5); 4 | } 5 | 6 | .xpath-highlight-blue { 7 | outline: 2px solid rgba(0, 0, 255, 0.7); 8 | background-color: rgba(0, 0, 255, 0.5); 9 | } 10 | 11 | .xpath-highlight-green { 12 | outline: 2px solid rgba(0, 255, 0, 0.7); 13 | background-color: rgba(0, 255, 0, 0.5); 14 | } 15 | 16 | .xpath-highlight-yellow { 17 | outline: 2.5px solid rgba(255, 255, 0, 0.7); 18 | background-color: rgba(255, 255, 0, 0.4); 19 | } -------------------------------------------------------------------------------- /front/src/class/data.tsx: -------------------------------------------------------------------------------- 1 | export enum Status { 2 | Unaccessed, 3 | Successed, 4 | Failed, 5 | } 6 | 7 | export type Data = { 8 | id: string 9 | status: Status 10 | url: string 11 | } 12 | 13 | export async function loadDataList(): Promise { 14 | const response = await fetch('/api/load/data'); 15 | 16 | if (!response.ok) { 17 | return [] 18 | } 19 | 20 | return await response.json(); 21 | } -------------------------------------------------------------------------------- /front/src/class/xpath.tsx: -------------------------------------------------------------------------------- 1 | export type XPathSet = { 2 | title: string 3 | description: string 4 | date: string 5 | thumbnail: string 6 | } 7 | 8 | type AutoDetectResponse = { 9 | success: true; 10 | data: XPathSet; 11 | } | { 12 | success: false; 13 | error: string; 14 | }; 15 | 16 | export function initXPathSet(): XPathSet { 17 | return { 18 | title: "", 19 | description: "", 20 | date: "", 21 | thumbnail: "", 22 | } 23 | } 24 | 25 | export async function loadXPathSet(id: string): Promise { 26 | const response = await fetch('/api/load/xpath?id=' + id); 27 | 28 | if (!response.ok) { 29 | return { 30 | title: "", 31 | description: "", 32 | date: "", 33 | thumbnail: "", 34 | } 35 | } 36 | 37 | return await response.json(); 38 | } 39 | 40 | export async function autoDetectXPathSet(url: string): Promise { 41 | const response = await fetch('/api/auto?url=' + url); 42 | 43 | if (!response.ok) { 44 | const errorText = await response.text(); 45 | return { 46 | success: false, 47 | error: errorText || "Server returned an error response.", 48 | }; 49 | } 50 | 51 | const data: XPathSet = await response.json(); 52 | 53 | return { 54 | success: true, 55 | data, 56 | }; 57 | } -------------------------------------------------------------------------------- /front/src/components/app-sidebar.tsx: -------------------------------------------------------------------------------- 1 | import { Folder, Home, Plus } from "lucide-react" 2 | import { Link } from "react-router-dom"; 3 | 4 | import { 5 | Sidebar, 6 | SidebarContent, 7 | SidebarGroup, 8 | SidebarGroupContent, 9 | SidebarGroupLabel, 10 | SidebarMenu, 11 | SidebarMenuButton, 12 | SidebarMenuItem, 13 | } from "@/components/ui/sidebar" 14 | 15 | // Menu items. 16 | const items = [ 17 | { 18 | title: "Home", 19 | url: "", 20 | icon: Home, 21 | }, 22 | { 23 | title: "Manage", 24 | url: "/manage", 25 | icon: Folder, 26 | }, 27 | ] 28 | 29 | export function AppSidebar() { 30 | return ( 31 | 32 | 33 | 34 | shelf | RSS_Generator 35 | 36 | 37 | {items.map((item) => ( 38 | 39 | 40 | 41 | {item.title} 42 | 43 | 44 | 45 | ))} 46 | 47 | 48 | 49 | 50 | 51 | ) 52 | } -------------------------------------------------------------------------------- /front/src/components/hooks/use-mobile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener("change", onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener("change", onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /front/src/components/hooks/use-toast.ts: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | // Inspired by react-hot-toast library 4 | import * as React from "react" 5 | 6 | import type { 7 | ToastActionElement, 8 | ToastProps, 9 | } from "@/components/ui/toast" 10 | 11 | const TOAST_LIMIT = 1 12 | const TOAST_REMOVE_DELAY = 1000000 13 | 14 | type ToasterToast = ToastProps & { 15 | id: string 16 | title?: React.ReactNode 17 | description?: React.ReactNode 18 | action?: ToastActionElement 19 | } 20 | 21 | const actionTypes = { 22 | ADD_TOAST: "ADD_TOAST", 23 | UPDATE_TOAST: "UPDATE_TOAST", 24 | DISMISS_TOAST: "DISMISS_TOAST", 25 | REMOVE_TOAST: "REMOVE_TOAST", 26 | } as const 27 | 28 | let count = 0 29 | 30 | function genId() { 31 | count = (count + 1) % Number.MAX_SAFE_INTEGER 32 | return count.toString() 33 | } 34 | 35 | type ActionType = typeof actionTypes 36 | 37 | type Action = 38 | | { 39 | type: ActionType["ADD_TOAST"] 40 | toast: ToasterToast 41 | } 42 | | { 43 | type: ActionType["UPDATE_TOAST"] 44 | toast: Partial 45 | } 46 | | { 47 | type: ActionType["DISMISS_TOAST"] 48 | toastId?: ToasterToast["id"] 49 | } 50 | | { 51 | type: ActionType["REMOVE_TOAST"] 52 | toastId?: ToasterToast["id"] 53 | } 54 | 55 | interface State { 56 | toasts: ToasterToast[] 57 | } 58 | 59 | const toastTimeouts = new Map>() 60 | 61 | const addToRemoveQueue = (toastId: string) => { 62 | if (toastTimeouts.has(toastId)) { 63 | return 64 | } 65 | 66 | const timeout = setTimeout(() => { 67 | toastTimeouts.delete(toastId) 68 | dispatch({ 69 | type: "REMOVE_TOAST", 70 | toastId: toastId, 71 | }) 72 | }, TOAST_REMOVE_DELAY) 73 | 74 | toastTimeouts.set(toastId, timeout) 75 | } 76 | 77 | export const reducer = (state: State, action: Action): State => { 78 | switch (action.type) { 79 | case "ADD_TOAST": 80 | return { 81 | ...state, 82 | toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT), 83 | } 84 | 85 | case "UPDATE_TOAST": 86 | return { 87 | ...state, 88 | toasts: state.toasts.map((t) => 89 | t.id === action.toast.id ? { ...t, ...action.toast } : t 90 | ), 91 | } 92 | 93 | case "DISMISS_TOAST": { 94 | const { toastId } = action 95 | 96 | // ! Side effects ! - This could be extracted into a dismissToast() action, 97 | // but I'll keep it here for simplicity 98 | if (toastId) { 99 | addToRemoveQueue(toastId) 100 | } else { 101 | state.toasts.forEach((toast) => { 102 | addToRemoveQueue(toast.id) 103 | }) 104 | } 105 | 106 | return { 107 | ...state, 108 | toasts: state.toasts.map((t) => 109 | t.id === toastId || toastId === undefined 110 | ? { 111 | ...t, 112 | open: false, 113 | } 114 | : t 115 | ), 116 | } 117 | } 118 | case "REMOVE_TOAST": 119 | if (action.toastId === undefined) { 120 | return { 121 | ...state, 122 | toasts: [], 123 | } 124 | } 125 | return { 126 | ...state, 127 | toasts: state.toasts.filter((t) => t.id !== action.toastId), 128 | } 129 | } 130 | } 131 | 132 | const listeners: Array<(state: State) => void> = [] 133 | 134 | let memoryState: State = { toasts: [] } 135 | 136 | function dispatch(action: Action) { 137 | memoryState = reducer(memoryState, action) 138 | listeners.forEach((listener) => { 139 | listener(memoryState) 140 | }) 141 | } 142 | 143 | type Toast = Omit 144 | 145 | function toast({ ...props }: Toast) { 146 | const id = genId() 147 | 148 | const update = (props: ToasterToast) => 149 | dispatch({ 150 | type: "UPDATE_TOAST", 151 | toast: { ...props, id }, 152 | }) 153 | const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id }) 154 | 155 | dispatch({ 156 | type: "ADD_TOAST", 157 | toast: { 158 | ...props, 159 | id, 160 | open: true, 161 | onOpenChange: (open) => { 162 | if (!open) dismiss() 163 | }, 164 | }, 165 | }) 166 | 167 | return { 168 | id: id, 169 | dismiss, 170 | update, 171 | } 172 | } 173 | 174 | function useToast() { 175 | const [state, setState] = React.useState(memoryState) 176 | 177 | React.useEffect(() => { 178 | listeners.push(setState) 179 | return () => { 180 | const index = listeners.indexOf(setState) 181 | if (index > -1) { 182 | listeners.splice(index, 1) 183 | } 184 | } 185 | }, [state]) 186 | 187 | return { 188 | ...state, 189 | toast, 190 | dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }), 191 | } 192 | } 193 | 194 | export { useToast, toast } 195 | -------------------------------------------------------------------------------- /front/src/components/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /front/src/components/ui/alert-dialog.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog" 3 | 4 | import { cn } from "@/lib/utils" 5 | import { buttonVariants } from "@/components/ui/button" 6 | 7 | const AlertDialog = AlertDialogPrimitive.Root 8 | 9 | const AlertDialogTrigger = AlertDialogPrimitive.Trigger 10 | 11 | const AlertDialogPortal = AlertDialogPrimitive.Portal 12 | 13 | const AlertDialogOverlay = React.forwardRef< 14 | React.ElementRef, 15 | React.ComponentPropsWithoutRef 16 | >(({ className, ...props }, ref) => ( 17 | 25 | )) 26 | AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName 27 | 28 | const AlertDialogContent = React.forwardRef< 29 | React.ElementRef, 30 | React.ComponentPropsWithoutRef 31 | >(({ className, ...props }, ref) => ( 32 | 33 | 34 | 42 | 43 | )) 44 | AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName 45 | 46 | const AlertDialogHeader = ({ 47 | className, 48 | ...props 49 | }: React.HTMLAttributes) => ( 50 |
57 | ) 58 | AlertDialogHeader.displayName = "AlertDialogHeader" 59 | 60 | const AlertDialogFooter = ({ 61 | className, 62 | ...props 63 | }: React.HTMLAttributes) => ( 64 |
71 | ) 72 | AlertDialogFooter.displayName = "AlertDialogFooter" 73 | 74 | const AlertDialogTitle = React.forwardRef< 75 | React.ElementRef, 76 | React.ComponentPropsWithoutRef 77 | >(({ className, ...props }, ref) => ( 78 | 83 | )) 84 | AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName 85 | 86 | const AlertDialogDescription = React.forwardRef< 87 | React.ElementRef, 88 | React.ComponentPropsWithoutRef 89 | >(({ className, ...props }, ref) => ( 90 | 95 | )) 96 | AlertDialogDescription.displayName = 97 | AlertDialogPrimitive.Description.displayName 98 | 99 | const AlertDialogAction = React.forwardRef< 100 | React.ElementRef, 101 | React.ComponentPropsWithoutRef 102 | >(({ className, ...props }, ref) => ( 103 | 108 | )) 109 | AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName 110 | 111 | const AlertDialogCancel = React.forwardRef< 112 | React.ElementRef, 113 | React.ComponentPropsWithoutRef 114 | >(({ className, ...props }, ref) => ( 115 | 124 | )) 125 | AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName 126 | 127 | export { 128 | AlertDialog, 129 | AlertDialogPortal, 130 | AlertDialogOverlay, 131 | AlertDialogTrigger, 132 | AlertDialogContent, 133 | AlertDialogHeader, 134 | AlertDialogFooter, 135 | AlertDialogTitle, 136 | AlertDialogDescription, 137 | AlertDialogAction, 138 | AlertDialogCancel, 139 | } 140 | -------------------------------------------------------------------------------- /front/src/components/ui/button.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { Slot } from "@radix-ui/react-slot" 3 | import { cva, type VariantProps } from "class-variance-authority" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const buttonVariants = cva( 8 | "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", 9 | { 10 | variants: { 11 | variant: { 12 | default: "bg-primary text-primary-foreground hover:bg-primary/90", 13 | destructive: 14 | "bg-destructive text-destructive-foreground hover:bg-destructive/90", 15 | outline: 16 | "border border-input bg-background hover:bg-accent hover:text-accent-foreground", 17 | secondary: 18 | "bg-secondary text-secondary-foreground hover:bg-secondary/80", 19 | ghost: "hover:bg-accent hover:text-accent-foreground", 20 | link: "text-primary underline-offset-4 hover:underline", 21 | }, 22 | size: { 23 | default: "h-10 px-4 py-2", 24 | sm: "h-9 rounded-md px-3", 25 | lg: "h-11 rounded-md px-8", 26 | icon: "h-10 w-10", 27 | }, 28 | }, 29 | defaultVariants: { 30 | variant: "default", 31 | size: "default", 32 | }, 33 | } 34 | ) 35 | 36 | export interface ButtonProps 37 | extends React.ButtonHTMLAttributes, 38 | VariantProps { 39 | asChild?: boolean 40 | } 41 | 42 | const Button = React.forwardRef( 43 | ({ className, variant, size, asChild = false, ...props }, ref) => { 44 | const Comp = asChild ? Slot : "button" 45 | return ( 46 | 51 | ) 52 | } 53 | ) 54 | Button.displayName = "Button" 55 | 56 | export { Button, buttonVariants } 57 | -------------------------------------------------------------------------------- /front/src/components/ui/dialog.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as DialogPrimitive from "@radix-ui/react-dialog" 3 | import { X } from "lucide-react" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const Dialog = DialogPrimitive.Root 8 | 9 | const DialogTrigger = DialogPrimitive.Trigger 10 | 11 | const DialogPortal = DialogPrimitive.Portal 12 | 13 | const DialogClose = DialogPrimitive.Close 14 | 15 | const DialogOverlay = React.forwardRef< 16 | React.ElementRef, 17 | React.ComponentPropsWithoutRef 18 | >(({ className, ...props }, ref) => ( 19 | 27 | )) 28 | DialogOverlay.displayName = DialogPrimitive.Overlay.displayName 29 | 30 | const DialogContent = React.forwardRef< 31 | React.ElementRef, 32 | React.ComponentPropsWithoutRef 33 | >(({ className, children, ...props }, ref) => ( 34 | 35 | 36 | 44 | {children} 45 | 46 | 47 | Close 48 | 49 | 50 | 51 | )) 52 | DialogContent.displayName = DialogPrimitive.Content.displayName 53 | 54 | const DialogHeader = ({ 55 | className, 56 | ...props 57 | }: React.HTMLAttributes) => ( 58 |
65 | ) 66 | DialogHeader.displayName = "DialogHeader" 67 | 68 | const DialogFooter = ({ 69 | className, 70 | ...props 71 | }: React.HTMLAttributes) => ( 72 |
79 | ) 80 | DialogFooter.displayName = "DialogFooter" 81 | 82 | const DialogTitle = React.forwardRef< 83 | React.ElementRef, 84 | React.ComponentPropsWithoutRef 85 | >(({ className, ...props }, ref) => ( 86 | 94 | )) 95 | DialogTitle.displayName = DialogPrimitive.Title.displayName 96 | 97 | const DialogDescription = React.forwardRef< 98 | React.ElementRef, 99 | React.ComponentPropsWithoutRef 100 | >(({ className, ...props }, ref) => ( 101 | 106 | )) 107 | DialogDescription.displayName = DialogPrimitive.Description.displayName 108 | 109 | export { 110 | Dialog, 111 | DialogPortal, 112 | DialogOverlay, 113 | DialogClose, 114 | DialogTrigger, 115 | DialogContent, 116 | DialogHeader, 117 | DialogFooter, 118 | DialogTitle, 119 | DialogDescription, 120 | } 121 | -------------------------------------------------------------------------------- /front/src/components/ui/dropdown-menu.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu" 3 | import { Check, ChevronRight, Circle } from "lucide-react" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const DropdownMenu = DropdownMenuPrimitive.Root 8 | 9 | const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger 10 | 11 | const DropdownMenuGroup = DropdownMenuPrimitive.Group 12 | 13 | const DropdownMenuPortal = DropdownMenuPrimitive.Portal 14 | 15 | const DropdownMenuSub = DropdownMenuPrimitive.Sub 16 | 17 | const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup 18 | 19 | const DropdownMenuSubTrigger = React.forwardRef< 20 | React.ElementRef, 21 | React.ComponentPropsWithoutRef & { 22 | inset?: boolean 23 | } 24 | >(({ className, inset, children, ...props }, ref) => ( 25 | 34 | {children} 35 | 36 | 37 | )) 38 | DropdownMenuSubTrigger.displayName = 39 | DropdownMenuPrimitive.SubTrigger.displayName 40 | 41 | const DropdownMenuSubContent = React.forwardRef< 42 | React.ElementRef, 43 | React.ComponentPropsWithoutRef 44 | >(({ className, ...props }, ref) => ( 45 | 53 | )) 54 | DropdownMenuSubContent.displayName = 55 | DropdownMenuPrimitive.SubContent.displayName 56 | 57 | const DropdownMenuContent = React.forwardRef< 58 | React.ElementRef, 59 | React.ComponentPropsWithoutRef 60 | >(({ className, sideOffset = 4, ...props }, ref) => ( 61 | 62 | 71 | 72 | )) 73 | DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName 74 | 75 | const DropdownMenuItem = React.forwardRef< 76 | React.ElementRef, 77 | React.ComponentPropsWithoutRef & { 78 | inset?: boolean 79 | } 80 | >(({ className, inset, ...props }, ref) => ( 81 | 90 | )) 91 | DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName 92 | 93 | const DropdownMenuCheckboxItem = React.forwardRef< 94 | React.ElementRef, 95 | React.ComponentPropsWithoutRef 96 | >(({ className, children, checked, ...props }, ref) => ( 97 | 106 | 107 | 108 | 109 | 110 | 111 | {children} 112 | 113 | )) 114 | DropdownMenuCheckboxItem.displayName = 115 | DropdownMenuPrimitive.CheckboxItem.displayName 116 | 117 | const DropdownMenuRadioItem = React.forwardRef< 118 | React.ElementRef, 119 | React.ComponentPropsWithoutRef 120 | >(({ className, children, ...props }, ref) => ( 121 | 129 | 130 | 131 | 132 | 133 | 134 | {children} 135 | 136 | )) 137 | DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName 138 | 139 | const DropdownMenuLabel = React.forwardRef< 140 | React.ElementRef, 141 | React.ComponentPropsWithoutRef & { 142 | inset?: boolean 143 | } 144 | >(({ className, inset, ...props }, ref) => ( 145 | 154 | )) 155 | DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName 156 | 157 | const DropdownMenuSeparator = React.forwardRef< 158 | React.ElementRef, 159 | React.ComponentPropsWithoutRef 160 | >(({ className, ...props }, ref) => ( 161 | 166 | )) 167 | DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName 168 | 169 | const DropdownMenuShortcut = ({ 170 | className, 171 | ...props 172 | }: React.HTMLAttributes) => { 173 | return ( 174 | 178 | ) 179 | } 180 | DropdownMenuShortcut.displayName = "DropdownMenuShortcut" 181 | 182 | export { 183 | DropdownMenu, 184 | DropdownMenuTrigger, 185 | DropdownMenuContent, 186 | DropdownMenuItem, 187 | DropdownMenuCheckboxItem, 188 | DropdownMenuRadioItem, 189 | DropdownMenuLabel, 190 | DropdownMenuSeparator, 191 | DropdownMenuShortcut, 192 | DropdownMenuGroup, 193 | DropdownMenuPortal, 194 | DropdownMenuSub, 195 | DropdownMenuSubContent, 196 | DropdownMenuSubTrigger, 197 | DropdownMenuRadioGroup, 198 | } 199 | -------------------------------------------------------------------------------- /front/src/components/ui/input.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | const Input = React.forwardRef>( 6 | ({ className, type, ...props }, ref) => { 7 | return ( 8 | 17 | ) 18 | } 19 | ) 20 | Input.displayName = "Input" 21 | 22 | export { Input } 23 | -------------------------------------------------------------------------------- /front/src/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as LabelPrimitive from "@radix-ui/react-label" 3 | import { cva, type VariantProps } from "class-variance-authority" 4 | 5 | import { cn } from "@/lib/utils" 6 | 7 | const labelVariants = cva( 8 | "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" 9 | ) 10 | 11 | const Label = React.forwardRef< 12 | React.ElementRef, 13 | React.ComponentPropsWithoutRef & 14 | VariantProps 15 | >(({ className, ...props }, ref) => ( 16 | 21 | )) 22 | Label.displayName = LabelPrimitive.Root.displayName 23 | 24 | export { Label } 25 | -------------------------------------------------------------------------------- /front/src/components/ui/mydialog.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as DialogPrimitive from "@radix-ui/react-dialog" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Dialog = DialogPrimitive.Root 7 | 8 | const DialogTrigger = DialogPrimitive.Trigger 9 | 10 | const DialogPortal = DialogPrimitive.Portal 11 | 12 | const DialogClose = DialogPrimitive.Close 13 | 14 | const DialogOverlay = React.forwardRef< 15 | React.ElementRef, 16 | React.ComponentPropsWithoutRef 17 | >(({ className, ...props }, ref) => ( 18 | 26 | )) 27 | DialogOverlay.displayName = DialogPrimitive.Overlay.displayName 28 | 29 | const DialogContent = React.forwardRef< 30 | React.ElementRef, 31 | React.ComponentPropsWithoutRef 32 | >(({ className, children, ...props }, ref) => ( 33 | 34 | 35 | 43 | {children} 44 | 45 | 46 | )) 47 | DialogContent.displayName = DialogPrimitive.Content.displayName 48 | 49 | const DialogHeader = ({ 50 | className, 51 | ...props 52 | }: React.HTMLAttributes) => ( 53 |
60 | ) 61 | DialogHeader.displayName = "DialogHeader" 62 | 63 | const DialogFooter = ({ 64 | className, 65 | ...props 66 | }: React.HTMLAttributes) => ( 67 |
74 | ) 75 | DialogFooter.displayName = "DialogFooter" 76 | 77 | const DialogTitle = React.forwardRef< 78 | React.ElementRef, 79 | React.ComponentPropsWithoutRef 80 | >(({ className, ...props }, ref) => ( 81 | 89 | )) 90 | DialogTitle.displayName = DialogPrimitive.Title.displayName 91 | 92 | const DialogDescription = React.forwardRef< 93 | React.ElementRef, 94 | React.ComponentPropsWithoutRef 95 | >(({ className, ...props }, ref) => ( 96 | 101 | )) 102 | DialogDescription.displayName = DialogPrimitive.Description.displayName 103 | 104 | export { 105 | Dialog, 106 | DialogPortal, 107 | DialogOverlay, 108 | DialogClose, 109 | DialogTrigger, 110 | DialogContent, 111 | DialogHeader, 112 | DialogFooter, 113 | DialogTitle, 114 | DialogDescription, 115 | } 116 | -------------------------------------------------------------------------------- /front/src/components/ui/separator.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as SeparatorPrimitive from "@radix-ui/react-separator" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | const Separator = React.forwardRef< 7 | React.ElementRef, 8 | React.ComponentPropsWithoutRef 9 | >( 10 | ( 11 | { className, orientation = "horizontal", decorative = true, ...props }, 12 | ref 13 | ) => ( 14 | 25 | ) 26 | ) 27 | Separator.displayName = SeparatorPrimitive.Root.displayName 28 | 29 | export { Separator } 30 | -------------------------------------------------------------------------------- /front/src/components/ui/sheet.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as React from "react" 4 | import * as SheetPrimitive from "@radix-ui/react-dialog" 5 | import { cva, type VariantProps } from "class-variance-authority" 6 | import { X } from "lucide-react" 7 | 8 | import { cn } from "@/lib/utils" 9 | 10 | const Sheet = SheetPrimitive.Root 11 | 12 | const SheetTrigger = SheetPrimitive.Trigger 13 | 14 | const SheetClose = SheetPrimitive.Close 15 | 16 | const SheetPortal = SheetPrimitive.Portal 17 | 18 | const SheetOverlay = React.forwardRef< 19 | React.ElementRef, 20 | React.ComponentPropsWithoutRef 21 | >(({ className, ...props }, ref) => ( 22 | 30 | )) 31 | SheetOverlay.displayName = SheetPrimitive.Overlay.displayName 32 | 33 | const sheetVariants = cva( 34 | "fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", 35 | { 36 | variants: { 37 | side: { 38 | top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", 39 | bottom: 40 | "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", 41 | left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm", 42 | right: 43 | "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm", 44 | }, 45 | }, 46 | defaultVariants: { 47 | side: "right", 48 | }, 49 | } 50 | ) 51 | 52 | interface SheetContentProps 53 | extends React.ComponentPropsWithoutRef, 54 | VariantProps {} 55 | 56 | const SheetContent = React.forwardRef< 57 | React.ElementRef, 58 | SheetContentProps 59 | >(({ side = "right", className, children, ...props }, ref) => ( 60 | 61 | 62 | 67 | {children} 68 | 69 | 70 | Close 71 | 72 | 73 | 74 | )) 75 | SheetContent.displayName = SheetPrimitive.Content.displayName 76 | 77 | const SheetHeader = ({ 78 | className, 79 | ...props 80 | }: React.HTMLAttributes) => ( 81 |
88 | ) 89 | SheetHeader.displayName = "SheetHeader" 90 | 91 | const SheetFooter = ({ 92 | className, 93 | ...props 94 | }: React.HTMLAttributes) => ( 95 |
102 | ) 103 | SheetFooter.displayName = "SheetFooter" 104 | 105 | const SheetTitle = React.forwardRef< 106 | React.ElementRef, 107 | React.ComponentPropsWithoutRef 108 | >(({ className, ...props }, ref) => ( 109 | 114 | )) 115 | SheetTitle.displayName = SheetPrimitive.Title.displayName 116 | 117 | const SheetDescription = React.forwardRef< 118 | React.ElementRef, 119 | React.ComponentPropsWithoutRef 120 | >(({ className, ...props }, ref) => ( 121 | 126 | )) 127 | SheetDescription.displayName = SheetPrimitive.Description.displayName 128 | 129 | export { 130 | Sheet, 131 | SheetPortal, 132 | SheetOverlay, 133 | SheetTrigger, 134 | SheetClose, 135 | SheetContent, 136 | SheetHeader, 137 | SheetFooter, 138 | SheetTitle, 139 | SheetDescription, 140 | } 141 | -------------------------------------------------------------------------------- /front/src/components/ui/sidebar.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import { Slot } from "@radix-ui/react-slot" 3 | import { VariantProps, cva } from "class-variance-authority" 4 | import { PanelLeft } from "lucide-react" 5 | 6 | import { useIsMobile } from "@/components/hooks/use-mobile" 7 | import { cn } from "@/components/lib/utils" 8 | import { Button } from "@/components/ui/button" 9 | import { Input } from "@/components/ui/input" 10 | import { Separator } from "@/components/ui/separator" 11 | import { 12 | Sheet, 13 | SheetContent, 14 | SheetDescription, 15 | SheetHeader, 16 | SheetTitle, 17 | } from "@/components/ui/sheet" 18 | import { Skeleton } from "@/components/ui/skeleton" 19 | import { 20 | Tooltip, 21 | TooltipContent, 22 | TooltipProvider, 23 | TooltipTrigger, 24 | } from "@/components/ui/tooltip" 25 | 26 | const SIDEBAR_COOKIE_NAME = "sidebar_state" 27 | const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 28 | const SIDEBAR_WIDTH = "16rem" 29 | const SIDEBAR_WIDTH_MOBILE = "18rem" 30 | const SIDEBAR_WIDTH_ICON = "3rem" 31 | const SIDEBAR_KEYBOARD_SHORTCUT = "b" 32 | 33 | type SidebarContextProps = { 34 | state: "expanded" | "collapsed" 35 | open: boolean 36 | setOpen: (open: boolean) => void 37 | openMobile: boolean 38 | setOpenMobile: (open: boolean) => void 39 | isMobile: boolean 40 | toggleSidebar: () => void 41 | } 42 | 43 | const SidebarContext = React.createContext(null) 44 | 45 | function useSidebar() { 46 | const context = React.useContext(SidebarContext) 47 | if (!context) { 48 | throw new Error("useSidebar must be used within a SidebarProvider.") 49 | } 50 | 51 | return context 52 | } 53 | 54 | const SidebarProvider = React.forwardRef< 55 | HTMLDivElement, 56 | React.ComponentProps<"div"> & { 57 | defaultOpen?: boolean 58 | open?: boolean 59 | onOpenChange?: (open: boolean) => void 60 | } 61 | >( 62 | ( 63 | { 64 | defaultOpen = true, 65 | open: openProp, 66 | onOpenChange: setOpenProp, 67 | className, 68 | style, 69 | children, 70 | ...props 71 | }, 72 | ref 73 | ) => { 74 | const isMobile = useIsMobile() 75 | const [openMobile, setOpenMobile] = React.useState(false) 76 | 77 | // This is the internal state of the sidebar. 78 | // We use openProp and setOpenProp for control from outside the component. 79 | const [_open, _setOpen] = React.useState(defaultOpen) 80 | const open = openProp ?? _open 81 | const setOpen = React.useCallback( 82 | (value: boolean | ((value: boolean) => boolean)) => { 83 | const openState = typeof value === "function" ? value(open) : value 84 | if (setOpenProp) { 85 | setOpenProp(openState) 86 | } else { 87 | _setOpen(openState) 88 | } 89 | 90 | // This sets the cookie to keep the sidebar state. 91 | document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}` 92 | }, 93 | [setOpenProp, open] 94 | ) 95 | 96 | // Helper to toggle the sidebar. 97 | const toggleSidebar = React.useCallback(() => { 98 | return isMobile 99 | ? setOpenMobile((open) => !open) 100 | : setOpen((open) => !open) 101 | }, [isMobile, setOpen, setOpenMobile]) 102 | 103 | // Adds a keyboard shortcut to toggle the sidebar. 104 | React.useEffect(() => { 105 | const handleKeyDown = (event: KeyboardEvent) => { 106 | if ( 107 | event.key === SIDEBAR_KEYBOARD_SHORTCUT && 108 | (event.metaKey || event.ctrlKey) 109 | ) { 110 | event.preventDefault() 111 | toggleSidebar() 112 | } 113 | } 114 | 115 | window.addEventListener("keydown", handleKeyDown) 116 | return () => window.removeEventListener("keydown", handleKeyDown) 117 | }, [toggleSidebar]) 118 | 119 | // We add a state so that we can do data-state="expanded" or "collapsed". 120 | // This makes it easier to style the sidebar with Tailwind classes. 121 | const state = open ? "expanded" : "collapsed" 122 | 123 | const contextValue = React.useMemo( 124 | () => ({ 125 | state, 126 | open, 127 | setOpen, 128 | isMobile, 129 | openMobile, 130 | setOpenMobile, 131 | toggleSidebar, 132 | }), 133 | [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar] 134 | ) 135 | 136 | return ( 137 | 138 | 139 |
154 | {children} 155 |
156 |
157 |
158 | ) 159 | } 160 | ) 161 | SidebarProvider.displayName = "SidebarProvider" 162 | 163 | const Sidebar = React.forwardRef< 164 | HTMLDivElement, 165 | React.ComponentProps<"div"> & { 166 | side?: "left" | "right" 167 | variant?: "sidebar" | "floating" | "inset" 168 | collapsible?: "offcanvas" | "icon" | "none" 169 | } 170 | >( 171 | ( 172 | { 173 | side = "left", 174 | variant = "sidebar", 175 | collapsible = "offcanvas", 176 | className, 177 | children, 178 | ...props 179 | }, 180 | ref 181 | ) => { 182 | const { isMobile, state, openMobile, setOpenMobile } = useSidebar() 183 | 184 | if (collapsible === "none") { 185 | return ( 186 |
194 | {children} 195 |
196 | ) 197 | } 198 | 199 | if (isMobile) { 200 | return ( 201 | 202 | 213 | 214 | Sidebar 215 | Displays the mobile sidebar. 216 | 217 |
{children}
218 |
219 |
220 | ) 221 | } 222 | 223 | return ( 224 |
232 | {/* This is what handles the sidebar gap on desktop */} 233 |
243 | 264 |
265 | ) 266 | } 267 | ) 268 | Sidebar.displayName = "Sidebar" 269 | 270 | const SidebarTrigger = React.forwardRef< 271 | React.ElementRef, 272 | React.ComponentProps 273 | >(({ className, onClick, ...props }, ref) => { 274 | const { toggleSidebar } = useSidebar() 275 | 276 | return ( 277 | 292 | ) 293 | }) 294 | SidebarTrigger.displayName = "SidebarTrigger" 295 | 296 | const SidebarRail = React.forwardRef< 297 | HTMLButtonElement, 298 | React.ComponentProps<"button"> 299 | >(({ className, ...props }, ref) => { 300 | const { toggleSidebar } = useSidebar() 301 | 302 | return ( 303 |