Skip to content

Commit

Permalink
refactor: refactoring static assets (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
medcl authored Jan 22, 2025
1 parent cdeb07c commit 838f279
Show file tree
Hide file tree
Showing 38 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ APP_NAME := coco
APP_VERSION := 1.0.0_SNAPSHOT
APP_CONFIG := $(APP_NAME).yml
APP_EOLDate ?= "2025-12-31T10:10:10Z"
APP_STATIC_FOLDER := assets
APP_STATIC_PACKAGE := assets
APP_STATIC_FOLDER := .public
APP_STATIC_PACKAGE := public
APP_UI_FOLDER := ui
APP_PLUGIN_FOLDER := plugins
PREFER_MANAGED_VENDOR=fase
Expand Down
Binary file removed assets/connector/google_drive/audio.png
Binary file not shown.
Binary file removed assets/connector/google_drive/document.png
Binary file not shown.
Binary file removed assets/connector/google_drive/drawing.png
Binary file not shown.
Binary file removed assets/connector/google_drive/folder.png
Binary file not shown.
Binary file removed assets/connector/google_drive/form.png
Binary file not shown.
Binary file removed assets/connector/google_drive/fusiontable.png
Binary file not shown.
Binary file removed assets/connector/google_drive/icon.png
Binary file not shown.
Binary file removed assets/connector/google_drive/jam.png
Binary file not shown.
Binary file removed assets/connector/google_drive/map.png
Binary file not shown.
Binary file removed assets/connector/google_drive/ms_excel.png
Binary file not shown.
Binary file removed assets/connector/google_drive/ms_powerpoint.png
Binary file not shown.
Binary file removed assets/connector/google_drive/ms_word.png
Binary file not shown.
Binary file removed assets/connector/google_drive/pdf.png
Binary file not shown.
Binary file removed assets/connector/google_drive/photo.png
Binary file not shown.
Binary file removed assets/connector/google_drive/presentation.png
Binary file not shown.
Binary file removed assets/connector/google_drive/script.png
Binary file not shown.
Binary file removed assets/connector/google_drive/site.png
Binary file not shown.
Binary file removed assets/connector/google_drive/spreadsheet.png
Binary file not shown.
Binary file removed assets/connector/google_drive/video.png
Binary file not shown.
Binary file removed assets/connector/google_drive/zip.png
Binary file not shown.
Binary file removed assets/connector/hugo_site/blog.png
Binary file not shown.
Binary file removed assets/connector/hugo_site/icon.png
Binary file not shown.
Binary file removed assets/connector/hugo_site/news.png
Binary file not shown.
Binary file removed assets/connector/hugo_site/web.png
Binary file not shown.
Binary file removed assets/connector/hugo_site/web_page.png
Binary file not shown.
Binary file removed assets/connector/notion/database.png
Diff not rendered.
Binary file removed assets/connector/notion/icon.png
Diff not rendered.
Binary file removed assets/connector/notion/page.png
Diff not rendered.
Binary file removed assets/connector/yuque/board.png
Diff not rendered.
Binary file removed assets/connector/yuque/book.png
Diff not rendered.
Binary file removed assets/connector/yuque/directory.png
Diff not rendered.
Binary file removed assets/connector/yuque/doc.png
Diff not rendered.
Binary file removed assets/connector/yuque/folder.png
Diff not rendered.
Binary file removed assets/connector/yuque/icon.png
Diff not rendered.
Binary file removed assets/connector/yuque/sheet.png
Diff not rendered.
Binary file removed assets/connector/yuque/table.png
Diff not rendered.
13 changes: 8 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
package main

import (
"infini.sh/coco/assets"
public "infini.sh/coco/.public"
"infini.sh/coco/config"
"infini.sh/coco/modules"
_ "infini.sh/coco/modules"
_ "infini.sh/coco/plugins"
"infini.sh/framework"
api1 "infini.sh/framework/core/api"
"infini.sh/framework/core/global"
"infini.sh/framework/core/module"
"infini.sh/framework/core/vfs"
"infini.sh/framework/modules/api"
Expand Down Expand Up @@ -46,10 +47,12 @@ func main() {
app.IgnoreMainConfigMissing()
app.Init(nil)

//register vfs, eg: /assets/connector/google_drive.png
urlPath := "/assets/"
vfs.RegisterFS(assets.StaticFS{StaticFolder: "assets", TrimLeftPath: urlPath, CheckLocalFirst: true, SkipVFS: false})
api1.HandleUI(urlPath, vfs.FileServer(vfs.VFS()))
vfs.RegisterFS(public.StaticFS{StaticFolder: global.Env().SystemConfig.WebAppConfig.UI.LocalPath,
TrimLeftPath: global.Env().SystemConfig.WebAppConfig.UI.LocalPath,
CheckLocalFirst: global.Env().SystemConfig.WebAppConfig.UI.LocalEnabled,
SkipVFS: !global.Env().SystemConfig.WebAppConfig.UI.VFSEnabled})

api1.HandleUI("/", vfs.FileServer(vfs.VFS()))

defer app.Shutdown()

Expand Down

0 comments on commit 838f279

Please sign in to comment.