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:
|
with:
|
||||||
go-version: stable
|
go-version: stable
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
version: 8
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -30,3 +30,5 @@ sslcerts
|
||||||
*.db
|
*.db
|
||||||
logs
|
logs
|
||||||
bin
|
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
|
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_TAG := $(shell git describe --tags --abbrev=0)
|
||||||
GIT_COMMIT := $(shell git rev-parse --short HEAD)
|
GIT_COMMIT := $(shell git rev-parse --short HEAD)
|
||||||
GIT_LINK := $(shell git remote get-url origin)
|
GIT_LINK := $(shell git remote get-url origin)
|
||||||
|
@ -23,17 +23,23 @@ SHELL := /bin/bash
|
||||||
BINARY_EXTENSION:=
|
BINARY_EXTENSION:=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
frontend: $(ENV_FILE)
|
frontend:
|
||||||
@echo "Building frontend..."
|
@echo "Extract UI"
|
||||||
cd $(FRONTEND_DIR) ; pnpm install ; pnpm build
|
ifeq ($(OS),Windows_NT)
|
||||||
|
powershell -Command "Remove-Item -Path $(FRONTEND_DIR) -Recurse -Force"
|
||||||
$(ENV_FILE): Makefile
|
powershell -Command "Invoke-WebRequest -Uri $(FRONTEND_ASSET) -OutFile teldrive-ui.zip"
|
||||||
ifdef ComSpec
|
powershell -Command "if (!(Test-Path -Path $(subst /,\\,$(FRONTEND_DIR)))) { New-Item -ItemType Directory -Force -Path $(subst /,\\,$(FRONTEND_DIR)) }"
|
||||||
@echo 'VITE_VERSION_INFO={"version": "$(GIT_TAG)", "commit": "$(GIT_COMMIT)", "link": "$(GIT_LINK)"}' | Out-File -encoding utf8 $(ENV_FILE)
|
powershell -Command "Expand-Archive -Path teldrive-ui.zip -DestinationPath $(FRONTEND_DIR) -Force"
|
||||||
|
powershell -Command "Remove-Item -Path teldrive-ui.zip -Force"
|
||||||
else
|
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
|
endif
|
||||||
|
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
@echo "Building backend for $(GOOS)/$(GOARCH)..."
|
@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)
|
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..."
|
@echo "Installing Go dependencies..."
|
||||||
go mod download
|
go mod download
|
||||||
|
|
||||||
@echo "Installing frontend dependencies..."
|
|
||||||
cd $(FRONTEND_DIR) && pnpm install
|
|
||||||
|
|
||||||
sync-ui:
|
|
||||||
git submodule update --init --recursive --remote
|
|
||||||
|
|
||||||
retag:
|
retag:
|
||||||
@echo "Retagging..."
|
@echo "Retagging..."
|
||||||
git tag -d $(GIT_TAG)
|
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"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed all:teldrive-ui/dist
|
//go:embed all:dist
|
||||||
var staticFS embed.FS
|
var staticFS embed.FS
|
||||||
|
|
||||||
func AddRoutes(router gin.IRouter) {
|
func AddRoutes(router gin.IRouter) {
|
||||||
|
@ -28,7 +28,7 @@ type staticFileSystem struct {
|
||||||
var _ static.ServeFileSystem = (*staticFileSystem)(nil)
|
var _ static.ServeFileSystem = (*staticFileSystem)(nil)
|
||||||
|
|
||||||
func newStaticFileSystem() *staticFileSystem {
|
func newStaticFileSystem() *staticFileSystem {
|
||||||
sub, err := fs.Sub(staticFS, "teldrive-ui/dist")
|
sub, err := fs.Sub(staticFS, "dist")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -40,7 +40,7 @@ func newStaticFileSystem() *staticFileSystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *staticFileSystem) Exists(prefix string, path string) bool {
|
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, "/") {
|
if strings.HasSuffix(path, "/") {
|
||||||
_, err := staticFS.ReadDir(strings.TrimSuffix(buildpath, "/"))
|
_, err := staticFS.ReadDir(strings.TrimSuffix(buildpath, "/"))
|
||||||
|
|
Loading…
Reference in a new issue