Skip to content

Commit

Permalink
Start new simpler UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ezynda3 committed Sep 10, 2024
1 parent e83800e commit bdef8dc
Show file tree
Hide file tree
Showing 32 changed files with 41 additions and 3,178 deletions.
13 changes: 1 addition & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
# syntax=docker/dockerfile:1
# Stage 1: Build the static files
FROM node:22-alpine3.18 as ui-builder
WORKDIR /ui
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY /ui/package.json /ui/pnpm-lock.yaml ./
RUN pnpm i --frozen-lockfile
COPY /ui .
RUN pnpm run build

# Stage 2: Build the Go binary
FROM golang:1.18.2-alpine3.14 AS builder
WORKDIR /app
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
RUN update-ca-certificates
COPY . .
COPY --from=ui-builder /ui/build ./ui/build/
RUN go mod download
RUN CGO_ENABLED=0 go build -o pocketbase .

FROM scratch

WORKDIR /app
COPY --from=builder /app/pb_public /app/pb_public
COPY --from=builder /app/pocketbase /app/pocketbase
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

Expand Down
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/labstack/echo/v5"
"github.com/labstack/echo/v5/middleware"
_ "github.com/mark3labs/anyabi.xyz/migrations"
"github.com/mark3labs/anyabi.xyz/ui"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/apis"
Expand Down Expand Up @@ -102,6 +101,11 @@ func main() {

app.OnBeforeServe().Add(func(e *core.ServeEvent) error {

e.Router.GET(
"/*",
apis.StaticDirectoryHandler(os.DirFS("./pb_public"), true),
)

rateLimiterConfig := middleware.RateLimiterConfig{
Skipper: middleware.DefaultSkipper,
Store: middleware.NewRateLimiterMemoryStore(rate.Limit(30)),
Expand All @@ -126,6 +130,7 @@ func main() {
return next(c)
}
})

// GET ABI
e.Router.AddRoute(echo.Route{
Method: http.MethodGet,
Expand Down Expand Up @@ -253,8 +258,6 @@ func main() {
},
})

e.Router.GET("/*", apis.StaticDirectoryHandler(ui.BuildDirFS, true))

return nil
})

Expand Down
34 changes: 34 additions & 0 deletions pb_public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en" class="dark">

<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width" />
<title>AnyABI - The easiest way to fetch an ABI</title>
<meta name="twitter:title" content="AnyABI - The easiest way to fetch an ABI" />
<meta name="description" content="Quickly grab the ABI for ANY EVM smart contract on ANY EVM chain." />
<meta name="twitter:description" content="Quickly grab the ABI for ANY EVM smart contract on ANY EVM chain." />
<meta name="twitter:image" content="https://anyabi.xyz/thumbnail.png" />
<meta property="og:image" content="https://anyabi.xyz/thumbnail.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta http-equiv="content-security-policy" content="">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
</head>

<body>
<main class="container">
<h1>
<img src="/logo.png" width="48" />
AnyABI
</h1>
<article>The easiest way to fetch an ABI.</article>
</main>
<!-- 100% privacy friendly analytics -->
<script async defer src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
<noscript>
<img src="https://queue.simpleanalyticscdn.com/noscript.gif" alt="" referrerpolicy="no-referrer-when-downgrade" />
</noscript>
</body>

</html>
File renamed without changes
1 change: 0 additions & 1 deletion ui/.env.example

This file was deleted.

1 change: 0 additions & 1 deletion ui/.env.production.example

This file was deleted.

13 changes: 0 additions & 13 deletions ui/.eslintignore

This file was deleted.

20 changes: 0 additions & 20 deletions ui/.eslintrc.cjs

This file was deleted.

11 changes: 0 additions & 11 deletions ui/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion ui/.npmrc

This file was deleted.

13 changes: 0 additions & 13 deletions ui/.prettierignore

This file was deleted.

17 changes: 0 additions & 17 deletions ui/.prettierrc

This file was deleted.

77 changes: 0 additions & 77 deletions ui/.vscode/settings.json

This file was deleted.

38 changes: 0 additions & 38 deletions ui/README.md

This file was deleted.

48 changes: 0 additions & 48 deletions ui/package.json

This file was deleted.

Loading

0 comments on commit bdef8dc

Please sign in to comment.