mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-04-19 10:51:20 +00:00
Add condition to allow an existing account to get admin role if they are added after the fact
This commit is contained in:
parent
e72da87b01
commit
00e17ca6f8
16
README.md
16
README.md
@ -104,6 +104,22 @@ PlebDevs is an open-source platform that combines educational content, community
|
||||
- Admin pubkey management
|
||||
- Content pricing controls
|
||||
|
||||
### Running locally
|
||||
|
||||
1. Clone the repository
|
||||
2. Install dependencies
|
||||
3. Create a `.env` file based on the `.env.example` file
|
||||
4. Open Docker Desktop
|
||||
5. Run `docker compose up --build`
|
||||
6. In schema.prisma, ensure you have the local datasource uncommented and the production datasource commented out.
|
||||
7. Exec into the container and run `npx prisma migrate dev`
|
||||
8. Restart the docker compose
|
||||
9. Rerun `docker compose up --build`
|
||||
|
||||
Now the database is running and the migrations are applied.
|
||||
You can now run locally.
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome! Whether you're fixing bugs, improving documentation, or proposing new features, please feel free to open an issue or submit a PR.
|
||||
|
@ -50,6 +50,20 @@ const syncNostrProfile = async (pubkey) => {
|
||||
await updateUser(dbUser.id, updates);
|
||||
dbUser = await getUserByPubkey(pubkey);
|
||||
}
|
||||
|
||||
// Check if user should have author role but doesn't
|
||||
if (appConfig.authorPubkeys.includes(pubkey) && !dbUser.role?.admin) {
|
||||
const role = await createRole({
|
||||
userId: dbUser.id,
|
||||
admin: true,
|
||||
subscribed: false,
|
||||
});
|
||||
|
||||
if (role) {
|
||||
await updateUser(dbUser.id, { role: role.id });
|
||||
dbUser = await getUserByPubkey(pubkey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Create new user
|
||||
const username = fields.username || pubkey.slice(0, 8);
|
||||
|
Loading…
x
Reference in New Issue
Block a user