lint fixes, minor copy adjustments, dep updates
This commit is contained in:
parent
d0a73a7cbc
commit
11ac185f86
8 changed files with 900 additions and 792 deletions
|
@ -23,7 +23,8 @@ GITHUB_CLIENT_SECRET=
|
||||||
# Optional: if you want Keycloak oauth. Currently incompatible with the registration password
|
# Optional: if you want Keycloak oauth. Currently incompatible with the registration password
|
||||||
KEYCLOAK_ID=
|
KEYCLOAK_ID=
|
||||||
KEYCLOAK_SECRET=
|
KEYCLOAK_SECRET=
|
||||||
KEYCLOAK_ISSUER= # keycloak path including realm
|
# keycloak path including realm
|
||||||
|
KEYCLOAK_ISSUER=
|
||||||
KEYCLOAK_NAME=
|
KEYCLOAK_NAME=
|
||||||
|
|
||||||
# Optional: if you want to support credential auth (username/password, supports registration password)
|
# Optional: if you want to support credential auth (username/password, supports registration password)
|
||||||
|
@ -31,5 +32,5 @@ KEYCLOAK_NAME=
|
||||||
CREDENTIAL_AUTH=true
|
CREDENTIAL_AUTH=true
|
||||||
|
|
||||||
# Optional:
|
# Optional:
|
||||||
WELCOME_CONTENT=
|
WELCOME_CONTENT="## Drift is a self-hostable clone of GitHub Gist. \nIt is a simple way to share code and text snippets. It supportsthe following:\n \n - Render GitHub Extended Markdown (including images)\n - User authentication\n - Private, public, and password protected posts\n - Markdown is rendered and stored on the server\n - Syntax highlighting and automatic language detection\n - Drag-and-drop file uploading\n\n If you want to signup, you can join at [/signup](/signup) as long as you have a passcode provided by the administrator (which you don\'t need for this demo). **This demo is on a memory-only database, so accounts and pastes can be deleted at any time.** \n\nYou can find the source code on [GitHub](https://github.com/MaxLeiter/drift)."
|
||||||
WELCOME_TITLE=
|
WELCOME_TITLE="Welcome to Drift"
|
||||||
|
|
49
package.json
49
package.json
|
@ -14,72 +14,73 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next-auth/prisma-adapter": "^1.0.5",
|
"@next-auth/prisma-adapter": "^1.0.5",
|
||||||
"@next/eslint-plugin-next": "^13.2.4",
|
"@next/eslint-plugin-next": "13.3.1-canary.6",
|
||||||
"@prisma/client": "^4.11.0",
|
"@prisma/client": "^4.12.0",
|
||||||
"@radix-ui/react-dialog": "^1.0.3",
|
"@radix-ui/react-dialog": "^1.0.3",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.0.4",
|
"@radix-ui/react-dropdown-menu": "^2.0.4",
|
||||||
"@radix-ui/react-popover": "^1.0.5",
|
"@radix-ui/react-popover": "^1.0.5",
|
||||||
"@radix-ui/react-tabs": "^1.0.3",
|
"@radix-ui/react-tabs": "^1.0.3",
|
||||||
"@radix-ui/react-tooltip": "^1.0.5",
|
"@radix-ui/react-tooltip": "^1.0.5",
|
||||||
"@vercel/og": "^0.4.0",
|
"@vercel/og": "^0.5.2",
|
||||||
"client-only": "^0.0.1",
|
"client-only": "^0.0.1",
|
||||||
"client-zip": "2.3.0",
|
"client-zip": "2.3.1",
|
||||||
"cmdk": "^0.2.0",
|
"cmdk": "^0.2.0",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
"next": "^13.2.4",
|
"next": "13.4.3-canary.2",
|
||||||
"next-auth": "^4.20.1",
|
"next-auth": "^4.22.0",
|
||||||
"next-themes": "^0.2.1",
|
"next-themes": "^0.2.1",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-cookie": "^4.1.1",
|
"react-cookie": "^4.1.1",
|
||||||
"react-datepicker": "4.10.0",
|
"react-datepicker": "4.11.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"react-dropzone": "14.2.3",
|
"react-dropzone": "14.2.3",
|
||||||
"react-error-boundary": "^3.1.4",
|
"react-error-boundary": "^4.0.3",
|
||||||
"react-feather": "^2.0.10",
|
"react-feather": "^2.0.10",
|
||||||
"react-hot-toast": "2.4.0",
|
"react-hot-toast": "2.4.0",
|
||||||
"server-only": "^0.0.1",
|
"server-only": "^0.0.1",
|
||||||
"swr": "^2.1.0",
|
"swr": "^2.1.3",
|
||||||
"textarea-markdown-editor": "1.0.4",
|
"textarea-markdown-editor": "1.0.4",
|
||||||
"ts-jest": "^29.0.5",
|
"ts-jest": "^29.1.0",
|
||||||
|
"ts-morph": "^18.0.0",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
"zlib": "^1.0.5"
|
"zlib": "^1.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@next/bundle-analyzer": "13.2.4",
|
"@next/bundle-analyzer": "13.4.3-canary.2",
|
||||||
"@total-typescript/ts-reset": "^0.4.2",
|
"@total-typescript/ts-reset": "^0.4.2",
|
||||||
"@types/bcrypt": "^5.0.0",
|
"@types/bcrypt": "^5.0.0",
|
||||||
"@types/git-http-backend": "^1.0.1",
|
"@types/git-http-backend": "^1.0.1",
|
||||||
"@types/jest": "^29.4.1",
|
"@types/jest": "^29.4.1",
|
||||||
"@types/lodash.debounce": "^4.0.7",
|
"@types/lodash.debounce": "^4.0.7",
|
||||||
"@types/node": "18.15.3",
|
"@types/node": "18.15.11",
|
||||||
"@types/react": "18.0.28",
|
"@types/react": "18.0.35",
|
||||||
"@types/react-datepicker": "4.10.0",
|
"@types/react-datepicker": "4.10.0",
|
||||||
"@types/react-dom": "18.0.11",
|
"@types/react-dom": "18.0.11",
|
||||||
"@types/uuid": "^9.0.1",
|
"@types/uuid": "^9.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||||
"@typescript-eslint/parser": "^5.55.0",
|
"@typescript-eslint/parser": "^5.58.0",
|
||||||
"@wcj/markdown-to-html": "^2.2.1",
|
"@wcj/markdown-to-html": "^2.2.1",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"cross-env": "7.0.3",
|
"cross-env": "7.0.3",
|
||||||
"csstype": "^3.1.1",
|
"csstype": "^3.1.2",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"eslint": "8.36.0",
|
"eslint": "8.38.0",
|
||||||
"eslint-config-next": "13.2.4",
|
"eslint-config-next": "13.4.3-canary.2",
|
||||||
"jest-mock-extended": "^3.0.3",
|
"jest-mock-extended": "^3.0.3",
|
||||||
"next-unused": "0.0.6",
|
"next-unused": "0.0.6",
|
||||||
"postcss": "^8.4.21",
|
"postcss": "^8.4.21",
|
||||||
"postcss-flexbugs-fixes": "^5.0.2",
|
"postcss-flexbugs-fixes": "^5.0.2",
|
||||||
"postcss-hover-media-feature": "^1.0.2",
|
"postcss-hover-media-feature": "^1.0.2",
|
||||||
"postcss-nested": "^6.0.1",
|
"postcss-nested": "^6.0.1",
|
||||||
"postcss-preset-env": "^8.0.1",
|
"postcss-preset-env": "^8.3.1",
|
||||||
"prettier": "2.8.4",
|
"prettier": "2.8.7",
|
||||||
"prisma": "^4.11.0",
|
"prisma": "^4.12.0",
|
||||||
"typescript": "4.9.5",
|
"typescript": "5.0.4",
|
||||||
"typescript-plugin-css-modules": "4.2.3"
|
"typescript-plugin-css-modules": "5.0.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"sharp": "^0.31.3"
|
"sharp": "^0.32.0"
|
||||||
},
|
},
|
||||||
"next-unused": {
|
"next-unused": {
|
||||||
"alias": {
|
"alias": {
|
||||||
|
|
1604
pnpm-lock.yaml
1604
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
|
@ -32,18 +32,16 @@ function Auth({
|
||||||
const [username, setUsername] = useState("")
|
const [username, setUsername] = useState("")
|
||||||
const [password, setPassword] = useState("")
|
const [password, setPassword] = useState("")
|
||||||
const [submitting, setSubmitting] = useState(false)
|
const [submitting, setSubmitting] = useState(false)
|
||||||
|
|
||||||
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
|
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
setSubmitting(true)
|
setSubmitting(true)
|
||||||
|
|
||||||
const res = await signIn("credentials", {
|
const res = await signIn("credentials", {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
registration_password: serverPassword,
|
registration_password: serverPassword,
|
||||||
redirect: false,
|
redirect: false,
|
||||||
// callbackUrl: "/signin",
|
// callbackUrl: "/signin",
|
||||||
signingIn: signingIn
|
signingIn
|
||||||
})
|
})
|
||||||
if (res?.error) {
|
if (res?.error) {
|
||||||
setToast({
|
setToast({
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { useMemo, useState, useEffect } from "react"
|
||||||
import Badge from "../badge"
|
import Badge from "../badge"
|
||||||
|
|
||||||
const CreatedAgoBadge = ({ createdAt }: { createdAt: string | Date }) => {
|
const CreatedAgoBadge = ({ createdAt }: { createdAt: string | Date }) => {
|
||||||
const createdDate = new Date(createdAt)
|
const createdDate = useMemo(() => new Date(createdAt), [createdAt])
|
||||||
const [time, setTimeAgo] = useState(timeAgo(createdDate))
|
const [time, setTimeAgo] = useState(timeAgo(createdDate))
|
||||||
|
|
||||||
const { setToast } = useToasts()
|
const { setToast } = useToasts()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useSelectedLayoutSegment, useSelectedLayoutSegments } from "next/navigation"
|
import { useSelectedLayoutSegments } from "next/navigation"
|
||||||
import FadeIn from "@components/fade-in"
|
import FadeIn from "@components/fade-in"
|
||||||
import { setDriftTheme } from "src/app/lib/set-theme"
|
import { setDriftTheme } from "src/app/lib/set-theme"
|
||||||
import {
|
import {
|
||||||
|
@ -46,13 +46,17 @@ export function HeaderButtons({
|
||||||
theme: string
|
theme: string
|
||||||
}) {
|
}) {
|
||||||
const { isAdmin, userId } = useSessionSWR()
|
const { isAdmin, userId } = useSessionSWR()
|
||||||
const { resolvedTheme } = useTheme();
|
const { resolvedTheme } = useTheme()
|
||||||
return getButtons({
|
return (
|
||||||
|
<>
|
||||||
|
{getButtons({
|
||||||
isAuthenticated,
|
isAuthenticated,
|
||||||
theme: resolvedTheme ? resolvedTheme : initialTheme,
|
theme: resolvedTheme ? resolvedTheme : initialTheme,
|
||||||
isAdmin,
|
isAdmin,
|
||||||
userId
|
userId
|
||||||
})
|
})}
|
||||||
|
</>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function NavButton(tab: Tab) {
|
function NavButton(tab: Tab) {
|
||||||
|
@ -111,7 +115,7 @@ export function getButtons({
|
||||||
isAuthenticated: boolean
|
isAuthenticated: boolean
|
||||||
theme: string
|
theme: string
|
||||||
// mutate: KeyedMutator<Session>
|
// mutate: KeyedMutator<Session>
|
||||||
isAdmin?: boolean,
|
isAdmin?: boolean
|
||||||
userId?: string
|
userId?: string
|
||||||
}) {
|
}) {
|
||||||
return [
|
return [
|
||||||
|
@ -152,9 +156,7 @@ export function getButtons({
|
||||||
value="signout"
|
value="signout"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
signOut({
|
signOut({
|
||||||
callbackUrl: `/signedout${
|
callbackUrl: `/signedout${userId ? "?userId=" + userId : ""}`
|
||||||
userId ? "?userId=" + userId : ""
|
|
||||||
}`
|
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
width={SIGN_IN_WIDTH}
|
width={SIGN_IN_WIDTH}
|
||||||
|
|
|
@ -6,7 +6,7 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
user: 1000:1000
|
user: 1000:1000
|
||||||
environment:
|
environment:
|
||||||
- WELCOME_CONTENT="## Drift is a self-hostable clone of GitHub Gist. \nIt is a simple way to share code and text snippets with your friends, with support for the following:\n \n - Render GitHub Extended Markdown (including images)\n - User authentication\n - Private, public, and password protected posts\n - Markdown is rendered and stored on the server\n - Syntax highlighting and automatic language detection\n - Drag-and-drop file uploading\n\n If you want to signup, you can join at [/signup](/signup) as long as you have a passcode provided by the administrator (which you don\'t need for this demo). **This demo is on a memory-only database, so accounts and pastes can be deleted at any time.** \n\nYou can find the source code on [GitHub](https://github.com/MaxLeiter/drift)."
|
- WELCOME_CONTENT="## Drift is a self-hostable clone of GitHub Gist. \nIt is a simple way to share code and text snippets. It supportsthe following:\n \n - Render GitHub Extended Markdown (including images)\n - User authentication\n - Private, public, and password protected posts\n - Markdown is rendered and stored on the server\n - Syntax highlighting and automatic language detection\n - Drag-and-drop file uploading\n\n If you want to signup, you can join at [/signup](/signup) as long as you have a passcode provided by the administrator (which you don\'t need for this demo). **This demo is on a memory-only database, so accounts and pastes can be deleted at any time.** \n\nYou can find the source code on [GitHub](https://github.com/MaxLeiter/drift)."
|
||||||
- WELCOME_TITLE="Drift"
|
- WELCOME_TITLE="Drift"
|
||||||
- REGISTRATION_PASSWORD=""
|
- REGISTRATION_PASSWORD=""
|
||||||
- NEXTAUTH_URL=http://localhost:3000
|
- NEXTAUTH_URL=http://localhost:3000
|
||||||
|
|
Loading…
Reference in a new issue