Default credential auth to true, readme updates
This commit is contained in:
parent
f07f4789ee
commit
a97ba1b9aa
3 changed files with 32 additions and 21 deletions
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"typescript.tsdk": "src/node_modules/.pnpm/typescript@4.6.4/node_modules/typescript/lib",
|
||||||
|
"typescript.enablePromptUseWorkspaceTsdk": true,
|
||||||
|
"dotenv.enableAutocloaking": false
|
||||||
|
}
|
40
README.md
40
README.md
|
@ -1,16 +1,17 @@
|
||||||
# <img src="client/public/assets/logo.png" height="32px" alt="" /> Drift
|
# <img src="client/public/assets/logo.png" height="32px" alt="" /> Drift
|
||||||
|
|
||||||
> **Note:** This branch is where all work is being done, refactoring to the Next.js 13 app directory and React Server Components.
|
> **Note:** This branch is where all work is being done to refactor to the Next.js 13 app directory and React Server Components.
|
||||||
|
|
||||||
|
|
||||||
Drift is a self-hostable Gist clone. It's in beta, but is completely functional.
|
Drift is a self-hostable Gist clone. It's in beta, but is completely functional.
|
||||||
|
|
||||||
You can try a demo at https://drift.lol. The demo is built on main but has no database, so files and accounts can be wiped at any time.
|
You can try a demo at https://drift.lol. The demo is built on main but has no database, so files and accounts can be wiped at any time.
|
||||||
|
|
||||||
If you want to contribute, need support, or want to stay updated, you can join the IRC channel at #drift on irc.libera.chat or [reach me on twitter](https://twitter.com/Max_Leiter). If you don't have an IRC client yet, you can use a webclient [here](https://demo.thelounge.chat/#/connect?join=%23drift&nick=drift-user&realname=Drift%20User).
|
If you want to contribute, need support, or want to stay updated, you can join the IRC channel at #drift on irc.libera.chat or [reach me on twitter](https://twitter.com/Max_Leiter). If you don't have an IRC client yet, you can use a webclient [here](https://demo.thelounge.chat/#/connect?join=%23drift&nick=drift-user&realname=Drift%20User).
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
**Contents:**
|
**Contents:**
|
||||||
|
|
||||||
- [Setup](#setup)
|
- [Setup](#setup)
|
||||||
- [Development](#development)
|
- [Development](#development)
|
||||||
- [Production](#production)
|
- [Production](#production)
|
||||||
|
@ -23,20 +24,20 @@ If you want to contribute, need support, or want to stay updated, you can join t
|
||||||
|
|
||||||
### Development
|
### Development
|
||||||
|
|
||||||
In the `client/` directory, run `pnpm i`. If you need `pnpm`, you can download it [here](https://pnpm.io/installation).
|
In the `src/` directory, run `pnpm i`. If you need `pnpm`, you can download it [here](https://pnpm.io/installation).
|
||||||
You can run `pnpm dev` in `client` for file watching and live reloading.
|
You can run `pnpm dev` in `client` for file watching and live reloading.
|
||||||
|
|
||||||
To work with [prisma](prisma.io/), you can interface with prisma via `pnpm prisma`.
|
To work with [prisma](prisma.io/), you can use `pnpm prisma` or `pnpm exec prisma` to interact with the database.
|
||||||
|
|
||||||
### Production
|
### Production
|
||||||
|
|
||||||
`pnpm build` in `client/` will produce production code. `pnpm start` will run the Next.js server.
|
`pnpm build` in `src/` will produce production code. `pnpm start` will run the Next.js server.
|
||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
You can change these to your liking.
|
You can change these to your liking.
|
||||||
|
|
||||||
`client/.env`:
|
`src/.env`:
|
||||||
|
|
||||||
- `DRIFT_URL`: the URL of the drift instance.
|
- `DRIFT_URL`: the URL of the drift instance.
|
||||||
- `DATABASE_URL`: the URL to connect to your postgres instance. For example, `postgresql://user:password@localhost:5432/drift`.
|
- `DATABASE_URL`: the URL to connect to your postgres instance. For example, `postgresql://user:password@localhost:5432/drift`.
|
||||||
|
@ -45,20 +46,25 @@ You can change these to your liking.
|
||||||
- `ENABLE_ADMIN`: the first account created is an administrator account
|
- `ENABLE_ADMIN`: the first account created is an administrator account
|
||||||
- `REGISTRATION_PASSWORD`: the password required to register an account. If not set, no password is required.
|
- `REGISTRATION_PASSWORD`: the password required to register an account. If not set, no password is required.
|
||||||
- `NODE_ENV`: defaults to development, can be `production`
|
- `NODE_ENV`: defaults to development, can be `production`
|
||||||
- `GITHUB_CLIENT_ID`: the client ID for GitHub OAuth
|
|
||||||
- `GITHUB_CLIENT_SECRET`: the client secret for GitHub OAuth
|
#### Auth environment variables
|
||||||
- `NEXTAUTH_URL`: the URL of the drift instance.
|
**Note:** Only credential auth currently supports the registration password, so if you want to secure registration, you must use only credential auth.
|
||||||
|
|
||||||
|
- `GITHUB_CLIENT_ID`: the client ID for GitHub OAuth.
|
||||||
|
- `GITHUB_CLIENT_SECRET`: the client secret for GitHub OAuth.
|
||||||
|
- `NEXTAUTH_URL`: the URL of the drift instance. Not required if hosting on Vercel.
|
||||||
|
- `CREDENTIAL_AUTH`: whether to allow username/password authentication. Defaults to `true`.
|
||||||
|
|
||||||
## Running with pm2
|
## Running with pm2
|
||||||
|
|
||||||
It's easy to start Drift using [pm2](https://pm2.keymetrics.io/).
|
It's easy to start Drift using [pm2](https://pm2.keymetrics.io/).
|
||||||
First, add the `.env` file to `client/` with your values (see the above section for the required options).
|
First, add the `.env` file to `src/` with your values (see the above section for the required options).
|
||||||
|
|
||||||
Then, use the following command to start the client :
|
Then, use the following command to start the server:
|
||||||
|
|
||||||
- `cd client && pnpm build && pm2 start pnpm --name drift-client --interpreter bash -- start`
|
- `cd src && pnpm build && pm2 start pnpm --name drift --interpreter bash -- start`
|
||||||
|
|
||||||
Refer to pm2's docs or `pm2 help` for more information.
|
Refer to pm2's docs or `pm2 help` for more information.
|
||||||
|
|
||||||
## Running with Docker
|
## Running with Docker
|
||||||
|
|
||||||
|
@ -66,14 +72,14 @@ Then, use the following command to start the client :
|
||||||
|
|
||||||
Drift is a work in progress. Below is a (rough) list of completed and envisioned features. If you want to help address any of them, please let me know regardless of your experience and I'll be happy to assist.
|
Drift is a work in progress. Below is a (rough) list of completed and envisioned features. If you want to help address any of them, please let me know regardless of your experience and I'll be happy to assist.
|
||||||
|
|
||||||
- [x] creating and sharing private, public, unlisted posts
|
- [x] Next.js 13 `app` directory
|
||||||
- [x] syntax highlighting (detected by file extension)
|
- [x] creating and sharing private, public, password-protected, and unlisted posts
|
||||||
- [x] multiple files per post
|
- [x] syntax highlighting
|
||||||
- [x] uploading files via drag-and-drop
|
|
||||||
- [x] expiring posts
|
- [x] expiring posts
|
||||||
- [x] responsive UI
|
- [x] responsive UI
|
||||||
- [x] user auth
|
- [x] user auth
|
||||||
- [ ] SSO via HTTP header (Issue: [#11](https://github.com/MaxLeiter/Drift/issues/11))
|
- [ ] SSO via HTTP header (Issue: [#11](https://github.com/MaxLeiter/Drift/issues/11))
|
||||||
|
- [x] SSO via GitHub OAuth
|
||||||
- [x] downloading files (individually and entire posts)
|
- [x] downloading files (individually and entire posts)
|
||||||
- [x] password protected posts
|
- [x] password protected posts
|
||||||
- [x] postgres database
|
- [x] postgres database
|
||||||
|
|
|
@ -78,7 +78,7 @@ export const config = (env: Environment): Config => {
|
||||||
github_client_id: env.GITHUB_CLIENT_ID ?? "",
|
github_client_id: env.GITHUB_CLIENT_ID ?? "",
|
||||||
github_client_secret: env.GITHUB_CLIENT_SECRET ?? "",
|
github_client_secret: env.GITHUB_CLIENT_SECRET ?? "",
|
||||||
nextauth_secret: throwIfUndefined("NEXTAUTH_SECRET"),
|
nextauth_secret: throwIfUndefined("NEXTAUTH_SECRET"),
|
||||||
credential_auth: stringToBoolean("CREDENTIAL_AUTH")
|
credential_auth: stringToBoolean("CREDENTIAL_AUTH") ?? true
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue