diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 52dfdab..031a7fc 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -5,7 +5,7 @@ body: - type: markdown attributes: value: | - Thanks for taking the time to suggest an idea for Corgi! + Thanks for taking the time to suggest an idea for Shortify! - type: textarea attributes: label: Is your feature request related to a problem? diff --git a/.github/workflows/build-and-push-release-image.yml b/.github/workflows/build-and-push-release-image.yml index 6af2af8..6a8a456 100644 --- a/.github/workflows/build-and-push-release-image.yml +++ b/.github/workflows/build-and-push-release-image.yml @@ -33,12 +33,13 @@ jobs: with: install: true - - name: Build and Push - id: docker_build - uses: docker/build-push-action@v3 - with: - context: ./ - file: ./Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: stevenlgtm/corgi:${{ env.VERSION }} + # TODO(steven) + # - name: Build and Push + # id: docker_build + # uses: docker/build-push-action@v3 + # with: + # context: ./ + # file: ./Dockerfile + # platforms: linux/amd64,linux/arm64 + # push: true + # tags: stevenlgtm/shortify:${{ env.VERSION }} diff --git a/.github/workflows/build-and-push-test-image.yml b/.github/workflows/build-and-push-test-image.yml index 658ffcb..80af484 100644 --- a/.github/workflows/build-and-push-test-image.yml +++ b/.github/workflows/build-and-push-test-image.yml @@ -26,12 +26,13 @@ jobs: install: true version: v0.9.1 - - name: Build and Push - id: docker_build - uses: docker/build-push-action@v3 - with: - context: ./ - file: ./Dockerfile - platforms: linux/amd64 - push: true - tags: stevenlgtm/corgi:test + # TODO(steven) + # - name: Build and Push + # id: docker_build + # uses: docker/build-push-action@v3 + # with: + # context: ./ + # file: ./Dockerfile + # platforms: linux/amd64 + # push: true + # tags: stevenlgtm/corgi:test diff --git a/Dockerfile b/Dockerfile index db93d64..8f96da1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,15 +15,15 @@ RUN apk update && apk add --no-cache gcc musl-dev COPY . . COPY --from=frontend /frontend-build/dist ./server/dist -RUN go build -o corgi ./main.go +RUN go build -o shortify ./main.go # Make workspace with above generated files. FROM alpine:3.16 AS monolithic -WORKDIR /usr/local/corgi +WORKDIR /usr/local/shortify -COPY --from=backend /backend-build/corgi /usr/local/corgi/ +COPY --from=backend /backend-build/shortify /usr/local/shortify/ # Directory to store the data, which can be referenced as the mounting point. -RUN mkdir -p /var/opt/corgi +RUN mkdir -p /var/opt/shortify -ENTRYPOINT ["./corgi", "--mode", "prod", "--port", "5231"] +ENTRYPOINT ["./shortify", "--mode", "prod", "--port", "5231"] diff --git a/README.md b/README.md index 234d677..ca94e98 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,11 @@ -# Corgi +# Shortify -corgi logo +logo -Corgi is a URL shortening and bookmarking service that helps users to shorten long links into short and manageable ones. This service is designed to simplify the sharing of links on blogs, social media, and other platforms. +Shortify is a URL shortening and bookmarking service that helps users to shorten long links into short and manageable ones. This service is designed to simplify the sharing of links on blogs, social media, and other platforms. ## Demo > The project is under development and your contributions and feedback are welcome. ![demo](./resources/demo.gif) - ---- - -Thanks to Andrei for the [Corgi Avatar](https://www.artstation.com/artwork/bK6gqn) artwork! diff --git a/api/system.go b/api/system.go index cf384fb..6b7c3e6 100644 --- a/api/system.go +++ b/api/system.go @@ -1,6 +1,6 @@ package api -import "github.com/boojack/corgi/server/profile" +import "github.com/boojack/shortify/server/profile" type SystemStatus struct { Profile *profile.Profile `json:"profile"` diff --git a/api/user.go b/api/user.go index 445a4f4..ef8acbd 100644 --- a/api/user.go +++ b/api/user.go @@ -3,7 +3,7 @@ package api import ( "fmt" - "github.com/boojack/corgi/common" + "github.com/boojack/shortify/common" ) type User struct { diff --git a/cmd/server.go b/cmd/server.go index a3bd375..ef068f2 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -11,18 +11,18 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/boojack/corgi/server" - _profile "github.com/boojack/corgi/server/profile" + "github.com/boojack/shortify/server" + _profile "github.com/boojack/shortify/server/profile" ) const ( greetingBanner = ` -██████╗ ██████╗ ██████╗ ██████╗ ██╗ -██╔════╝ ██╔═══██╗██╔══██╗██╔════╝ ██║ -██║ ███╗██║ ██║██████╔╝██║ ███╗██║ -██║ ██║██║ ██║██╔══██╗██║ ██║██║ -╚██████╔╝╚██████╔╝██║ ██║╚██████╔╝██║ - ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ +███████╗██╗ ██╗ ██████╗ ██████╗ ████████╗██╗███████╗██╗ ██╗ +██╔════╝██║ ██║██╔═══██╗██╔══██╗╚══██╔══╝██║██╔════╝╚██╗ ██╔╝ +███████╗███████║██║ ██║██████╔╝ ██║ ██║█████╗ ╚████╔╝ +╚════██║██╔══██║██║ ██║██╔══██╗ ██║ ██║██╔══╝ ╚██╔╝ +███████║██║ ██║╚██████╔╝██║ ██║ ██║ ██║██║ ██║ +╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ` ) @@ -33,7 +33,7 @@ var ( data string rootCmd = &cobra.Command{ - Use: "corgi", + Use: "shortify", Short: "", Run: func(_cmd *cobra.Command, _args []string) { ctx, cancel := context.WithCancel(context.Background()) @@ -97,7 +97,7 @@ func init() { viper.SetDefault("mode", "dev") viper.SetDefault("port", 8082) - viper.SetEnvPrefix("corgi") + viper.SetEnvPrefix("shortify") } func initConfig() { diff --git a/extension/background.js b/extension/background.js index 10510f8..ed96bf9 100644 --- a/extension/background.js +++ b/extension/background.js @@ -1,4 +1,4 @@ -import { getCorgiData } from "./common.js"; +import { getShortifyData } from "./common.js"; const urlRegex = /https?:\/\/o\/(.+)/; @@ -6,16 +6,16 @@ chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => { if (typeof tab.url === "string") { const matchResult = urlRegex.exec(tab.url); if (matchResult) { - const corgiData = await getCorgiData(); + const shortifyData = await getShortifyData(); const name = matchResult[1]; - const url = `${corgiData.domain}/api/shortcut?openId=${corgiData.openId}&name=${name}&redirect=true`; + const url = `${shortifyData.domain}/api/shortcut?openId=${shortifyData.openId}&name=${name}&redirect=true`; return chrome.tabs.update({ url }); } } }); chrome.omnibox.onInputEntered.addListener(async (text) => { - const corgiData = await getCorgiData(); - const url = `${corgiData.domain}/api/shortcut?openId=${corgiData.openId}&name=${text}&redirect=true`; + const shortifyData = await getShortifyData(); + const url = `${shortifyData.domain}/api/shortcut?openId=${shortifyData.openId}&name=${text}&redirect=true`; return chrome.tabs.update({ url }); }); diff --git a/extension/common.js b/extension/common.js index 733d9b7..124a240 100644 --- a/extension/common.js +++ b/extension/common.js @@ -1,10 +1,10 @@ -export const getCorgiData = () => { +export const getShortifyData = () => { return new Promise((resolve, reject) => { - chrome.storage.local.get(["corgi"], (data) => { - if (data?.corgi) { - resolve(data.corgi); + chrome.storage.local.get(["shortify"], (data) => { + if (data?.shortify) { + resolve(data.shortify); } else { - reject("corgi data not found"); + reject("shortify data not found"); } }); }); diff --git a/extension/manifest.json b/extension/manifest.json index a28a7a1..49a8e6d 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,6 +1,6 @@ { - "name": "Corgi", - "description": "Corgi is an URL manager.", + "name": "Shortify", + "description": "", "version": "0.0.1", "manifest_version": 3, "omnibox": { diff --git a/extension/popup.html b/extension/popup.html index fe5a37f..38071c1 100644 --- a/extension/popup.html +++ b/extension/popup.html @@ -1,7 +1,7 @@ -

