[chore] rename package, [chore] rename vars
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
14b930781e
commit
a65750ae21
@ -17,8 +17,8 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/microcosm-cc/bluemonday"
|
"github.com/microcosm-cc/bluemonday"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"reichard.io/bbank/config"
|
"reichard.io/antholume/config"
|
||||||
"reichard.io/bbank/database"
|
"reichard.io/antholume/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
type API struct {
|
type API struct {
|
||||||
|
@ -21,33 +21,33 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
"reichard.io/bbank/database"
|
"reichard.io/antholume/database"
|
||||||
"reichard.io/bbank/metadata"
|
"reichard.io/antholume/metadata"
|
||||||
"reichard.io/bbank/search"
|
"reichard.io/antholume/search"
|
||||||
"reichard.io/bbank/utils"
|
"reichard.io/antholume/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
type AdminAction string
|
type adminAction string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AA_IMPORT AdminAction = "IMPORT"
|
adminImport adminAction = "IMPORT"
|
||||||
AA_BACKUP AdminAction = "BACKUP"
|
adminBackup adminAction = "BACKUP"
|
||||||
AA_RESTORE AdminAction = "RESTORE"
|
adminRestore adminAction = "RESTORE"
|
||||||
AA_METADATA_MATCH AdminAction = "METADATA_MATCH"
|
adminMetadataMatch adminAction = "METADATA_MATCH"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ImportType string
|
type importType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
IMPORT_TYPE_DIRECT ImportType = "DIRECT"
|
importDirect importType = "DIRECT"
|
||||||
IMPORT_TYPE_COPY ImportType = "COPY"
|
importCopy importType = "COPY"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BackupType string
|
type backupType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BACKUP_TYPE_COVERS BackupType = "COVERS"
|
backupCovers backupType = "COVERS"
|
||||||
BACKUP_TYPE_DOCUMENTS BackupType = "DOCUMENTS"
|
backupDocuments backupType = "DOCUMENTS"
|
||||||
)
|
)
|
||||||
|
|
||||||
type queryParams struct {
|
type queryParams struct {
|
||||||
@ -78,14 +78,14 @@ type requestDocumentEdit struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type requestAdminAction struct {
|
type requestAdminAction struct {
|
||||||
Action AdminAction `form:"action"`
|
Action adminAction `form:"action"`
|
||||||
|
|
||||||
// Import Action
|
// Import Action
|
||||||
ImportDirectory *string `form:"import_directory"`
|
ImportDirectory *string `form:"import_directory"`
|
||||||
ImportType *ImportType `form:"import_type"`
|
ImportType *importType `form:"import_type"`
|
||||||
|
|
||||||
// Backup Action
|
// Backup Action
|
||||||
BackupTypes []BackupType `form:"backup_types"`
|
BackupTypes []backupType `form:"backup_types"`
|
||||||
|
|
||||||
// Restore Action
|
// Restore Action
|
||||||
RestoreFile *multipart.FileHeader `form:"restore_file"`
|
RestoreFile *multipart.FileHeader `form:"restore_file"`
|
||||||
@ -320,7 +320,6 @@ func (api *API) appGetSettings(c *gin.Context) {
|
|||||||
|
|
||||||
func (api *API) appGetAdmin(c *gin.Context) {
|
func (api *API) appGetAdmin(c *gin.Context) {
|
||||||
templateVars := api.getBaseTemplateVars("admin", c)
|
templateVars := api.getBaseTemplateVars("admin", c)
|
||||||
|
|
||||||
c.HTML(http.StatusOK, "page/admin", templateVars)
|
c.HTML(http.StatusOK, "page/admin", templateVars)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,19 +354,19 @@ func (api *API) appPerformAdminAction(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch rAdminAction.Action {
|
switch rAdminAction.Action {
|
||||||
case AA_IMPORT:
|
case adminImport:
|
||||||
// TODO
|
// TODO
|
||||||
case AA_METADATA_MATCH:
|
case adminMetadataMatch:
|
||||||
// TODO
|
// TODO
|
||||||
// 1. Documents xref most recent metadata table?
|
// 1. Documents xref most recent metadata table?
|
||||||
// 2. Select all / deselect?
|
// 2. Select all / deselect?
|
||||||
case AA_RESTORE:
|
case adminRestore:
|
||||||
// TODO
|
// TODO
|
||||||
// 1. Consume backup ZIP
|
// 1. Consume backup ZIP
|
||||||
// 2. Move existing to "backup" folder (db, wal, shm, covers, documents)
|
// 2. Move existing to "backup" folder (db, wal, shm, covers, documents)
|
||||||
// 3. Extract backup zip
|
// 3. Extract backup zip
|
||||||
// 4. Restart server?
|
// 4. Restart server?
|
||||||
case AA_BACKUP:
|
case adminBackup:
|
||||||
// Get File Paths
|
// Get File Paths
|
||||||
fileName := fmt.Sprintf("%s.db", api.Config.DBName)
|
fileName := fmt.Sprintf("%s.db", api.Config.DBName)
|
||||||
dbLocation := path.Join(api.Config.ConfigPath, fileName)
|
dbLocation := path.Join(api.Config.ConfigPath, fileName)
|
||||||
@ -420,10 +419,10 @@ func (api *API) appPerformAdminAction(c *gin.Context) {
|
|||||||
|
|
||||||
// Backup Covers & Documents
|
// Backup Covers & Documents
|
||||||
for _, item := range rAdminAction.BackupTypes {
|
for _, item := range rAdminAction.BackupTypes {
|
||||||
if item == BACKUP_TYPE_COVERS {
|
if item == backupCovers {
|
||||||
filepath.WalkDir(path.Join(api.Config.DataPath, "covers"), exportWalker)
|
filepath.WalkDir(path.Join(api.Config.DataPath, "covers"), exportWalker)
|
||||||
|
|
||||||
} else if item == BACKUP_TYPE_DOCUMENTS {
|
} else if item == backupDocuments {
|
||||||
filepath.WalkDir(path.Join(api.Config.DataPath, "documents"), exportWalker)
|
filepath.WalkDir(path.Join(api.Config.DataPath, "documents"), exportWalker)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"reichard.io/bbank/database"
|
"reichard.io/antholume/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Authorization Data
|
// Authorization Data
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reichard.io/bbank/database"
|
"reichard.io/antholume/database"
|
||||||
"reichard.io/bbank/metadata"
|
"reichard.io/antholume/metadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (api *API) downloadDocument(c *gin.Context) {
|
func (api *API) downloadDocument(c *gin.Context) {
|
||||||
|
@ -18,8 +18,8 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"golang.org/x/exp/slices"
|
"golang.org/x/exp/slices"
|
||||||
"reichard.io/bbank/database"
|
"reichard.io/antholume/database"
|
||||||
"reichard.io/bbank/metadata"
|
"reichard.io/antholume/metadata"
|
||||||
)
|
)
|
||||||
|
|
||||||
type activityItem struct {
|
type activityItem struct {
|
||||||
@ -173,11 +173,11 @@ func (api *API) koSetProgress(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update Statistic
|
// Update Statistic
|
||||||
log.Info("[koSetProgress] UpdateDocumentUserStatistic Running...")
|
start := time.Now()
|
||||||
if err := api.DB.UpdateDocumentUserStatistic(rPosition.DocumentID, auth.UserName); err != nil {
|
if err := api.DB.UpdateDocumentUserStatistic(rPosition.DocumentID, auth.UserName); err != nil {
|
||||||
log.Error("[koSetProgress] UpdateDocumentUserStatistic Error:", err)
|
log.Error("[koSetProgress] UpdateDocumentUserStatistic Error:", err)
|
||||||
}
|
}
|
||||||
log.Info("[koSetProgress] UpdateDocumentUserStatistic Complete")
|
log.Debug("[koSetProgress] UpdateDocumentUserStatistic Performance: ", time.Since(start))
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"document": progress.DocumentID,
|
"document": progress.DocumentID,
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"reichard.io/bbank/database"
|
"reichard.io/antholume/database"
|
||||||
"reichard.io/bbank/opds"
|
"reichard.io/antholume/opds"
|
||||||
)
|
)
|
||||||
|
|
||||||
var mimeMapping map[string]string = map[string]string{
|
var mimeMapping map[string]string = map[string]string{
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"reichard.io/bbank/database"
|
"reichard.io/antholume/database"
|
||||||
"reichard.io/bbank/graph"
|
"reichard.io/antholume/graph"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UTCOffset struct {
|
type UTCOffset struct {
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
_ "modernc.org/sqlite"
|
_ "modernc.org/sqlite"
|
||||||
"path"
|
"path"
|
||||||
"reichard.io/bbank/config"
|
"reichard.io/antholume/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DBManager struct {
|
type DBManager struct {
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"reichard.io/bbank/config"
|
"reichard.io/antholume/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type databaseTest struct {
|
type databaseTest struct {
|
||||||
|
6
go.mod
6
go.mod
@ -1,4 +1,4 @@
|
|||||||
module reichard.io/bbank
|
module reichard.io/antholume
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
@ -11,10 +11,10 @@ require (
|
|||||||
github.com/gin-gonic/gin v1.9.1
|
github.com/gin-gonic/gin v1.9.1
|
||||||
github.com/microcosm-cc/bluemonday v1.0.25
|
github.com/microcosm-cc/bluemonday v1.0.25
|
||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.3
|
||||||
|
github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d
|
||||||
github.com/taylorskalyo/goreader v0.0.0-20230626212555-e7f5644f8115
|
github.com/taylorskalyo/goreader v0.0.0-20230626212555-e7f5644f8115
|
||||||
github.com/urfave/cli/v2 v2.25.7
|
github.com/urfave/cli/v2 v2.25.7
|
||||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
|
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
|
||||||
golang.org/x/net v0.15.0
|
|
||||||
modernc.org/sqlite v1.26.0
|
modernc.org/sqlite v1.26.0
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,13 +47,13 @@ require (
|
|||||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||||
github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d // indirect
|
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
|
||||||
golang.org/x/arch v0.4.0 // indirect
|
golang.org/x/arch v0.4.0 // indirect
|
||||||
golang.org/x/crypto v0.13.0 // indirect
|
golang.org/x/crypto v0.13.0 // indirect
|
||||||
golang.org/x/mod v0.12.0 // indirect
|
golang.org/x/mod v0.12.0 // indirect
|
||||||
|
golang.org/x/net v0.15.0 // indirect
|
||||||
golang.org/x/sys v0.12.0 // indirect
|
golang.org/x/sys v0.12.0 // indirect
|
||||||
golang.org/x/text v0.13.0 // indirect
|
golang.org/x/text v0.13.0 // indirect
|
||||||
golang.org/x/tools v0.13.0 // indirect
|
golang.org/x/tools v0.13.0 // indirect
|
||||||
|
2
main.go
2
main.go
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"reichard.io/bbank/server"
|
"reichard.io/antholume/server"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed templates/* assets/*
|
//go:embed templates/* assets/*
|
||||||
|
@ -11,9 +11,9 @@ import (
|
|||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"reichard.io/bbank/api"
|
"reichard.io/antholume/api"
|
||||||
"reichard.io/bbank/config"
|
"reichard.io/antholume/config"
|
||||||
"reichard.io/bbank/database"
|
"reichard.io/antholume/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user