mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
Compare commits
3 Commits
v1.0-alpha
...
v1.0-alpha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad590f6011 | ||
|
|
2f5bd75d4e | ||
|
|
3c8c8ebc81 |
13
README.md
13
README.md
@@ -8,7 +8,7 @@ This repo contains the full source code of the Notesnook Sync Server licensed un
|
||||
|
||||
Requirements:
|
||||
|
||||
1. [.NET 7](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
|
||||
1. [.NET 8](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
|
||||
2. [git](https://git-scm.com/downloads)
|
||||
|
||||
The first step is to `clone` the repository:
|
||||
@@ -55,19 +55,14 @@ dotnet run --project Streetwriters.Identity/Streetwriters.Identity.csproj
|
||||
|
||||
The sync server can easily be started using Docker.
|
||||
|
||||
The first step is to `clone` the repository:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/streetwriters/notesnook-sync-server.git
|
||||
|
||||
# change directory
|
||||
cd notesnook-sync-server
|
||||
wget https://raw.githubusercontent.com/streetwriters/notesnook-sync-server/master/docker-compose.yml
|
||||
```
|
||||
|
||||
And then use Docker Compose to start the servers:
|
||||
|
||||
```bash
|
||||
docker-compose up
|
||||
docker compose up
|
||||
```
|
||||
|
||||
This takes care of setting up everything including MongoDB, Minio etc.
|
||||
@@ -81,7 +76,7 @@ This takes care of setting up everything including MongoDB, Minio etc.
|
||||
- [x] Open source the SSE Messaging infrastructure
|
||||
- [x] Fully Dockerize all services
|
||||
- [x] Use self-hosted Minio for S3 storage
|
||||
- [ ] Publish on DockerHub
|
||||
- [x] Publish on DockerHub
|
||||
- [ ] Write self hosting docs
|
||||
- [ ] Add settings to change server URLs in Notesnook client apps
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Streetwriters.Common;
|
||||
using Streetwriters.Common.Enums;
|
||||
using Streetwriters.Common.Models;
|
||||
using Streetwriters.Identity.Enums;
|
||||
using Streetwriters.Identity.Interfaces;
|
||||
@@ -68,7 +69,7 @@ namespace Streetwriters.Identity.Controllers
|
||||
var result = await UserManager.CreateAsync(new User
|
||||
{
|
||||
Email = form.Email,
|
||||
EmailConfirmed = false,
|
||||
EmailConfirmed = Constants.IS_SELF_HOSTED,
|
||||
UserName = form.Username ?? form.Email,
|
||||
}, form.Password);
|
||||
|
||||
@@ -101,15 +102,19 @@ namespace Streetwriters.Identity.Controllers
|
||||
if (result.Succeeded)
|
||||
{
|
||||
var user = await UserManager.FindByEmailAsync(form.Email);
|
||||
|
||||
await UserManager.AddToRoleAsync(user, client.Id);
|
||||
if (Constants.IS_SELF_HOSTED)
|
||||
{
|
||||
await UserManager.AddClaimAsync(user, UserService.SubscriptionTypeToClaim(client.Id, Common.Enums.SubscriptionType.PREMIUM));
|
||||
await UserManager.AddClaimAsync(user, new Claim("platform", PlatformFromUserAgent(base.HttpContext.Request.Headers.UserAgent)));
|
||||
|
||||
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
var callbackUrl = Url.TokenLink(user.Id.ToString(), code, client.Id, TokenType.CONFRIM_EMAIL, Request.Scheme);
|
||||
await EmailSender.SendConfirmationEmailAsync(user.Email, callbackUrl, client);
|
||||
await MFAService.EnableMFAAsync(user, MFAMethods.Email);
|
||||
}
|
||||
else
|
||||
{
|
||||
await UserManager.AddClaimAsync(user, new Claim("platform", PlatformFromUserAgent(base.HttpContext.Request.Headers.UserAgent)));
|
||||
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
|
||||
var callbackUrl = Url.TokenLink(user.Id.ToString(), code, client.Id, TokenType.CONFRIM_EMAIL, Request.Scheme);
|
||||
await EmailSender.SendConfirmationEmailAsync(user.Email, callbackUrl, client);
|
||||
}
|
||||
return Ok(new
|
||||
{
|
||||
userId = user.Id.ToString()
|
||||
|
||||
Reference in New Issue
Block a user