Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions controller/service/config/categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"id": 1,
"name": "Adult Content",
"risk_level": 5,
"trust_level": 1,
"description": "Pornography and adult entertainment",
"mappings": {
"kaspersky": ["CATEGORY_PORNO_AND_EROTICS"]
Expand All @@ -12,7 +12,7 @@
{
"id": 2,
"name": "Gambling",
"risk_level": 4,
"trust_level": 1,
"description": "Online casinos, betting, lotteries",
"mappings": {
"kaspersky": ["CATEGORY_LOTTERIES", "CATEGORY_BETTING"]
Expand All @@ -21,7 +21,7 @@
{
"id": 3,
"name": "Drugs",
"risk_level": 5,
"trust_level": 1,
"description": "Illegal substances",
"mappings": {
"kaspersky": ["CATEGORY_DRUGS"]
Expand All @@ -30,7 +30,7 @@
{
"id": 4,
"name": "Violence",
"risk_level": 5,
"trust_level": 5,
"description": "Violent content",
"mappings": {
"kaspersky": ["CATEGORY_VIOLENCE"]
Expand All @@ -39,7 +39,7 @@
{
"id": 5,
"name": "Weapons",
"risk_level": 5,
"trust_level": 1,
"description": "Firearms, explosives",
"mappings": {
"kaspersky": ["CATEGORY_WEAPONS"]
Expand All @@ -48,7 +48,7 @@
{
"id": 6,
"name": "Malware",
"risk_level": 5,
"trust_level": 1,
"description": "Viruses and malicious software",
"mappings": {
"kaspersky": ["CATEGORY_MALWARE"]
Expand All @@ -57,7 +57,7 @@
{
"id": 7,
"name": "Social media",
"risk_level": 2,
"trust_level": 4,
"description": "Social media",
"mappings": {
"kaspersky": ["CATEGORY_INTERNET_COMMUNICATION_MEDIA", "CATEGORY_SOCIAL_NETS"]
Expand All @@ -66,7 +66,7 @@
{
"id": 8,
"name": "Hate Speech",
"risk_level": 5,
"trust_level": 3,
"description": "Discrimination, extremism",
"mappings": {
"kaspersky": ["CATEGORY_EXTREMISM_RACISM", "CATEGORY_HATE_AND_DISCRIMINATION"]
Expand All @@ -75,7 +75,7 @@
{
"id": 9,
"name": "Anonymizers",
"risk_level": 4,
"trust_level": 2,
"description": "VPN, proxies to bypass blocks",
"mappings": {
"kaspersky": ["CATEGORY_ANONYMIZERS"]
Expand All @@ -84,7 +84,7 @@
{
"id": 10,
"name": "Alcohol and Tobacco",
"risk_level": 3,
"trust_level": 3,
"description": "Sale of alcohol and tobacco",
"mappings": {
"kaspersky": ["CATEGORY_ALCOHOL"]
Expand All @@ -93,11 +93,11 @@
{
"id": 11,
"name": "Online shop",
"risk_level": 1,
"trust_level": 5,
"description": "Online shop",
"mappings": {
"kaspersky": ["CATEGORY_ONLINE_SHOPS"]
}
}
]
}
}
9 changes: 9 additions & 0 deletions controller/service/internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,12 @@ func (s *Service) hasIntersection(a, b []string) bool {
}
return false
}

func (s *Service) GetCategory(id int) (string, int) {
for _, category := range s.categories.Categories {
if category.ID == id {
return category.Name, category.TrustLevel
}
}
return "", 0
}
Loading