mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-08-13 12:00:20 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5715f4c9ca |
@@ -97,10 +97,10 @@ namespace Notesnook.API.Controllers
|
|||||||
return await result.FirstOrDefaultAsync();
|
return await result.FirstOrDefaultAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GenerateSlug()
|
// private static string GenerateSlug()
|
||||||
{
|
// {
|
||||||
return Nanoid.Generate(size: 24);
|
// return Nanoid.Generate(size: 24);
|
||||||
}
|
// }
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IActionResult> PublishAsync([FromQuery] string? deviceId, [FromBody] Monograph monograph)
|
public async Task<IActionResult> PublishAsync([FromQuery] string? deviceId, [FromBody] Monograph monograph)
|
||||||
@@ -131,7 +131,7 @@ namespace Notesnook.API.Controllers
|
|||||||
}
|
}
|
||||||
monograph.Deleted = false;
|
monograph.Deleted = false;
|
||||||
monograph.ViewCount = 0;
|
monograph.ViewCount = 0;
|
||||||
monograph.Slug = GenerateSlug();
|
// monograph.Slug = GenerateSlug();
|
||||||
await monographs.Collection.ReplaceOneAsync(
|
await monographs.Collection.ReplaceOneAsync(
|
||||||
CreateMonographFilter(userId, monograph),
|
CreateMonographFilter(userId, monograph),
|
||||||
monograph,
|
monograph,
|
||||||
@@ -232,7 +232,7 @@ namespace Notesnook.API.Controllers
|
|||||||
public async Task<IActionResult> GetMonographAsync([FromRoute] string id)
|
public async Task<IActionResult> GetMonographAsync([FromRoute] string id)
|
||||||
{
|
{
|
||||||
var monograph = await FindMonographAsync(id);
|
var monograph = await FindMonographAsync(id);
|
||||||
if (monograph == null || monograph.Deleted || (monograph.Slug != null && monograph.Slug != id))
|
if (monograph == null || monograph.Deleted)
|
||||||
{
|
{
|
||||||
return NotFound(new
|
return NotFound(new
|
||||||
{
|
{
|
||||||
@@ -267,7 +267,7 @@ namespace Notesnook.API.Controllers
|
|||||||
public async Task<IActionResult> TrackView([FromRoute] string id)
|
public async Task<IActionResult> TrackView([FromRoute] string id)
|
||||||
{
|
{
|
||||||
var monograph = await FindMonographAsync(id);
|
var monograph = await FindMonographAsync(id);
|
||||||
if (monograph == null || monograph.Deleted || (monograph.Slug != null && monograph.Slug != id))
|
if (monograph == null || monograph.Deleted)
|
||||||
return Content(SVG_PIXEL, "image/svg+xml");
|
return Content(SVG_PIXEL, "image/svg+xml");
|
||||||
|
|
||||||
var cookieName = $"viewed_{id}";
|
var cookieName = $"viewed_{id}";
|
||||||
|
|||||||
Reference in New Issue
Block a user