mirror of
https://github.com/tgdrive/teldrive.git
synced 2024-09-20 08:15:55 +08:00
Remove teldrive-ui submodule
This commit is contained in:
parent
6364f86571
commit
1829ab35a9
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
@ -22,10 +22,6 @@ jobs:
|
|||
with:
|
||||
go-version: stable
|
||||
|
||||
- uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 8
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -30,3 +30,5 @@ sslcerts
|
|||
*.db
|
||||
logs
|
||||
bin
|
||||
ui/dist
|
||||
teldrive-ui.zip
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
|||
[submodule "ui/teldrive-ui"]
|
||||
path = ui/teldrive-ui
|
||||
url = https://github.com/divyam234/teldrive-ui
|
34
Makefile
34
Makefile
|
@ -1,7 +1,7 @@
|
|||
FRONTEND_DIR := ui/teldrive-ui
|
||||
BUILD_DIR := bin
|
||||
APP_NAME := teldrive
|
||||
|
||||
BUILD_DIR := bin
|
||||
FRONTEND_DIR := ui/dist
|
||||
FRONTEND_ASSET := https://github.com/divyam234/teldrive-ui/releases/download/v1/teldrive-ui.zip
|
||||
GIT_TAG := $(shell git describe --tags --abbrev=0)
|
||||
GIT_COMMIT := $(shell git rev-parse --short HEAD)
|
||||
GIT_LINK := $(shell git remote get-url origin)
|
||||
|
@ -23,17 +23,23 @@ SHELL := /bin/bash
|
|||
BINARY_EXTENSION:=
|
||||
endif
|
||||
|
||||
frontend: $(ENV_FILE)
|
||||
@echo "Building frontend..."
|
||||
cd $(FRONTEND_DIR) ; pnpm install ; pnpm build
|
||||
|
||||
$(ENV_FILE): Makefile
|
||||
ifdef ComSpec
|
||||
@echo 'VITE_VERSION_INFO={"version": "$(GIT_TAG)", "commit": "$(GIT_COMMIT)", "link": "$(GIT_LINK)"}' | Out-File -encoding utf8 $(ENV_FILE)
|
||||
frontend:
|
||||
@echo "Extract UI"
|
||||
ifeq ($(OS),Windows_NT)
|
||||
powershell -Command "Remove-Item -Path $(FRONTEND_DIR) -Recurse -Force"
|
||||
powershell -Command "Invoke-WebRequest -Uri $(FRONTEND_ASSET) -OutFile teldrive-ui.zip"
|
||||
powershell -Command "if (!(Test-Path -Path $(subst /,\\,$(FRONTEND_DIR)))) { New-Item -ItemType Directory -Force -Path $(subst /,\\,$(FRONTEND_DIR)) }"
|
||||
powershell -Command "Expand-Archive -Path teldrive-ui.zip -DestinationPath $(FRONTEND_DIR) -Force"
|
||||
powershell -Command "Remove-Item -Path teldrive-ui.zip -Force"
|
||||
else
|
||||
@echo 'VITE_VERSION_INFO={"version": "$(GIT_TAG)", "commit": "$(GIT_COMMIT)", "link": "$(GIT_LINK)"}' > $(ENV_FILE)
|
||||
rm -rf $(FRONTEND_DIR)
|
||||
curl -LO $(FRONTEND_ASSET) -o teldrive-ui.zip
|
||||
mkdir -p $(FRONTEND_DIR)
|
||||
unzip -d $(FRONTEND_DIR) teldrive-ui.zip
|
||||
rm -rf teldrive-ui.zip
|
||||
endif
|
||||
|
||||
|
||||
backend:
|
||||
@echo "Building backend for $(GOOS)/$(GOARCH)..."
|
||||
go build -trimpath -ldflags "-s -w -X $(MODULE_PATH)/internal/config.Version=$(GIT_TAG) -extldflags=-static" -o $(BUILD_DIR)/$(APP_NAME)$(BINARY_EXTENSION)
|
||||
|
@ -54,12 +60,6 @@ deps:
|
|||
@echo "Installing Go dependencies..."
|
||||
go mod download
|
||||
|
||||
@echo "Installing frontend dependencies..."
|
||||
cd $(FRONTEND_DIR) && pnpm install
|
||||
|
||||
sync-ui:
|
||||
git submodule update --init --recursive --remote
|
||||
|
||||
retag:
|
||||
@echo "Retagging..."
|
||||
git tag -d $(GIT_TAG)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit cdd8c6a7cf04ac72164c5b212d7a13b75041b1c0
|
6
ui/ui.go
6
ui/ui.go
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
//go:embed all:teldrive-ui/dist
|
||||
//go:embed all:dist
|
||||
var staticFS embed.FS
|
||||
|
||||
func AddRoutes(router gin.IRouter) {
|
||||
|
@ -28,7 +28,7 @@ type staticFileSystem struct {
|
|||
var _ static.ServeFileSystem = (*staticFileSystem)(nil)
|
||||
|
||||
func newStaticFileSystem() *staticFileSystem {
|
||||
sub, err := fs.Sub(staticFS, "teldrive-ui/dist")
|
||||
sub, err := fs.Sub(staticFS, "dist")
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -40,7 +40,7 @@ func newStaticFileSystem() *staticFileSystem {
|
|||
}
|
||||
|
||||
func (s *staticFileSystem) Exists(prefix string, path string) bool {
|
||||
buildpath := fmt.Sprintf("teldrive-ui/dist%s", path)
|
||||
buildpath := fmt.Sprintf("dist%s", path)
|
||||
|
||||
if strings.HasSuffix(path, "/") {
|
||||
_, err := staticFS.ReadDir(strings.TrimSuffix(buildpath, "/"))
|
||||
|
|
Loading…
Reference in a new issue