feat: rename to shortify

This commit is contained in:
Steven
2023-03-16 08:25:58 +08:00
parent 143bdb7596
commit d08a738a57
43 changed files with 114 additions and 116 deletions

View File

@ -5,8 +5,8 @@ import (
"net/http"
"strconv"
"github.com/boojack/corgi/api"
"github.com/boojack/corgi/common"
"github.com/boojack/shortify/api"
"github.com/boojack/shortify/common"
"github.com/gorilla/sessions"
"github.com/labstack/echo-contrib/session"
@ -15,7 +15,7 @@ import (
var (
userIDContextKey = "user-id"
sessionName = "corgi_session"
sessionName = "shortify-session"
)
func getUserIDContextKey() string {

View File

@ -5,8 +5,8 @@ import (
"fmt"
"net/http"
"github.com/boojack/corgi/api"
"github.com/boojack/corgi/common"
"github.com/boojack/shortify/api"
"github.com/boojack/shortify/common"
"github.com/labstack/echo/v4"
"golang.org/x/crypto/bcrypt"

View File

@ -1,8 +1,8 @@
package server
import (
"github.com/boojack/corgi/api"
"github.com/boojack/corgi/common"
"github.com/boojack/shortify/api"
"github.com/boojack/shortify/common"
"github.com/labstack/echo/v4"
)

View File

@ -6,7 +6,7 @@ import (
"path/filepath"
"strings"
"github.com/boojack/corgi/server/version"
"github.com/boojack/shortify/server/version"
"github.com/spf13/viper"
)
@ -18,7 +18,7 @@ type Profile struct {
Port int `json:"port"`
// Data is the data directory
Data string `json:"data"`
// DSN points to where Corgi stores its own data
// DSN points to where Shortify stores its own data
DSN string `json:"dsn"`
// Version is the current version of server
Version string `json:"version"`
@ -57,7 +57,7 @@ func GetProfile() (*Profile, error) {
}
if profile.Mode == "prod" && profile.Data == "" {
profile.Data = "/var/opt/corgi"
profile.Data = "/var/opt/shortify"
}
dataDir, err := checkDSN(profile.Data)
@ -67,7 +67,7 @@ func GetProfile() (*Profile, error) {
}
profile.Data = dataDir
profile.DSN = fmt.Sprintf("%s/corgi_%s.db", dataDir, profile.Mode)
profile.DSN = fmt.Sprintf("%s/shortify_%s.db", dataDir, profile.Mode)
profile.Version = version.GetCurrentVersion(profile.Mode)
return &profile, nil
}

View File

@ -3,7 +3,7 @@ package server
import (
"net/http"
"github.com/boojack/corgi/api"
"github.com/boojack/shortify/api"
"github.com/labstack/echo/v4"
)

View File

@ -6,9 +6,9 @@ import (
"fmt"
"time"
"github.com/boojack/corgi/server/profile"
"github.com/boojack/corgi/store"
"github.com/boojack/corgi/store/db"
"github.com/boojack/shortify/server/profile"
"github.com/boojack/shortify/store"
"github.com/boojack/shortify/store/db"
"github.com/pkg/errors"
"github.com/gorilla/securecookie"
@ -64,7 +64,7 @@ func NewServer(ctx context.Context, profile *profile.Profile) (*Server, error) {
embedFrontend(e)
// In dev mode, set the const secret key to make signin session persistence.
secret := []byte("iamcorgi")
secret := []byte("iamshortify")
if profile.Mode == "prod" {
secret = securecookie.GenerateRandomKey(16)
}

View File

@ -6,8 +6,8 @@ import (
"net/http"
"strconv"
"github.com/boojack/corgi/api"
"github.com/boojack/corgi/common"
"github.com/boojack/shortify/api"
"github.com/boojack/shortify/common"
"github.com/labstack/echo/v4"
)

View File

@ -3,7 +3,7 @@ package server
import (
"net/http"
"github.com/boojack/corgi/api"
"github.com/boojack/shortify/api"
"github.com/labstack/echo/v4"
)

View File

@ -6,8 +6,8 @@ import (
"net/http"
"strconv"
"github.com/boojack/corgi/api"
"github.com/boojack/corgi/common"
"github.com/boojack/shortify/api"
"github.com/boojack/shortify/common"
"github.com/labstack/echo/v4"
"golang.org/x/crypto/bcrypt"

View File

@ -6,8 +6,8 @@ import (
"net/http"
"strconv"
"github.com/boojack/corgi/api"
"github.com/boojack/corgi/common"
"github.com/boojack/shortify/api"
"github.com/boojack/shortify/common"
"github.com/labstack/echo/v4"
)

View File

@ -6,8 +6,8 @@ import (
"net/http"
"strconv"
"github.com/boojack/corgi/api"
"github.com/boojack/corgi/common"
"github.com/boojack/shortify/api"
"github.com/boojack/shortify/common"
"github.com/labstack/echo/v4"
)