Corgi extension

+

Shortify extension

Domain diff --git a/extension/popup.js b/extension/popup.js index f972016..5e6e337 100644 --- a/extension/popup.js +++ b/extension/popup.js @@ -1,4 +1,4 @@ -import { getCorgiData } from "./common.js"; +import { getShortifyData } from "./common.js"; const saveButton = document.body.querySelector("#save-button"); const domainInput = document.body.querySelector("#domain-input"); @@ -6,7 +6,7 @@ const openIdInput = document.body.querySelector("#openid-input"); saveButton.addEventListener("click", () => { chrome.storage.local.set({ - corgi: { + shortify: { domain: domainInput.value, openId: openIdInput.value, }, @@ -14,9 +14,9 @@ saveButton.addEventListener("click", () => { }); (async () => { - const corgiData = await getCorgiData(); - if (corgiData) { - domainInput.value = corgiData.domain; - openIdInput.value = corgiData.openId; + const shortifyData = await getShortifyData(); + if (shortifyData) { + domainInput.value = shortifyData.domain; + openIdInput.value = shortifyData.openId; } })(); diff --git a/go.mod b/go.mod index b978314..9132f8f 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/boojack/corgi +module github.com/boojack/shortify go 1.19 diff --git a/main.go b/main.go index a5af25b..5cdd537 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,7 @@ package main import ( _ "github.com/mattn/go-sqlite3" - "github.com/boojack/corgi/cmd" + "github.com/boojack/shortify/cmd" ) func main() { diff --git a/resources/corgi-logo.png b/resources/logo.png similarity index 100% rename from resources/corgi-logo.png rename to resources/logo.png diff --git a/scripts/.air.toml b/scripts/.air.toml index d11457f..5623916 100644 --- a/scripts/.air.toml +++ b/scripts/.air.toml @@ -2,8 +2,8 @@ root = "." tmp_dir = ".air" [build] - bin = "./.air/corgi" - cmd = "go build -o ./.air/corgi ./main.go" + bin = "./.air/shortify" + cmd = "go build -o ./.air/shortify ./main.go" delay = 1000 exclude_dir = [".air", "web", "build"] exclude_file = [] diff --git a/scripts/build.sh b/scripts/build.sh index dd1fb1a..b7f5b61 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -8,6 +8,6 @@ cd "$(dirname "$0")/../" echo "Start building backend..." -go build -o ./build/corgi ./main.go +go build -o ./build/shortify ./main.go echo "Backend built!" diff --git a/server/acl.go b/server/acl.go index 4356ffb..dd63e16 100644 --- a/server/acl.go +++ b/server/acl.go @@ -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 { diff --git a/server/auth.go b/server/auth.go index 651309a..0f84d7f 100644 --- a/server/auth.go +++ b/server/auth.go @@ -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" diff --git a/server/common.go b/server/common.go index d0428b5..77cfe40 100644 --- a/server/common.go +++ b/server/common.go @@ -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" ) diff --git a/server/profile/profile.go b/server/profile/profile.go index 048add4..ba9b352 100644 --- a/server/profile/profile.go +++ b/server/profile/profile.go @@ -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 } diff --git a/server/redirect.go b/server/redirect.go index 2dd01e0..dcc555c 100644 --- a/server/redirect.go +++ b/server/redirect.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/boojack/corgi/api" + "github.com/boojack/shortify/api" "github.com/labstack/echo/v4" ) diff --git a/server/server.go b/server/server.go index 86c56ec..5d85684 100644 --- a/server/server.go +++ b/server/server.go @@ -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) } diff --git a/server/shortcut.go b/server/shortcut.go index a4c134b..5e27615 100644 --- a/server/shortcut.go +++ b/server/shortcut.go @@ -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" ) diff --git a/server/system.go b/server/system.go index 92ea60a..dd64a5a 100644 --- a/server/system.go +++ b/server/system.go @@ -3,7 +3,7 @@ package server import ( "net/http" - "github.com/boojack/corgi/api" + "github.com/boojack/shortify/api" "github.com/labstack/echo/v4" ) diff --git a/server/user.go b/server/user.go index 9152467..aaa3188 100644 --- a/server/user.go +++ b/server/user.go @@ -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" diff --git a/server/workspace.go b/server/workspace.go index 73107ba..f216689 100644 --- a/server/workspace.go +++ b/server/workspace.go @@ -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" ) diff --git a/server/workspace_user.go b/server/workspace_user.go index 92fea86..3fe9dd9 100644 --- a/server/workspace_user.go +++ b/server/workspace_user.go @@ -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" ) diff --git a/store/db/db.go b/store/db/db.go index fe65b79..c36b5a0 100644 --- a/store/db/db.go +++ b/store/db/db.go @@ -12,8 +12,8 @@ import ( "sort" "time" - "github.com/boojack/corgi/server/profile" - "github.com/boojack/corgi/server/version" + "github.com/boojack/shortify/server/profile" + "github.com/boojack/shortify/server/version" ) //go:embed migration @@ -87,7 +87,7 @@ func (db *DB) Open(ctx context.Context) (err error) { if err != nil { return fmt.Errorf("failed to read raw database file, err: %w", err) } - backupDBFilePath := fmt.Sprintf("%s/corgi_%s_%d_backup.db", db.profile.Data, db.profile.Version, time.Now().Unix()) + backupDBFilePath := fmt.Sprintf("%s/shortify_%s_%d_backup.db", db.profile.Data, db.profile.Version, time.Now().Unix()) if err := os.WriteFile(backupDBFilePath, rawBytes, 0644); err != nil { return fmt.Errorf("failed to write raw database file, err: %w", err) } diff --git a/store/db/seed/10001__user.sql b/store/db/seed/10001__user.sql index 88acf6c..3c09db7 100644 --- a/store/db/seed/10001__user.sql +++ b/store/db/seed/10001__user.sql @@ -9,7 +9,7 @@ INSERT INTO VALUES ( 101, - 'frank@iamcorgi.com', + 'frank@shortify.demo', 'Frank', -- raw password: secret '$2a$14$ajq8Q7fbtFRQvXpdCq7Jcuy.Rx1h/L4J60Otx.gyNLbAYctGMJ9tK', @@ -27,7 +27,7 @@ INSERT INTO VALUES ( 102, - 'bob@iamcorgi.com', + 'bob@shortify.demo', 'Bob', -- raw password: secret '$2a$14$ajq8Q7fbtFRQvXpdCq7Jcuy.Rx1h/L4J60Otx.gyNLbAYctGMJ9tK', diff --git a/store/shortcut.go b/store/shortcut.go index 8443366..c731499 100644 --- a/store/shortcut.go +++ b/store/shortcut.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - "github.com/boojack/corgi/api" - "github.com/boojack/corgi/common" + "github.com/boojack/shortify/api" + "github.com/boojack/shortify/common" ) // shortcutRaw is the store model for an Shortcut. diff --git a/store/store.go b/store/store.go index a46e22b..058bcf2 100644 --- a/store/store.go +++ b/store/store.go @@ -4,7 +4,7 @@ import ( "database/sql" "sync" - "github.com/boojack/corgi/server/profile" + "github.com/boojack/shortify/server/profile" ) // Store provides database access to all raw objects. diff --git a/store/user.go b/store/user.go index c2e6b2c..1c465c4 100644 --- a/store/user.go +++ b/store/user.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - "github.com/boojack/corgi/api" - "github.com/boojack/corgi/common" + "github.com/boojack/shortify/api" + "github.com/boojack/shortify/common" ) // userRaw is the store model for an User. diff --git a/store/user_setting.go b/store/user_setting.go index 1aa5db1..b243977 100644 --- a/store/user_setting.go +++ b/store/user_setting.go @@ -5,7 +5,7 @@ import ( "database/sql" "strings" - "github.com/boojack/corgi/api" + "github.com/boojack/shortify/api" ) type userSettingRaw struct { diff --git a/store/workspace.go b/store/workspace.go index d64eabd..8d77af1 100644 --- a/store/workspace.go +++ b/store/workspace.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - "github.com/boojack/corgi/api" - "github.com/boojack/corgi/common" + "github.com/boojack/shortify/api" + "github.com/boojack/shortify/common" ) // workspaceRaw is the store model for Workspace. diff --git a/store/workspace_user.go b/store/workspace_user.go index e005645..7f56647 100644 --- a/store/workspace_user.go +++ b/store/workspace_user.go @@ -6,8 +6,8 @@ import ( "fmt" "strings" - "github.com/boojack/corgi/api" - "github.com/boojack/corgi/common" + "github.com/boojack/shortify/api" + "github.com/boojack/shortify/common" ) // workspaceUserRaw is the store model for WorkspaceUser. diff --git a/web/README.md b/web/README.md index 4851d15..f1a273e 100644 --- a/web/README.md +++ b/web/README.md @@ -1 +1 @@ -# Corgi +# Shortify diff --git a/web/index.html b/web/index.html index 8aa2e21..847a109 100644 --- a/web/index.html +++ b/web/index.html @@ -2,10 +2,10 @@ - + - Corgi + Shortify
diff --git a/web/package.json b/web/package.json index b3c4558..41c637a 100644 --- a/web/package.json +++ b/web/package.json @@ -1,5 +1,5 @@ { - "name": "corgi", + "name": "shortify", "scripts": { "dev": "vite", "build": "tsc && vite build", diff --git a/web/public/corgi-logo.png b/web/public/logo.png similarity index 100% rename from web/public/corgi-logo.png rename to web/public/logo.png diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index a5e1d30..5322e64 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -38,8 +38,8 @@ const Header: React.FC = () => {
- - Corgi + + Shortify {workspaceList.length > 0 && activedWorkspace !== undefined && ( <> diff --git a/web/src/pages/Auth.tsx b/web/src/pages/Auth.tsx index 6012f55..a6c7ba6 100644 --- a/web/src/pages/Auth.tsx +++ b/web/src/pages/Auth.tsx @@ -30,7 +30,7 @@ const Auth: React.FC = () => { api.getSystemStatus().then(({ data }) => { const { data: status } = data; if (status.profile.mode === "dev") { - setEmail("frank@iamcorgi.com"); + setEmail("frank@shortify.demo"); setPassword("secret"); } }); @@ -121,9 +121,9 @@ const Auth: React.FC = () => {
- +
- Corgi + Shortify {actionBtnLoadingState.isLoading && }