Skip to content

Commit

Permalink
chore: mv internal/state/fn => internal/fn
Browse files Browse the repository at this point in the history
  • Loading branch information
soulteary committed Jan 6, 2024
1 parent 4d2a214 commit 172ef79
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion config/state/favicon.go → internal/fn/favicon.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package FlareState
package FlareFn

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion config/state/network.go → internal/fn/network.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package FlareState
package FlareFn

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion config/state/url.go → internal/fn/url.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package FlareState
package FlareFn

import (
"net/http"
Expand Down
3 changes: 2 additions & 1 deletion internal/pages/guide/guide.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/soulteary/memfs"

FlareState "github.com/soulteary/flare/config/state"
FlareFn "github.com/soulteary/flare/internal/fn"
)

var MemFs *memfs.FS
Expand Down Expand Up @@ -45,7 +46,7 @@ func render(c *gin.Context) {
func getUserHomePage() string {
port := strconv.Itoa(FlareState.AppFlags.Port)

body, err := FlareState.GetHTML("http://localhost:" + port + "/")
body, err := FlareFn.GetHTML("http://localhost:" + port + "/")
if err != nil {
return ""
}
Expand Down
6 changes: 3 additions & 3 deletions internal/pages/home/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

FlareData "github.com/soulteary/flare/config/data"
FlareModel "github.com/soulteary/flare/config/model"
FlareState "github.com/soulteary/flare/config/state"
FlareFn "github.com/soulteary/flare/internal/fn"
FlareMDI "github.com/soulteary/flare/internal/resources/mdi"
)

Expand All @@ -17,7 +17,7 @@ func GenerateApplicationsTemplate(filter string) template.HTML {

var parseApps []FlareModel.Bookmark
for _, app := range appsData.Items {
app.URL = FlareState.ParseDynamicUrl(app.URL)
app.URL = FlareFn.ParseDynamicUrl(app.URL)
parseApps = append(parseApps, app)
}

Expand Down Expand Up @@ -63,7 +63,7 @@ func GenerateApplicationsTemplate(filter string) template.HTML {
templateIcon = FlareMDI.GetIconByName(app.Icon)
} else {
if options.IconMode == "FILLING" {
templateIcon = FlareState.GetYandexFavicon(app.URL, FlareMDI.GetIconByName(app.Icon))
templateIcon = FlareFn.GetYandexFavicon(app.URL, FlareMDI.GetIconByName(app.Icon))
} else {
templateIcon = FlareMDI.GetIconByName(app.Icon)
}
Expand Down
8 changes: 4 additions & 4 deletions internal/pages/home/bookmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

FlareData "github.com/soulteary/flare/config/data"
FlareModel "github.com/soulteary/flare/config/model"
FlareState "github.com/soulteary/flare/config/state"
FlareFn "github.com/soulteary/flare/internal/fn"
FlareMDI "github.com/soulteary/flare/internal/resources/mdi"
)

Expand All @@ -17,7 +17,7 @@ func GenerateBookmarkTemplate(filter string) template.HTML {

var parseBookmarks []FlareModel.Bookmark
for _, bookmark := range bookmarksData.Items {
bookmark.URL = FlareState.ParseDynamicUrl(bookmark.URL)
bookmark.URL = FlareFn.ParseDynamicUrl(bookmark.URL)
parseBookmarks = append(parseBookmarks, bookmark)
}

Expand Down Expand Up @@ -72,7 +72,7 @@ func renderBookmarksWithoutCategories(bookmarks *[]FlareModel.Bookmark, OpenBook
templateIcon = FlareMDI.GetIconByName(bookmark.Icon)
} else {
if IconMode == "FILLING" {
templateIcon = FlareState.GetYandexFavicon(bookmark.URL, FlareMDI.GetIconByName(bookmark.Icon))
templateIcon = FlareFn.GetYandexFavicon(bookmark.URL, FlareMDI.GetIconByName(bookmark.Icon))
} else {
templateIcon = FlareMDI.GetIconByName(bookmark.Icon)
}
Expand Down Expand Up @@ -113,7 +113,7 @@ func renderBookmarksWithCategories(bookmarks *[]FlareModel.Bookmark, category *F
templateIcon = FlareMDI.GetIconByName(bookmark.Icon)
} else {
if IconMode == "FILLING" {
templateIcon = FlareState.GetYandexFavicon(bookmark.URL, FlareMDI.GetIconByName(bookmark.Icon))
templateIcon = FlareFn.GetYandexFavicon(bookmark.URL, FlareMDI.GetIconByName(bookmark.Icon))
} else {
templateIcon = FlareMDI.GetIconByName(bookmark.Icon)
}
Expand Down
7 changes: 4 additions & 3 deletions internal/pages/home/home.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
FlareModel "github.com/soulteary/flare/config/model"
FlareState "github.com/soulteary/flare/config/state"
FlareAuth "github.com/soulteary/flare/internal/auth"
FlareFn "github.com/soulteary/flare/internal/fn"
FlareWeather "github.com/soulteary/flare/internal/settings/weather"
weather "github.com/soulteary/funny-china-weather"
)
Expand Down Expand Up @@ -226,7 +227,7 @@ func getGreeting(greeting string) string {

func pageBookmark(c *gin.Context) {
options := FlareData.GetAllSettingsOptions()
FlareState.ParseRequestURL(c.Request)
FlareFn.ParseRequestURL(c.Request)

c.HTML(
http.StatusOK,
Expand Down Expand Up @@ -258,7 +259,7 @@ func pageBookmark(c *gin.Context) {

func pageApplication(c *gin.Context) {
options := FlareData.GetAllSettingsOptions()
FlareState.ParseRequestURL(c.Request)
FlareFn.ParseRequestURL(c.Request)

c.HTML(
http.StatusOK,
Expand Down Expand Up @@ -289,7 +290,7 @@ func pageApplication(c *gin.Context) {

func render(c *gin.Context, filter string) {
options := FlareData.GetAllSettingsOptions()
FlareState.ParseRequestURL(c.Request)
FlareFn.ParseRequestURL(c.Request)

hasKeyword := false
searchKeyword := " "
Expand Down

0 comments on commit 172ef79

Please sign in to comment.