Skip to content

Commit

Permalink
refactor: Reorganize folder structure for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
gizmo-ds committed Dec 27, 2023
1 parent d215442 commit 0f27352
Show file tree
Hide file tree
Showing 69 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ node_modules/

Dockerfile
docker-compose.yml
/internal/mfm/out.js
/pkg/mfm/out.js
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* text=auto eol=lf
*.png binary
internal/mfm/*.js -diff
pkg/mfm/*.js -diff
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ build/
/data/
node_modules/

/config.toml
/.env
proxy/misskey/.env
/internal/mfm/out.js
config.toml
.env
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM docker.io/oven/bun:latest AS mfm-builder
WORKDIR /app
COPY ./internal/mfm /app/internal/mfm
COPY pkg/mfm /app/pkg/mfm
COPY ./package.json /app/package.json
COPY ./bun.lockb /app/bun.lockb
RUN bun install && bun run build
Expand All @@ -10,7 +10,7 @@ WORKDIR /app
COPY . /app
ENV CGO_ENABLED=0
ARG version=development
COPY --from=mfm-builder /app/internal/mfm/out.js /app/internal/mfm/out.js
COPY --from=mfm-builder /app/pkg/mfm/out.js /app/pkg/mfm/out.js
RUN go mod download
RUN go build -trimpath -tags timetzdata \
-ldflags "-s -w -X github.com/gizmo-ds/misstodon/internal/global.AppVersion=$version" \
Expand Down
2 changes: 1 addition & 1 deletion cmd/misstodon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/gizmo-ds/misstodon/cmd/misstodon/commands"
"github.com/gizmo-ds/misstodon/cmd/misstodon/logger"
"github.com/gizmo-ds/misstodon/internal/global"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
Expand Down
4 changes: 2 additions & 2 deletions internal/api/nodeinfo/nodeinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/gizmo-ds/misstodon/internal/api/middleware"
"github.com/gizmo-ds/misstodon/internal/global"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/api/oauth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/gizmo-ds/misstodon/internal/api/middleware"
"github.com/gizmo-ds/misstodon/internal/global"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/gizmo-ds/misstodon/internal/api/httperror"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/v1/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/gizmo-ds/misstodon/internal/global"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/api/v1/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/gizmo-ds/misstodon/internal/global"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/api/v1/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/duke-git/lancet/v2/slice"
"github.com/gizmo-ds/misstodon/internal/api/httperror"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/statuses.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"github.com/gizmo-ds/misstodon/internal/api/httperror"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/streaming.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/http"

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/proxy/misskey/streaming"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey/streaming"
"github.com/gorilla/websocket"
"github.com/labstack/echo/v4"
"github.com/pkg/errors"
Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1/timelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/api/v1/trends.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/api/v2/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/api/wellknown/wellknown.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/gizmo-ds/misstodon/internal/api/httperror"
"github.com/gizmo-ds/misstodon/internal/api/middleware"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/labstack/echo/v4"
)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "misstodon",
"scripts": {
"build": "esbuild internal/mfm/parse.ts --bundle --format=esm --platform=node --target=es2017 --minify --outfile=internal/mfm/out.js"
"build": "esbuild pkg/mfm/parse.ts --bundle --format=esm --platform=node --target=es2017 --minify --outfile=pkg/mfm/out.js"
},
"private": true,
"author": "Gizmo",
Expand Down
1 change: 1 addition & 0 deletions pkg/mfm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out.js
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion internal/mfm/mfm_test.go → pkg/mfm/mfm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

"github.com/gizmo-ds/misstodon/internal/mfm"
"github.com/gizmo-ds/misstodon/pkg/mfm"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/assert"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion models/MkNote.go → pkg/misstodon/models/MkNote.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package models

import (
"github.com/gizmo-ds/misstodon/internal/mfm"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/pkg/mfm"
)

type MkNoteVisibility string
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion models/MkUser.go → pkg/misstodon/models/MkUser.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package models
import (
"time"

"github.com/gizmo-ds/misstodon/internal/mfm"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/pkg/mfm"
"github.com/pkg/errors"
)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions pkg/misstodon/provider/misskey/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/gizmo-ds/misstodon/internal/global"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/duke-git/lancet/v2/slice"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"mime/multipart"

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/duke-git/lancet/v2/slice"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/duke-git/lancet/v2/slice"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/gorilla/websocket"
"github.com/rs/xid"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/duke-git/lancet/v2/slice"
"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/pkg/errors"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/proxy/misskey"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/provider/misskey"
"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/gizmo-ds/misstodon/internal/misstodon"
"github.com/gizmo-ds/misstodon/internal/utils"
"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
)

func TrendsTags(ctx misstodon.Context, limit, offset int) ([]models.Tag, error) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io"
"net/http"

"github.com/gizmo-ds/misstodon/models"
"github.com/gizmo-ds/misstodon/pkg/misstodon/models"
)

func NodeInfo(server string, ni models.NodeInfo) (models.NodeInfo, error) {
Expand Down

0 comments on commit 0f27352

Please sign in to comment.