Moge-Row commited on
Commit
beb42fb
·
1 Parent(s): db01949

fix: emergency rollback and structural alignment

Browse files
Files changed (2) hide show
  1. internal/handler/index.html +0 -75
  2. main.go +10 -7
internal/handler/index.html DELETED
@@ -1,75 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang='es'>
3
- <head>
4
- <meta charset='UTF-8'>
5
- <title>ROW-PROXY // FRENTE ORIENTAL</title>
6
- <style>
7
- body { background: #0d0d0c; color: #d4d4d4; font-family: 'Courier New', monospace; padding: 20px; line-height: 1.2; }
8
- .monitor { max-width: 1000px; margin: auto; }
9
- .section-header { color: #7a6228; font-size: 12px; letter-spacing: 4px; margin: 20px 0 10px 0; border-bottom: 1px solid #2a2a1f; padding-bottom: 5px; }
10
- .box { background: rgba(26, 18, 0, 0.4); border: 1px solid #3a2a00; padding: 20px; margin-bottom: 20px; position: relative; }
11
- h2 { color: #ff3333; font-size: 14px; letter-spacing: 2px; margin-bottom: 15px; font-weight: bold; }
12
- h2::before { content: '★ '; }
13
- .ranking-row { display: flex; align-items: center; gap: 15px; margin-bottom: 10px; }
14
- .name { color: #daa520; width: 120px; font-size: 13px; font-weight: bold; flex-shrink: 0; }
15
- .bar-container { flex-grow: 1; background: #080808; height: 14px; border: 1px solid #222; }
16
- .bar { background: #cc0000; height: 100%; transition: width 0.8s ease-out; }
17
- .tokens { color: #7a6228; width: 100px; text-align: right; font-size: 11px; }
18
- .focus-tree { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
19
- .focus-node { border: 1px solid #ff3333; color: #ff3333; padding: 5px 10px; font-size: 10px; text-transform: uppercase; background: rgba(255,0,0,0.05); }
20
- .quote { border-left: 3px solid #ff3333; background: rgba(255, 0, 0, 0.03); padding: 15px; margin-top: 20px; font-style: italic; color: #888; }
21
- .url-display { color: #e8c86b; font-size: 14px; border-left: 3px solid #cc0000; padding-left: 15px; }
22
- </style>
23
- </head>
24
- <body>
25
- <div class='monitor'>
26
- <div class='section-header'>// HOI4 - NO STEP BACK - FRENTE ORIENTAL</div>
27
- <div class='box'>
28
- <h2>TOP USUARIOS (COMANDANTES)</h2>
29
- <div id='ranking-frente'>
30
- <div style='color:#7a6228; text-align:center; padding:10px;'>CONECTANDO AL SERVIDOR CENTRAL...</div>
31
- </div>
32
- </div>
33
- <div class='box'>
34
- <h2>ARBOL DE ENFOQUE SOVIETICO</h2>
35
- <div class='focus-tree'>
36
- <div class='focus-node'>INDUSTRIA DE GUERRA</div>
37
- <div class='focus-node'>COLLECTIVIZACION</div>
38
- <div class='focus-node'>PURGA MILITAR</div>
39
- <div class='focus-node'>LEND-LEASE</div>
40
- <div class='focus-node'>PACTO RIBBENTROP</div>
41
- <div class='focus-node'>DEFENSA EN PROFUNDIDAD</div>
42
- <div class='focus-node'>FRENTE POPULAR</div>
43
- </div>
44
- </div>
45
- <div class='quote'>
46
- "La victoria es para aquellos que no retroceden. Ni un paso atras."<br>
47
- — Orden No. 227, Stalin — 1942 — NO STEP BACK
48
- </div>
49
- <div class='section-header'>// PUNTO DE ACCESO</div>
50
- <div class='url-display'>BASE URL: https://moge-row-row-proxy.hf.space/v1</div>
51
- </div>
52
- <script>
53
- async function updateStats() {
54
- try {
55
- const r = await fetch(window.location.origin + '/stats');
56
- const data = await r.json();
57
- const container = document.getElementById('ranking-frente');
58
- const entries = Object.entries(data.keys || {}).map(([name, info]) => ({
59
- name: name,
60
- tokens: info.tokens || 0
61
- })).sort((a, b) => b.tokens - a.tokens);
62
- if (entries.length === 0) return;
63
- const maxTokens = Math.max(...entries.map(e => e.tokens), 5000);
64
- container.innerHTML = entries.map(u => `
65
- <div class='ranking-row'>
66
- <div class='name'>${u.name.toUpperCase()}</div>
67
- <div class='bar-container'><div class='bar' style='width:${Math.min((u.tokens/maxTokens)*100, 100)}%'></div></div>
68
- <div class='tokens'>${u.tokens.toLocaleString()} TKNS</div>
69
- </div>`).join('');
70
- } catch(e) { console.error(e); }
71
- }
72
- setInterval(updateStats, 5000); updateStats();
73
- </script>
74
- </body>
75
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
main.go CHANGED
@@ -1,22 +1,25 @@
1
  package main
 
2
  import (
3
  "log"
4
  "net/http"
5
  "os"
 
6
  )
 
7
  func main() {
8
- // Servir la interfaz HOI4
9
  http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
10
  http.ServeFile(w, r, "index.html")
11
  })
12
 
13
- // Endpoints de datos (deben estar definidos en tus otros archivos .go)
14
- // Si dan error de compilación, comenta estas líneas
15
- // http.HandleFunc("/stats", StatsHandler)
16
- // http.HandleFunc("/internal-debug-v1", DebugHandler)
 
17
 
18
- port := "7860" // Puerto obligatorio para HF
19
- log.Printf("Servidor iniciado en puerto %s", port)
20
  if err := http.ListenAndServe(":"+port, nil); err != nil {
21
  log.Fatal(err)
22
  }
 
1
  package main
2
+
3
  import (
4
  "log"
5
  "net/http"
6
  "os"
7
+ // Asegúrate de que los paquetes internos se carguen aquí
8
  )
9
+
10
  func main() {
11
+ // Servir el index.html que creamos (la interfaz de HOI4)
12
  http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
13
  http.ServeFile(w, r, "index.html")
14
  })
15
 
16
+ // Registrar rutas de keys.go (usando las funciones originales)
17
+ SetupRoutes()
18
+
19
+ port := os.Getenv("PORT")
20
+ if port == "" { port = "7860" }
21
 
22
+ log.Printf("Servidor operativo en puerto %s", port)
 
23
  if err := http.ListenAndServe(":"+port, nil); err != nil {
24
  log.Fatal(err)
25
  }