diff --git a/PasteBin/Program.cs b/PasteBin/Program.cs index 031d843..e0813ca 100644 --- a/PasteBin/Program.cs +++ b/PasteBin/Program.cs @@ -94,7 +94,7 @@ class Program bool loggedIn = await IsLoggedInAsync(context.Request.Cookies["token"]); if (loggedIn) { - var user = await GetLoggedInUserAsync(context.Request.Cookies["token"]); + var user = await GetLoggedInUserAsync(context?.Request?.Cookies?["token"]); if (user.State != 0) { var punishment = await GetPunishmentAsync(user.UUID); @@ -639,7 +639,7 @@ class Program { await connection.OpenAsync(); var command = connection.CreateCommand(); - command.CommandText = $"SELECT * FROM pastes WHERE Visibility != 'Private' ORDER BY UID DESC LIMIT {pastesPerPage} OFFSET {skipCount}"; + command.CommandText = $"SELECT * FROM pastes WHERE Visibility != 'Private' AND Visibility != 'Unlisted' ORDER BY UID DESC LIMIT {pastesPerPage} OFFSET {skipCount}"; var reader = await command.ExecuteReaderAsync(); string pastes = string.Empty; while (await reader.ReadAsync()) @@ -652,6 +652,7 @@ class Program Visibility = reader.GetString(4), Id = reader.GetString(5), }; + string title = paste.Title; if (paste.Visibility == "Private" || paste.Visibility == "Unlisted") { @@ -668,8 +669,9 @@ class Program var difference = GetTimeDifference(DateTimeOffset.FromUnixTimeSeconds(paste.UnixDate ?? 0), DateTimeOffset.FromUnixTimeSeconds(DateTimeOffset.Now.ToUnixTimeSeconds())); pastes += $"
  • {title} {difference} {ConvertToBytes(paste.Size)}
  • "; } + var findCountCommand = connection.CreateCommand(); - findCountCommand.CommandText = "SELECT COUNT(*) FROM pastes WHERE Visibility != 'Private'"; + findCountCommand.CommandText = "SELECT COUNT(*) FROM pastes WHERE Visibility != 'Private' AND Visibility != 'Unlisted'"; int totalPastes = Convert.ToInt32(await findCountCommand.ExecuteScalarAsync()); int totalPages = (int)Math.Ceiling((double)totalPastes / pastesPerPage); diff --git a/PasteBin/Sharpbin.csproj b/PasteBin/Sharpbin.csproj index 5925c7c..810a3e8 100644 --- a/PasteBin/Sharpbin.csproj +++ b/PasteBin/Sharpbin.csproj @@ -22,9 +22,11 @@ + + @@ -43,6 +45,12 @@ Always + + Always + + + Always + diff --git a/PasteBin/assets/admin/user.html b/PasteBin/assets/admin/user.html index 4f40908..8cac62c 100644 --- a/PasteBin/assets/admin/user.html +++ b/PasteBin/assets/admin/user.html @@ -45,8 +45,8 @@ -
    -

    +
    +