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
105 lines
2.2 KiB
C#
105 lines
2.2 KiB
C#
using MongoDB.Entities;
|
|
|
|
using PrivaPub.Models.Data;
|
|
using PrivaPub.StaticServices;
|
|
|
|
using System.Text;
|
|
using System.Text.Json;
|
|
|
|
namespace PrivaPub.Data
|
|
{
|
|
public static class InitDb
|
|
{
|
|
public static async Task Init(this DbEntities dbClient)
|
|
{
|
|
await SyncLanguages(dbClient);
|
|
await UpdateNewLanguages(dbClient);
|
|
}
|
|
|
|
static async Task SyncLanguages(DbEntities dbClient)
|
|
{
|
|
if (await dbClient.Languages.ExecuteAnyAsync()) return;
|
|
|
|
var languagesJson = await File.ReadAllTextAsync(Path.Combine(Directory.GetCurrentDirectory(), "Data", "languagesNative.json"), Encoding.UTF8);
|
|
var languagesRows = JsonSerializer.Deserialize<IEnumerable<LanguagesRow>>(languagesJson);
|
|
|
|
var languages = new List<Language>();
|
|
foreach (var languageRow in languagesRows ?? new LanguagesRow[]
|
|
{
|
|
})
|
|
languages.Add(new Language
|
|
{
|
|
EnglishName = languageRow.EnglishName,
|
|
NativeName = languageRow.NativeName,
|
|
International2Code = languageRow.International2Code
|
|
});
|
|
|
|
await DB.Default.SaveAsync(languages);
|
|
}
|
|
|
|
static async Task UpdateNewLanguages(DbEntities dbClient)
|
|
{
|
|
var bulgarianLanguage = await dbClient.Languages.Match(l => l.International2Code == "bg").ExecuteFirstAsync();
|
|
if (bulgarianLanguage.NativeName == "Български") return;
|
|
|
|
var languagesToUpdate = new Dictionary<string, string>()
|
|
{
|
|
{
|
|
"bg", "Български"
|
|
},
|
|
{
|
|
"cs", "Česky"
|
|
},
|
|
{
|
|
"da", "Dansk"
|
|
},
|
|
{
|
|
"nl", "Nederlands"
|
|
},
|
|
{
|
|
"et", "Eesti"
|
|
},
|
|
{
|
|
"fi", "Suomalainen"
|
|
},
|
|
{
|
|
"el", "Ελληνική"
|
|
},
|
|
{
|
|
"hu", "Magyar"
|
|
},
|
|
{
|
|
"lv", "Latviešu"
|
|
},
|
|
{
|
|
"lt", "Lietuvių kalba"
|
|
},
|
|
{
|
|
"pl", "Polski"
|
|
},
|
|
{
|
|
"pt", "Português"
|
|
},
|
|
{
|
|
"ro", "Românesc"
|
|
},
|
|
{
|
|
"sk", "Slovenská"
|
|
},
|
|
{
|
|
"sl", "Slovenski"
|
|
},
|
|
{
|
|
"sv", "Svenska"
|
|
}
|
|
};
|
|
|
|
foreach (var languageToUpdate in languagesToUpdate)
|
|
{
|
|
var bgLang = await dbClient.Languages.Match(l => l.International2Code == languageToUpdate.Key).ExecuteFirstAsync();
|
|
bgLang.NativeName = languageToUpdate.Value;
|
|
await DB.Default.SaveAsync(bgLang);
|
|
}
|
|
}
|
|
}
|
|
} |