R1 cleanup: collAnon and dead code gone, docs current, every peer's scenario in one sweep
Build / Build (push) Successful in 1m7s
Build / Build (push) Successful in 1m7s
Starts the completion program (docs/ROADMAP.md, "Owner decisions on finishing everything", 2026-10-17). - Dead code: the commented-out collAnon blocks (discussions, seeding, admin user lists, HTTP/3, the old signature middleware), the empty PrivaPubWorkersConfiguration, PublicAvatarUsersService and UserPolicyType, unused helpers, the second IPasswordHasher registration, the PasswordGenerator package, SignUpAsync/LoginAsync's unused invitation parameters. "Starting PrivaPub"; a signed-in login is sent to "/", not to "/discussions". - Stored fields nothing read: RootUser.Contacts and ResetPasswordToken*, the local Avatar.AvatarServer, EmailRecovery.RecoveryCode/RequestIP/CreationDate, MongoSettings.LogsDatabase, and AppConfiguration's upload/discussion keys, RequiresFirstTimeSetup and Version (old documents still load: MongoDB.Entities ignores extra elements). DmPost's indexes are no longer made. 49 collAnon keys leave FieldsNameResource in every language. - /clientapi/data/current-version answers the build's ref. UsersIds is a list that can't throw, and the admin routes leave the administrator out without mutating the request. - deploy.yml checks SecureMode on a name no persona can have, and the browser redirect on the directory's first local persona: @thepra is the administrator's own now. - Town: decePub's e2e remnants (expect, client.jsonl, the decePub column) and town/tests go; the dead gaps/load commands too. Mobilizon no longer keeps an event for a deleted test. - tools/pasture/sweep.sh runs every peer's scenario, batch by batch, as CLAUDE.md asks before a change to what PrivaPub sends. - Docs: CLAUDE.md's repo map, route table (every frozen route) and stale lines; ROADMAP's status (setup, v1.25.0, v1.26.0, the program C), the 2026-10-17 decisions, and dated notes where earlier text no longer holds; FEDERATION.md's FEP list (7888, f228, 7628, ae0c and 8967 supported) and the deploy's persona. Verified: dotnet build PrivaPub.sln -c Release (0 errors, no new warnings); bash -n on the touched scripts; py_compile on the town; the pasture's gts, mastodon and lemmy scenarios on this build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
This commit is contained in:
1 parent
6727e1817a
commit
ff5e635dda
71 files changed
+238
-4767
No files matched your search
+1
-109
@@ -10,68 +10,12 @@ namespace PrivaPub.Data
|
||||
{
|
||||
public static class InitDb
|
||||
{
|
||||
public static async Task Init(this DbEntities dbClient, IPasswordHasher passwordHasher)
|
||||
public static async Task Init(this DbEntities dbClient)
|
||||
{
|
||||
await SyncLanguages(dbClient);
|
||||
await UpdateNewLanguages(dbClient);
|
||||
//await SyncUserSettings(dbClient);
|
||||
//await ClearUsers(dbClient);
|
||||
//var botsInsertionAwaiter = InsertBots(dbClient, passwordHasher);
|
||||
//var updateAnswersAwaiter = UpdateAnswersLikes(dbClient);
|
||||
|
||||
//Task.WaitAll(botsInsertionAwaiter);
|
||||
//await SyncShareDiscussions(dbClient);
|
||||
}
|
||||
|
||||
//static async Task UpdateAnswersLikes(DbCollections dbClient)
|
||||
//{
|
||||
// if (await dbClient.AnswersLikes.Find(al => al.AnswerId != null).AnyAsync()) return;
|
||||
|
||||
// foreach (var answerLikes in await dbClient.AnswersLikes.Find(al => true).ToListAsync())
|
||||
// {
|
||||
// answerLikes.AnswerId = answerLikes.Id;
|
||||
// answerLikes.Id = ObjectId.GenerateNewId();
|
||||
// await dbClient.AnswersLikes.InsertOneAsync(answerLikes);
|
||||
// _ = await dbClient.AnswersLikes.DeleteOneAsync(al => al.Id == answerLikes.AnswerId);
|
||||
// }
|
||||
//}
|
||||
|
||||
//static async Task ClearUsers(DbColl dbClient)
|
||||
//{
|
||||
// await dbClient.Users.DeleteManyAsync(u => true);
|
||||
// await dbClient.UsersSettings.DeleteManyAsync(u => true);
|
||||
// await dbClient.Answers.DeleteManyAsync(u => true);
|
||||
// await dbClient.AnswersLikes.DeleteManyAsync(u => true);
|
||||
// await dbClient.Comments.DeleteManyAsync(u => true);
|
||||
// await dbClient.EmailRecoveries.DeleteManyAsync(u => true);
|
||||
// await dbClient.Threads.DeleteManyAsync(u => true);
|
||||
// await dbClient.EDiscussions.DeleteManyAsync(u => true);
|
||||
// await dbClient.Logs.DeleteManyAsync(u => true);
|
||||
// await dbClient.ShareDiscussions.De(u => true);
|
||||
// await dbClient.DiscussionFiles.DeleteManyAsync(u => true);
|
||||
// await dbClient.UsersGroups.DeleteManyAsync(u => true);
|
||||
//}
|
||||
|
||||
// static async Task SyncShareDiscussions(DbColl dbClient)
|
||||
// {
|
||||
// var anyThread = await dbClient.Discussions.Match(t => true).ExecuteAnyAsync();
|
||||
// var anyShareDiscussion = await dbClient.ShareDiscussions.Match(st => true).ExecuteAnyAsync();
|
||||
//
|
||||
// if (anyThread == anyShareDiscussion) return;
|
||||
//
|
||||
// var discussions = await dbClient.Discussions.ManyAsync(t => true);
|
||||
//
|
||||
// foreach (var discussion in discussions)
|
||||
// {
|
||||
// var newShareDiscussion = new ShareDiscussion
|
||||
// {
|
||||
// DiscussionId = discussion.ID,
|
||||
// InvitationCode = $"{Guid.NewGuid():N}{Guid.NewGuid():N}"
|
||||
// };
|
||||
// await newShareDiscussion.SaveAsync();
|
||||
// }
|
||||
// }
|
||||
|
||||
static async Task SyncLanguages(DbEntities dbClient)
|
||||
{
|
||||
if (await dbClient.Languages.ExecuteAnyAsync()) return;
|
||||
@@ -157,57 +101,5 @@ namespace PrivaPub.Data
|
||||
await DB.Default.SaveAsync(bgLang);
|
||||
}
|
||||
}
|
||||
|
||||
// static async Task SyncUserSettings(DbColl dbClient)
|
||||
// {
|
||||
// if (!await dbClient.Users.ExecuteAnyAsync()) return;
|
||||
//
|
||||
// var users = await dbClient.Users.ManyAsync(u => true);
|
||||
// var usersId = users.Select(u => u.ID).ToList();
|
||||
// var usersSettings = await dbClient.UsersSettings
|
||||
// .ManyAsync(us => true);
|
||||
//
|
||||
// var usersWithoutSettings = users.Where(u => !usersSettings.Any(us => us.UserId == u.ID)).Select(u => u.ID).ToList();
|
||||
// if (usersWithoutSettings.Count == 0) return;
|
||||
//
|
||||
// var defaultLanguage = await dbClient.Languages
|
||||
// .Match(l => l.International2Code == "en")
|
||||
// .ExecuteFirstAsync();
|
||||
// foreach (var userId in usersWithoutSettings)
|
||||
// await DB.SaveAsync(new UserSettings
|
||||
// {
|
||||
// UserId = userId,
|
||||
// LanguageId = defaultLanguage.International2Code
|
||||
// });
|
||||
// }
|
||||
|
||||
//static async Task InsertBots(DbEntities dbClient, IPasswordHasher passwordHasher)
|
||||
//{
|
||||
// if (await dbClient.Users.Match(u => u.UserName == "bot0").ExecuteAnyAsync()) return;
|
||||
|
||||
// var newBots = new List<User>();
|
||||
// var newBotsUserSettings = new List<UserSettings>();
|
||||
|
||||
// for (int i = 0; i < 100; i++)
|
||||
// newBots.Add(new User
|
||||
// {
|
||||
// HashedPassword = passwordHasher.Hash("Asdfmov13!!!"),
|
||||
// UserName = $"bot{i}"
|
||||
// });
|
||||
// await newBots.SaveAsync();
|
||||
|
||||
// var defaultLanguage = await dbClient.Languages
|
||||
// .Match(l => l.International2Code == "en")
|
||||
// .ExecuteFirstAsync();
|
||||
|
||||
// foreach (var newBot in newBots)
|
||||
// newBotsUserSettings.Add(new()
|
||||
// {
|
||||
// UserId = newBot.ID,
|
||||
// LanguageId = defaultLanguage.International2Code,
|
||||
// });
|
||||
|
||||
// await newBotsUserSettings.SaveAsync();
|
||||
//}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user