Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ menta-account.txt
ethicalmetrics/.env

/node_modules
PLAN.md
PLAN.md
PLAN-TAGS.md
70 changes: 69 additions & 1 deletion internal/http/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1895,6 +1895,61 @@ func GitHubWikiProxyHandler(c *gin.Context) {
c.JSON(http.StatusNotFound, gin.H{"error": "wiki page not found"})
}

func GitLabWikiProxyHandler(c *gin.Context) {
owner := c.Param("owner")
repo := c.Param("repo")

projectID := url.PathEscape(owner + "/" + repo)
apiURL := fmt.Sprintf("https://gitlab.com/api/v4/projects/%s/wikis", projectID)
if c.Query("with_content") == "1" {
apiURL += "?with_content=1"
}

req, err := http.NewRequest("GET", apiURL, nil)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "proxy error"})
return
}
if token := os.Getenv("GITLAB_TOKEN"); token != "" {
req.Header.Set("PRIVATE-TOKEN", token)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("User-Agent", "gitGost/1.0")

client := &http.Client{Timeout: 15 * time.Second}
resp, err := client.Do(req)
if err != nil {
utils.Log("GitLab wiki proxy error: %v", err)
c.JSON(http.StatusBadGateway, gin.H{"error": "gitlab unreachable"})
return
}
defer resp.Body.Close()

// Solo los estados que indican wiki inaccesible o no disponible (proyecto
// privado, sin permisos o wiki deshabilitada) se normalizan a 200 con lista
// vacía para que el frontend muestre el estado sin errores de red.
if resp.StatusCode == http.StatusUnauthorized ||
resp.StatusCode == http.StatusForbidden ||
resp.StatusCode == http.StatusNotFound {
c.JSON(http.StatusOK, []gin.H{})
return
}

body, err := io.ReadAll(resp.Body)
if err != nil {
c.JSON(http.StatusBadGateway, gin.H{"error": "failed to read response"})
return
}

// Propagar el resto de respuestas no-200 del upstream (p. ej. 429 o 5xx).
if resp.StatusCode != http.StatusOK {
c.Data(resp.StatusCode, "application/json", body)
return
}

c.Data(http.StatusOK, resp.Header.Get("Content-Type"), body)
}

func CreateAnonymousCommentHandler(c *gin.Context) {
var req anonymousCommentRequest
if err := c.ShouldBindJSON(&req); err != nil {
Expand Down Expand Up @@ -2927,6 +2982,11 @@ func CodebergProxyHandler(c *gin.Context) {

client := &http.Client{Timeout: 45 * time.Second}
resp, err := client.Do(req)
if err != nil {
// Codeberg sufre timeouts puntuales: reintentar una vez antes de devolver 502.
time.Sleep(500 * time.Millisecond)
resp, err = client.Do(req)
}
if err != nil {
utils.Log("Codeberg proxy error: %v", err)
c.AbortWithStatusJSON(http.StatusBadGateway, gin.H{"error": "failed to reach Codeberg"})
Expand Down Expand Up @@ -2960,6 +3020,14 @@ func SearchHandler(c *gin.Context) {

results := []gin.H{}

// Support GitHub-style `topic:<name>` queries: use the topic for every provider
// so GitLab/Codeberg don't receive the literal "topic:" prefix.
if topicParam == "" && strings.HasPrefix(query, "topic:") {
if topic := strings.TrimSpace(strings.TrimPrefix(query, "topic:")); topic != "" {
topicParam = topic
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

ghQuery := query
glQuery := query
cbQuery := query
Expand Down Expand Up @@ -3057,7 +3125,7 @@ func searchCodeberg(query, topic string) []gin.H {
results := []gin.H{}

q := query
if q == "" && topic != "" {
if topic != "" {
q = topic
}

Expand Down
1 change: 1 addition & 0 deletions internal/http/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ func SetupRouter(cfg *config.Config) *gin.Engine {
api.GET("/gh-discussions/:owner/:repo", GitHubDiscussionsProxyHandler)
api.GET("/gh-discussion/:owner/:repo/:number", GitHubDiscussionDetailProxyHandler)
api.GET("/gh-wiki/:owner/:repo/:page", GitHubWikiProxyHandler)
api.GET("/gl-wiki/:owner/:repo", GitLabWikiProxyHandler)
}

r.GET("/appeal", AppealStartHandler)
Expand Down
8 changes: 8 additions & 0 deletions web/assets/MaterialIconTheme/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2025 Material Extensions

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 8 additions & 0 deletions web/assets/MaterialIconTheme/legal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"source": "https://github.com/material-extensions/vscode-material-icon-theme",
"path": "icons",
"branch": "main",
"license": "MIT",
"last_sync": "1785960368",
"commit": "146ded17af5d4a77aa416fd86699aac50fba900f"
}
Comment thread
livrasand marked this conversation as resolved.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--3d.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--abap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--abc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--ada.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--adonis.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--advpl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--agent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--amplify.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--android.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--angular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--antlr.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--apollo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions web/assets/MaterialIconTheme/material-icon-theme--arduino.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading