자산 현황 및 자동매매 페이지 제거:
Some checks failed
Build Push and Restart Compose / deploy (push) Failing after 11m20s

- `/templates/pages/asset.html`, `/templates/pages/autotrade.html` HTML 템플릿 삭제.
- `/static/js/asset.js`, `/static/js/autotrade.js` 클라이언트 스크립트 제거.
- 관련 함수 및 초기화 로직 삭제 (자산 조회 및 자동매매 기능 비활성화).
This commit is contained in:
hayato5246
2026-04-07 21:43:24 +09:00
parent 5a29d50752
commit 5aeb5f2b80
47 changed files with 279 additions and 6361 deletions

View File

@@ -1,8 +1,6 @@
package handlers
import (
"html/template"
"log"
"net/http"
"stocksearch/config"
"stocksearch/middleware"
@@ -12,40 +10,11 @@ import (
// AuthHandler 로그인/로그아웃 핸들러
type AuthHandler struct {
sessionSvc *services.SessionService
loginTmpl *template.Template
}
// NewAuthHandler 인증 핸들러 초기화
func NewAuthHandler(sessionSvc *services.SessionService) *AuthHandler {
tmpl, err := template.ParseFiles("templates/pages/login.html")
if err != nil {
log.Fatalf("로그인 템플릿 파싱 실패: %v", err)
}
return &AuthHandler{
sessionSvc: sessionSvc,
loginTmpl: tmpl,
}
}
// LoginPage GET /login — 로그인 폼 렌더링
func (h *AuthHandler) LoginPage(w http.ResponseWriter, r *http.Request) {
// 이미 로그인된 경우 메인으로 리다이렉트
if cookie, err := r.Cookie(middleware.SessionCookieName); err == nil {
if h.sessionSvc.Validate(cookie.Value) {
http.Redirect(w, r, "/", http.StatusFound)
return
}
}
// next 파라미터가 없으면 로그인 후 메인 페이지로
next := r.URL.Query().Get("next")
if next == "" {
next = "/"
}
data := map[string]string{
"Next": next,
"Error": "",
}
h.renderLogin(w, data)
return &AuthHandler{sessionSvc: sessionSvc}
}
// Login POST /login — ID/PW 검증 후 세션 발급
@@ -64,12 +33,9 @@ func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request) {
// ID/PW 검증
if id != config.App.AdminID || password != config.App.AdminPassword {
data := map[string]string{
"Next": next,
"Error": "아이디 또는 비밀번호가 올바르지 않습니다.",
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusUnauthorized)
h.renderLogin(w, data)
_, _ = w.Write([]byte(`{"error":"아이디 또는 비밀번호가 올바르지 않습니다."}`))
return
}
@@ -99,13 +65,12 @@ func (h *AuthHandler) CheckSession(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
// Logout POST /logout — 세션 삭제 후 /login 리다이렉트
// Logout POST /logout — 세션 삭제
func (h *AuthHandler) Logout(w http.ResponseWriter, r *http.Request) {
if cookie, err := r.Cookie(middleware.SessionCookieName); err == nil {
h.sessionSvc.Delete(cookie.Value)
}
// 쿠키 만료 처리
http.SetCookie(w, &http.Cookie{
Name: middleware.SessionCookieName,
Value: "",
@@ -114,14 +79,5 @@ func (h *AuthHandler) Logout(w http.ResponseWriter, r *http.Request) {
MaxAge: -1,
})
http.Redirect(w, r, "/", http.StatusFound)
}
// renderLogin 로그인 템플릿 렌더링 헬퍼
func (h *AuthHandler) renderLogin(w http.ResponseWriter, data interface{}) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
if err := h.loginTmpl.ExecuteTemplate(w, "login.html", data); err != nil {
log.Printf("로그인 템플릿 렌더링 실패: %v", err)
http.Error(w, "페이지를 표시할 수 없습니다.", http.StatusInternalServerError)
}
w.WriteHeader(http.StatusOK)
}