mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
data model updates
This commit is contained in:
parent
aaf01637ed
commit
5719138a8a
12 changed files with 246 additions and 168 deletions
2
.github/ISSUE_TEMPLATE.md
vendored
2
.github/ISSUE_TEMPLATE.md
vendored
|
|
@ -17,7 +17,7 @@ Before submitting a new issue, please review the checklist below.
|
|||
* [ ] Have you ensured all URLs point to HTTPS if supported?
|
||||
|
||||
## Properties
|
||||
[Source](https://github.com/collinbarrett/FilterLists/blob/master/data/ListSample.json) | [Schema](https://github.com/collinbarrett/FilterLists/blob/master/data/ListSchema.json)
|
||||
[Source](https://github.com/collinbarrett/FilterLists/blob/master/data/DataSample.json) | [Schema](https://github.com/collinbarrett/FilterLists/blob/master/data/DataSchema.json)
|
||||
|
||||
| Property | Description |
|
||||
| -------------- | ---------------------------------------- |
|
||||
|
|
|
|||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
|
@ -17,7 +17,7 @@ Before submitting a new pull request, please review the checklist below.
|
|||
* [ ] Have you ensured all URLs point to HTTPS if supported?
|
||||
|
||||
### Sample List JSON Object:
|
||||
[Source](https://github.com/collinbarrett/FilterLists/blob/master/data/ListSample.json) | [Schema](https://github.com/collinbarrett/FilterLists/blob/master/data/ListSchema.json)
|
||||
[Source](https://github.com/collinbarrett/FilterLists/blob/master/data/DataSample.json) | [Schema](https://github.com/collinbarrett/FilterLists/blob/master/data/DataSchema.json)
|
||||
|
||||
```
|
||||
{
|
||||
|
|
|
|||
2
.github/README.md
vendored
2
.github/README.md
vendored
|
|
@ -12,7 +12,7 @@ FilterLists is the independent and comprehensive directory of all public filter
|
|||
FilterLists improvements are slow and tend to be in spurts. I care about this project as both a resource for the community and a learning tool for me. However, my day job comes first which often results in little to no work on the project at times. I happily welcome anyone that wants to contribute. The immediate projects are converting the data to an actual database (rather than a Google Sheet) and then exposing the data via a [.Net Core API](https://github.com/collinbarrett/FilterLists/projects/3). I would also love to build a more responsive front-end, but I am not a front-end developer and would welcome help on [this](https://github.com/collinbarrett/FilterLists/projects/4).
|
||||
|
||||
## Properties
|
||||
[Source](https://github.com/collinbarrett/FilterLists/blob/master/data/ListSample.json) | [Schema](https://github.com/collinbarrett/FilterLists/blob/master/data/ListSchema.json)
|
||||
[Source](https://github.com/collinbarrett/FilterLists/blob/master/data/DataSample.json) | [Schema](https://github.com/collinbarrett/FilterLists/blob/master/data/DataSchema.json)
|
||||
|
||||
| Property | Description |
|
||||
| -------------- | ---------------------------------------- |
|
||||
|
|
|
|||
30
data/DataSample.json
Normal file
30
data/DataSample.json
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"FilterLists": [
|
||||
{
|
||||
"Description": "A sample list to filter out advertisements.",
|
||||
"DescriptionSourceUrl": "https://mysample.list/advertisements",
|
||||
"DonateUrl": "https://mysample.list/donate/",
|
||||
"Email": "contact@mysample.list",
|
||||
"ForumUrl": "https://mysample.list/forum/",
|
||||
"HomeUrl": "https://mysample.list/",
|
||||
"IssuesUrl": "https://github.com/johnsmith/mysamplelist/issues",
|
||||
"Name": "My Sample Advertisement Filter List",
|
||||
"ViewUrl": "https://mysample.list/list.txt"
|
||||
},
|
||||
{
|
||||
"Description": "A sample list to filter out malware.",
|
||||
"DescriptionSourceUrl": "https://mysample.list/malware",
|
||||
"DonateUrl": "https://mysample.list/donate/",
|
||||
"Email": "contact@mysample.list",
|
||||
"ForumUrl": "https://mysample.list/forum/",
|
||||
"HomeUrl": "https://mysample.list/",
|
||||
"IssuesUrl": "https://github.com/johnsmith/mysamplelist/issues",
|
||||
"Name": "My Sample Malware Filter List",
|
||||
"ViewUrl": "https://mysample.list/list.txt"
|
||||
}
|
||||
],
|
||||
"Email": "john.smith@protonmail.com",
|
||||
"HomeUrl": "https://johnsmith.com",
|
||||
"Name": "John Smith",
|
||||
"TwitterHandle": "@johnsmith"
|
||||
}
|
||||
155
data/DataSchema.json
Normal file
155
data/DataSchema.json
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
{
|
||||
"definitions": {
|
||||
"FilterList": {
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
],
|
||||
"properties": {
|
||||
"Description": {
|
||||
"description": "A brief description of the list's functionality. Preferably, this is quoted (if non-English, translate to English via translator or Google Translate for consistency) from the list's documentation or composed by a maintainer of the list. If neither are available, a generic description should be composed by the FilterLists contributor.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"maxLength": 1022
|
||||
},
|
||||
"DescriptionSourceUrl": {
|
||||
"description": "The URL to the list's documentation page from which the description was quoted if applicable.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"DonateUrl": {
|
||||
"description": "The URL to the list's donation page. This could be a custom PayPal or similar link, or a link to a web page discussing various donation options. Pull requests that include changes to this link will undergo further verification to prevent fraud.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"Email": {
|
||||
"description": "The email address of the list's maintainer(s) if publicly available.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 7,
|
||||
"maxLength": 126,
|
||||
"format": "email"
|
||||
},
|
||||
"ForumUrl": {
|
||||
"description": "The URL to the list's forum where issues, change requests, etc. are discussed.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"HomeUrl": {
|
||||
"description": "The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"IssuesUrl": {
|
||||
"description": "The URL to the list's GitHub Issues.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"Name": {
|
||||
"description": "The name of the list as stated by the list maintainer(s) in title case.",
|
||||
"type": "string",
|
||||
"maxLength": 126
|
||||
},
|
||||
"ViewUrl": {
|
||||
"description": "The URL to the list in raw text format. zip files and other formats are acceptable if no text format is available.",
|
||||
"type": "string",
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"Description",
|
||||
"DescriptionSourceUrl",
|
||||
"DonateUrl",
|
||||
"Email",
|
||||
"ForumUrl",
|
||||
"HomeUrl",
|
||||
"IssuesUrl",
|
||||
"Name",
|
||||
"ViewUrl"
|
||||
]
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"FilterLists": {
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/definitions/FilterList"
|
||||
}
|
||||
},
|
||||
"Email": {
|
||||
"description": "The email address of the list maintainer.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 7,
|
||||
"maxLength": 126,
|
||||
"format": "email"
|
||||
},
|
||||
"HomeUrl": {
|
||||
"description": "The URL to the list maintainer's home page.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"Name": {
|
||||
"description": "The name of the list maintainer.",
|
||||
"type": "string",
|
||||
"maxLength": 126
|
||||
},
|
||||
"TwitterHandle": {
|
||||
"description": "The Twitter handle of the list maintainer.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"maxLength": 126
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"FilterLists",
|
||||
"Email",
|
||||
"HomeUrl",
|
||||
"Name",
|
||||
"TwitterHandle"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"Author": "John Doe",
|
||||
"Description": "A sample list to filter out advertisements.",
|
||||
"DescriptionSourceUrl": "https://mysample.list",
|
||||
"DonateUrl": "https://mysample.list/donate/",
|
||||
"Email": "contact@mysample.list",
|
||||
"ForumUrl": "https://mysample.list/forum/",
|
||||
"HomeUrl": "https://mysample.list/",
|
||||
"IssuesUrl": "https://github.com/mysamplelist/issues",
|
||||
"Name": "My Sample Filter List",
|
||||
"ViewUrl": "https://mysample.list/list.txt"
|
||||
}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Author": {
|
||||
"description": "The author (person or group) who maintains the list.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"maxLength": 126
|
||||
},
|
||||
"Description": {
|
||||
"description": "A brief description of the list's functionality. Preferably, this is quoted (if non-English, translate to English via translator or Google Translate for consistency) from the list's documentation or composed by a maintainer of the list. If neither are available, a generic description should be composed by the FilterLists contributor.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"maxLength": 1022
|
||||
},
|
||||
"DescriptionSourceUrl": {
|
||||
"description": "The URL to the list's documentation page from which the description was quoted if applicable.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"DonateUrl": {
|
||||
"description": "The URL to the list's donation page. This could be a custom PayPal or similar link, or a link to a web page discussing various donation options. Pull requests that include changes to this link will undergo further verification to prevent fraud.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"Email": {
|
||||
"description": "The email address of the list's maintainer(s) if publicly available.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 7,
|
||||
"maxLength": 126
|
||||
},
|
||||
"ForumUrl": {
|
||||
"description": "The URL to the list's forum where issues, change requests, etc. are discussed.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"HomeUrl": {
|
||||
"description": "The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"IssuesUrl": {
|
||||
"description": "The URL to the list's GitHub Issues.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
},
|
||||
"Name": {
|
||||
"description": "The name of the list as stated by the list maintainer(s) in title case.",
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
],
|
||||
"maxLength": 126
|
||||
},
|
||||
"ViewUrl": {
|
||||
"description": "The URL to the list in raw text format. zip files and other formats are acceptable if no text format is available.",
|
||||
"type": "string",
|
||||
"minLength": 6,
|
||||
"maxLength": 2083,
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"Author",
|
||||
"Description",
|
||||
"DescriptionSourceUrl",
|
||||
"DonateUrl",
|
||||
"Email",
|
||||
"ForumUrl",
|
||||
"HomeUrl",
|
||||
"IssuesUrl",
|
||||
"Name",
|
||||
"ViewUrl"
|
||||
]
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using FilterLists.Data.Models.Implementations;
|
||||
|
|
@ -8,29 +9,47 @@ namespace FilterLists.Data.Json
|
|||
{
|
||||
public static class JsonSampleGenerator
|
||||
{
|
||||
private static JObject DataSample => (JObject) JToken.FromObject(new Maintainer
|
||||
{
|
||||
Email = "john.smith@protonmail.com",
|
||||
HomeUrl = "https://johnsmith.com",
|
||||
TwitterHandle = "@johnsmith",
|
||||
Name = "John Smith",
|
||||
FilterLists = new List<FilterList>
|
||||
{
|
||||
new FilterList
|
||||
{
|
||||
Description = "A sample list to filter out advertisements.",
|
||||
DescriptionSourceUrl = "https://mysample.list/advertisements",
|
||||
DonateUrl = "https://mysample.list/donate/",
|
||||
Email = "contact@mysample.list",
|
||||
ForumUrl = "https://mysample.list/forum/",
|
||||
HomeUrl = "https://mysample.list/",
|
||||
IssuesUrl = "https://github.com/johnsmith/mysamplelist/issues",
|
||||
Name = "My Sample Advertisement Filter List",
|
||||
ViewUrl = "https://mysample.list/list.txt"
|
||||
},
|
||||
new FilterList
|
||||
{
|
||||
Description = "A sample list to filter out malware.",
|
||||
DescriptionSourceUrl = "https://mysample.list/malware",
|
||||
DonateUrl = "https://mysample.list/donate/",
|
||||
Email = "contact@mysample.list",
|
||||
ForumUrl = "https://mysample.list/forum/",
|
||||
HomeUrl = "https://mysample.list/",
|
||||
IssuesUrl = "https://github.com/johnsmith/mysamplelist/issues",
|
||||
Name = "My Sample Malware Filter List",
|
||||
ViewUrl = "https://mysample.list/list.txt"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
public static void WriteSampleToFile()
|
||||
{
|
||||
File.WriteAllText(
|
||||
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory + @"\", @"..\..\..\..\..\data\")) +
|
||||
"ListSample.json", GetSampleList().ToString());
|
||||
}
|
||||
|
||||
private static JObject GetSampleList()
|
||||
{
|
||||
return (JObject) JToken.FromObject(new FilterList
|
||||
{
|
||||
Author = "John Doe",
|
||||
Description = "A sample list to filter out advertisements.",
|
||||
DescriptionSourceUrl = "https://mysample.list",
|
||||
DonateUrl = "https://mysample.list/donate/",
|
||||
Email = "contact@mysample.list",
|
||||
ForumUrl = "https://mysample.list/forum/",
|
||||
HomeUrl = "https://mysample.list/",
|
||||
IssuesUrl = "https://github.com/mysamplelist/issues",
|
||||
Name = "My Sample Filter List",
|
||||
ViewUrl = "https://mysample.list/list.txt"
|
||||
});
|
||||
"DataSample.json", DataSample.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,7 @@ public static void WriteSchemaToFile()
|
|||
{
|
||||
File.WriteAllText(
|
||||
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory + @"\", @"..\..\..\..\..\data\")) +
|
||||
"ListSchema.json", new JSchemaGenerator().Generate(typeof(FilterList)).ToString());
|
||||
"DataSchema.json", new JSchemaGenerator().Generate(typeof(Maintainer)).ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
{
|
||||
public interface IMaintainer
|
||||
{
|
||||
string Name { get; set; }
|
||||
string Email { get; set; }
|
||||
string TwitterHandle { get; set; }
|
||||
string HomeUrl { get; set; }
|
||||
string Name { get; set; }
|
||||
string TwitterHandle { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,16 @@
|
|||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using FilterLists.Data.Models.Contracts;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace FilterLists.Data.Models.Implementations
|
||||
{
|
||||
public class FilterList : BaseEntity, IFilterList
|
||||
{
|
||||
public long MaintainerId { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual Maintainer Maintainer { get; set; }
|
||||
|
||||
[ForeignKey("MaintainerForeignKey")]
|
||||
public Maintainer Maintainer { get; set; }
|
||||
|
||||
[Description(
|
||||
@"A brief description of the list's functionality. Preferably, this is quoted (if non-English, translate to English via translator or Google Translate for consistency) from the list's documentation or composed by a maintainer of the list. If neither are available, a generic description should be composed by the FilterLists contributor.")]
|
||||
[Description(@"A brief description of the list's functionality. Preferably, this is quoted (if non-English, translate to English via translator or Google Translate for consistency) from the list's documentation or composed by a maintainer of the list. If neither are available, a generic description should be composed by the FilterLists contributor.")]
|
||||
[MaxLength(1022)]
|
||||
public string Description { get; set; }
|
||||
|
||||
|
|
@ -23,8 +20,7 @@ public class FilterList : BaseEntity, IFilterList
|
|||
[MinLength(6)]
|
||||
public string DescriptionSourceUrl { get; set; }
|
||||
|
||||
[Description(
|
||||
@"The URL to the list's donation page. This could be a custom PayPal or similar link, or a link to a web page discussing various donation options. Pull requests that include changes to this link will undergo further verification to prevent fraud.")]
|
||||
[Description(@"The URL to the list's donation page. This could be a custom PayPal or similar link, or a link to a web page discussing various donation options. Pull requests that include changes to this link will undergo further verification to prevent fraud.")]
|
||||
[Url]
|
||||
[MaxLength(2083)]
|
||||
[MinLength(6)]
|
||||
|
|
@ -42,8 +38,7 @@ public class FilterList : BaseEntity, IFilterList
|
|||
[MinLength(6)]
|
||||
public string ForumUrl { get; set; }
|
||||
|
||||
[Description(
|
||||
@"The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.")]
|
||||
[Description(@"The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.")]
|
||||
[Url]
|
||||
[MaxLength(2083)]
|
||||
[MinLength(6)]
|
||||
|
|
@ -60,8 +55,7 @@ public class FilterList : BaseEntity, IFilterList
|
|||
[MaxLength(126)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Description(
|
||||
@"The URL to the list in raw text format. zip files and other formats are acceptable if no text format is available.")]
|
||||
[Description(@"The URL to the list in raw text format. zip files and other formats are acceptable if no text format is available.")]
|
||||
[Required]
|
||||
[Url]
|
||||
[MaxLength(2083)]
|
||||
|
|
|
|||
|
|
@ -9,26 +9,25 @@ public class Maintainer : BaseEntity, IMaintainer
|
|||
{
|
||||
public List<FilterList> FilterLists { get; set; }
|
||||
|
||||
[Description(@"The author (person or group) who maintains the list.")]
|
||||
[Required]
|
||||
[MaxLength(126)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Description(@"The email address of the list's maintainer(s) if publicly available.")]
|
||||
[Description(@"The email address of the list maintainer.")]
|
||||
[EmailAddress]
|
||||
[MaxLength(126)]
|
||||
[MinLength(7)]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Description(@"The email address of the list's maintainer(s) if publicly available.")]
|
||||
[MaxLength(126)]
|
||||
public string TwitterHandle { get; set; }
|
||||
|
||||
[Description(
|
||||
@"The URL to the list's home page. Preferably, this is stated in the header of the list. Alternatively, it could be a custom domain, GitHub page, blog post, forum post, etc. that serves as a primary source of information for the list.")]
|
||||
[Description(@"The URL to the list maintainer's home page.")]
|
||||
[Url]
|
||||
[MaxLength(2083)]
|
||||
[MinLength(6)]
|
||||
public string HomeUrl { get; set; }
|
||||
|
||||
[Description(@"The name of the list maintainer.")]
|
||||
[Required]
|
||||
[MaxLength(126)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Description(@"The Twitter handle of the list maintainer.")]
|
||||
[MaxLength(126)]
|
||||
public string TwitterHandle { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue