Skip to content

Commit

Permalink
feat(release): release v0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cg33 committed Jul 29, 2020
1 parent 8e150ba commit 421f45b
Show file tree
Hide file tree
Showing 23 changed files with 86 additions and 56 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ GOCMD = go
all: fmt

fmt:
GO111MODULE=off $(GOCMD) fmt ./...
GO111MODULE=off go fmt ./...
GO111MODULE=off goimports -l -w .

test:
gotest -v ./tests
20 changes: 14 additions & 6 deletions controller/common.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package controller

import (
template2 "html/template"
"net/url"
"path/filepath"
"strings"
"time"

"github.com/GoAdminGroup/filemanager/models"
"github.com/GoAdminGroup/filemanager/modules/constant"
"github.com/GoAdminGroup/filemanager/modules/language"
Expand All @@ -9,25 +15,23 @@ import (
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"github.com/GoAdminGroup/go-admin/modules/config"
"github.com/GoAdminGroup/go-admin/modules/menu"
"github.com/GoAdminGroup/go-admin/plugins"
"github.com/GoAdminGroup/go-admin/plugins/admin/modules/paginator"
"github.com/GoAdminGroup/go-admin/plugins/admin/modules/parameter"
"github.com/GoAdminGroup/go-admin/template"
"github.com/GoAdminGroup/go-admin/template/icon"
"github.com/GoAdminGroup/go-admin/template/types"
"github.com/GoAdminGroup/go-admin/template/types/action"
"github.com/GoAdminGroup/html"
template2 "html/template"
"net/url"
"path/filepath"
"strings"
"time"
)

type Handler struct {
roots root.Roots
permissions permission.Permission

HTML func(ctx *context.Context, panel types.Panel, animation ...bool)
HTML func(ctx *context.Context, panel types.Panel, options ...plugins.HTMLOptions)
HTMLMenu func(ctx *context.Context, panel types.Panel, options ...plugins.HTMLOptions)
}

func NewHandler(root root.Roots, p permission.Permission) *Handler {
Expand Down Expand Up @@ -106,6 +110,10 @@ func (h *Handler) table(ctx *context.Context, files models.Files, err error) {
h.HTML(ctx, h.tablePanel(ctx, files, err), false)
}

func (h *Handler) tableMenu(ctx *context.Context, menu *menu.Menu, files models.Files, err error) {
h.HTMLMenu(ctx, h.tablePanel(ctx, files, err), menu, false)
}

func link(u string, c template2.HTML, pjax bool) template2.HTML {
if pjax {
return template.Default().Link().SetURL(u).SetContent(c).GetContent()
Expand Down
5 changes: 3 additions & 2 deletions controller/delete.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package controller

import (
"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/go-admin/context"
"net/http"
"os"
"path/filepath"

"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/go-admin/context"
)

func (h *Handler) Delete(ctx *context.Context) {
Expand Down
7 changes: 4 additions & 3 deletions controller/download.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package controller

import (
"net/url"
"path/filepath"
"strings"

"github.com/GoAdminGroup/filemanager/models"
errors "github.com/GoAdminGroup/filemanager/modules/error"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"net/url"
"path/filepath"
"strings"
)

func (h *Handler) Download(ctx *context.Context) {
Expand Down
11 changes: 6 additions & 5 deletions controller/files.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package controller

import (
"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/models"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"io/ioutil"
"mime"
"path/filepath"
"strings"

"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/models"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
)

func (h *Handler) ListFiles(ctx *context.Context) {
Expand Down Expand Up @@ -49,6 +50,6 @@ func (h *Handler) ListFiles(ctx *context.Context) {
filesOfDir = append(filesOfDir, file)
}

h.table(ctx, filesOfDir, nil)
h.tableMenu(ctx, filesOfDir, nil)
return
}
9 changes: 5 additions & 4 deletions controller/move.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package controller

import (
"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/modules/language"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"io/ioutil"
"net/http"
"net/url"
"os"
"path/filepath"

"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/modules/language"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
)

func (h *Handler) Move(ctx *context.Context) {
Expand Down
7 changes: 4 additions & 3 deletions controller/rename.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package controller

import (
"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/modules/language"
"github.com/GoAdminGroup/go-admin/context"
"net/http"
"os"
"path/filepath"

"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/modules/language"
"github.com/GoAdminGroup/go-admin/context"
)

func (h *Handler) Rename(ctx *context.Context) {
Expand Down
9 changes: 5 additions & 4 deletions controller/upload.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package controller

import (
"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/modules/language"
"github.com/GoAdminGroup/go-admin/context"
"github.com/GoAdminGroup/go-admin/modules/file"
"net/http"
"net/url"
"os"
"path/filepath"

"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/modules/language"
"github.com/GoAdminGroup/go-admin/context"
"github.com/GoAdminGroup/go-admin/modules/file"
)

func (h *Handler) Upload(ctx *context.Context) {
Expand Down
3 changes: 2 additions & 1 deletion example/code/golang/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package main

import (
"github.com/GoAdminGroup/filemanager/modules/root"
"log"
"os"
"os/signal"

"github.com/GoAdminGroup/filemanager/modules/root"

_ "github.com/GoAdminGroup/go-admin/adapter/gin"
_ "github.com/GoAdminGroup/go-admin/modules/db/drivers/sqlite"
_ "github.com/GoAdminGroup/themes/sword"
Expand Down
16 changes: 9 additions & 7 deletions filemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ package filemanager

import (
"encoding/json"
"strings"
"time"

"github.com/GoAdminGroup/filemanager/controller"
"github.com/GoAdminGroup/filemanager/guard"
"github.com/GoAdminGroup/filemanager/modules/error"
errors "github.com/GoAdminGroup/filemanager/modules/error"
language2 "github.com/GoAdminGroup/filemanager/modules/language"
"github.com/GoAdminGroup/filemanager/modules/permission"
"github.com/GoAdminGroup/filemanager/modules/root"
Expand All @@ -21,8 +24,6 @@ import (
"github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"
"github.com/GoAdminGroup/go-admin/template/types"
"github.com/GoAdminGroup/go-admin/template/types/form"
"strings"
"time"
)

type FileManager struct {
Expand Down Expand Up @@ -167,6 +168,7 @@ func (f *FileManager) InitPlugin(srv service.List) {
f.guard = guard.New(f.roots, f.Conn, p)
f.App = f.initRouter(srv)
f.handler.HTML = f.HTML
f.handler.HTMLMenu = f.HTMLMenu

language.Lang[language.CN].Combine(language2.CN)
language.Lang[language.EN].Combine(language2.EN)
Expand All @@ -179,13 +181,13 @@ func (f *FileManager) GetInfo() plugins.Info {
Website: "https://www.go-admin.cn",
Title: "FileManager",
Description: "A plugin help you manage files in your server",
Version: "v0.0.1",
Version: "v0.0.3",
Author: "Official",
Url: "https://github.com/GoAdminGroup/filemanager/archive/master.zip",
Url: "https://github.com/GoAdminGroup/filemanager/archive/v0.0.3.zip",
Cover: "",
Agreement: "",
CreatedAt: utils.ParseTime("2020-04-05 00:00:00"),
UpdatedAt: utils.ParseTime("2020-06-28 00:00:00"),
CreateDate: utils.ParseTime("2020-04-05"),
UpdateDate: utils.ParseTime("2020-07-29"),
}
}

Expand Down
5 changes: 3 additions & 2 deletions guard/delete.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package guard

import (
"path/filepath"
"strings"

errors "github.com/GoAdminGroup/filemanager/modules/error"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"path/filepath"
"strings"
)

type DeleteParam struct {
Expand Down
7 changes: 4 additions & 3 deletions guard/guard.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package guard

import (
"net/url"
"path/filepath"
"strings"

"github.com/GoAdminGroup/filemanager/modules/constant"
errors "github.com/GoAdminGroup/filemanager/modules/error"
"github.com/GoAdminGroup/filemanager/modules/permission"
"github.com/GoAdminGroup/filemanager/modules/root"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"github.com/GoAdminGroup/go-admin/modules/db"
"net/url"
"path/filepath"
"strings"
)

type Guardian struct {
Expand Down
3 changes: 2 additions & 1 deletion guard/move.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package guard

import (
"path/filepath"

errors "github.com/GoAdminGroup/filemanager/modules/error"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"path/filepath"
)

type MoveParam struct {
Expand Down
3 changes: 2 additions & 1 deletion guard/rename.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package guard

import (
"path/filepath"

errors "github.com/GoAdminGroup/filemanager/modules/error"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"path/filepath"
)

type RenameParam struct {
Expand Down
7 changes: 4 additions & 3 deletions guard/upload.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package guard

import (
"mime/multipart"
"path/filepath"
"strings"

"github.com/GoAdminGroup/filemanager/modules/constant"
errors "github.com/GoAdminGroup/filemanager/modules/error"
"github.com/GoAdminGroup/filemanager/modules/util"
"github.com/GoAdminGroup/go-admin/context"
"mime/multipart"
"path/filepath"
"strings"
)

type UploadParam struct {
Expand Down
1 change: 1 addition & 0 deletions modules/error/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package errors

import (
"errors"

"github.com/GoAdminGroup/filemanager/modules/language"
)

Expand Down
3 changes: 2 additions & 1 deletion modules/language/language.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package language

import (
"github.com/GoAdminGroup/go-admin/modules/language"
"html/template"

"github.com/GoAdminGroup/go-admin/modules/language"
)

func Get(key string) string {
Expand Down
2 changes: 1 addition & 1 deletion modules/root/root.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package root

import (
"github.com/GoAdminGroup/filemanager/modules/error"
errors "github.com/GoAdminGroup/filemanager/modules/error"
"github.com/GoAdminGroup/go-admin/context"
)

Expand Down
3 changes: 2 additions & 1 deletion modules/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package util

import (
"fmt"
"golang.org/x/tools/godoc/util"
"io"
"mime"
"mime/multipart"
"os"
"path/filepath"
"strings"

"golang.org/x/tools/godoc/util"
)

func FileExist(path string) bool {
Expand Down
3 changes: 2 additions & 1 deletion previewer/code.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package previewer

import (
"github.com/GoAdminGroup/html"
"html/template"

"github.com/GoAdminGroup/html"
)

type Code struct {
Expand Down
3 changes: 2 additions & 1 deletion previewer/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package previewer

import (
"encoding/base64"
"html/template"

template2 "github.com/GoAdminGroup/go-admin/template"
"github.com/GoAdminGroup/html"
"github.com/h2non/filetype"
"html/template"
)

type Image struct{}
Expand Down
Loading

0 comments on commit 421f45b

Please sign in to comment.