diff --git a/src/FilterLists.Api/DbContextExtension.cs b/src/FilterLists.Api/DbContextExtension.cs index bf335af26..65efc1462 100644 --- a/src/FilterLists.Api/DbContextExtension.cs +++ b/src/FilterLists.Api/DbContextExtension.cs @@ -31,13 +31,14 @@ public static void EnsureSeeded(this FilterListsDbContext context) { if (context.FilterLists.Any()) return; Seed(context); + Seed(context); Seed(context); } private static void Seed(DbContext context) { var rows = JsonConvert.DeserializeObject>( - File.ReadAllText(SeedDirectory + Path.DirectorySeparatorChar + typeof(T) + ".json")); + File.ReadAllText(SeedDirectory + Path.DirectorySeparatorChar + typeof(T).Name + ".json")); context.AddRange(rows); context.SaveChanges(); } diff --git a/src/FilterLists.Api/Seed/Syntax.json b/src/FilterLists.Api/Seed/Syntax.json new file mode 100644 index 000000000..2895916c9 --- /dev/null +++ b/src/FilterLists.Api/Seed/Syntax.json @@ -0,0 +1,42 @@ +[ + { + "Id": 1, + "DefinitionUrl": "https://en.wikipedia.org/wiki/Hosts_(file)", + "Name": "Hosts" + }, + { + "Id": 2, + "DefinitionUrl": null, + "Name": "Domains" + }, + { + "Id": 3, + "DefinitionUrl": "https://adblockplus.org/filters", + "Name": "Adblock Plus" + }, + { + "Id": 4, + "DefinitionUrl": "https://github.com/gorhill/uBlock/wiki/Static-filter-syntax", + "Name": "uBlock Origin" + }, + { + "Id": 6, + "DefinitionUrl": "https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters", + "Name": "AdGuard" + }, + { + "Id": 7, + "DefinitionUrl": null, + "Name": "Exceptions (Whitelist)" + }, + { + "Id": 8, + "DefinitionUrl": null, + "Name": "URLs" + }, + { + "Id": 9, + "DefinitionUrl": null, + "Name": "IPs" + } +] \ No newline at end of file