Feat: Support for FAQ languages

pull/41/head
db0 2023-09-28 18:35:29 +02:00
parent 09ccca9127
commit fa0b7a566e
7 changed files with 242 additions and 7 deletions

View File

@ -142,6 +142,7 @@ class Models:
})
self.response_model_faq_entry = api.model('FAQEntry', {
'category': fields.String(description="The overarching category for this entry", example="terminology"),
'category_translated': fields.String(description="The overarching category for this entry, translated to the target language.", example="terminology"),
'added': fields.DateTime(description="The date this entry was added"),
'question': fields.String(description="The entry in question form", example="What is an FAQ?"),
'stub': fields.String(description="The entry in a short form", example="faq"),

View File

@ -1,12 +1,13 @@
from fediseer.apis.v1.base import *
from fediseer import enums
from fediseer.faq import FEDISEER_FAQ
from fediseer.faq import FAQ_LANGUAGES
class FAQ(Resource):
get_parser = reqparse.RequestParser()
get_parser.add_argument("Client-Agent", default="unknown:0:unknown", type=str, required=False, help="The client name and version.", location="headers")
get_parser.add_argument("category", required=False, type=str, help="If provided, will only return entries from that category", location="args")
get_parser.add_argument("lang", required=False, type=str, default="eng", help="Look for the FAQ in this ISO 639-3 3-letter language code", location="args")
@api.expect(get_parser)
@ -17,11 +18,13 @@ class FAQ(Resource):
'''Retrieve FAQ answers
'''
self.args = self.get_parser.parse_args()
if self.args.lang not in FAQ_LANGUAGES:
raise e.BadRequest("Unfortunatey we do not have support for this language at this time. Please consider sending a PR for it.")
if not self.args.category:
return FEDISEER_FAQ,200
return FAQ_LANGUAGES[self.args.lang],200
filtered_faq = []
all_categories = set()
for entry in FEDISEER_FAQ:
for entry in FAQ_LANGUAGES[self.args.lang]:
all_categories.add(entry["category"])
if entry["category"] == self.args.category:
filtered_faq.append(entry)

View File

@ -0,0 +1,7 @@
from .eng import ENG_FAQ
from .ell import ELL_FAQ
FAQ_LANGUAGES = {
"eng": ENG_FAQ,
"ell": ELL_FAQ,
}

210
fediseer/faq/ell.py 100644
View File

@ -0,0 +1,210 @@
from fediseer.consts import MAX_TAGS
ELL_FAQ = [
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "Τι είναι το Fediseer?",
"stub": "fediseer",
"document":
"""Το fediseer (Φέντισειρ) είναι μία υπηρεσία που αποσκοπει να δημιουργήσει μια πληθοπορισμένη ταξiνόμηση για διακομιστές spam (δηλ, ανεπιθύμητων μηνυμάτων) στο το fediverse.
Επίσης αποσκοπεί να παρέχει ένα δημόσιο χώρο στον οποίο οι διάφοροι διακομιστές του fediverse μπορουν να καθορίσουν την έγκριση/απόρριψη τους προς άλλους διακομιστές.
Με απλά λόγια, χρησιμοποιόντας τον fediseer, προσπαθούμε να καταλάβουμε εαν ένας διακομιστής διευκολύνει το spam ή όχι, χρησιμποποιόντας ένα σύστημα καθοδηγειμένο απο ανθρώπους που ονομάζεται «αλυσίδα εμπιστοσύνης».
Οι τρείς βασικές έννοιες ποι χρησιμοποιούνται στο Fediseer είναι οι εγγυήσεις (guarantees), οι εγκρίσεις (endorsements) και οι μομφές (censures).
To παρέχει ένα αναγνώσιμο από μηχανή API για την κατανάλωση των δεδομένων που περιέχονται σε αυτό.
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "Τι είναι η εγγυήση?",
"stub": "guarantee",
"document":
"""Βασικά, οποιαδήποτε εγγυημένος διακομιστής απλά θεωρείται οτι δεν διευκολύνει τo spam (ανεπιθύμητα μήνυματα).
Αυτό δεν σημαίνει ότι ένας με-εγγυημένος διακομιστής βοηθάει το spam. Αντίθετως, θεωρείται οτι ειναι άγνωστο εαν το κάνει.
Ο στόχος μας εδώ είναι να αποτραπεί η δημιουργία ατελείωτου αριθμού νέων διακομιστών στο fediverse για την αποστολή ανεπιθύμητων μηνυμάτων.
Κάθε διακομιστής μπορεί να εγγυηθεί μόνο από έναν άλλο υπάρχων και εγγυημένο διακομιστή. Αυτό ονομάζεται «αλυσίδα εμπιστοσύνης».
Οι εγγυήσεις είναι κοινοτικής φύσης. Ενώ το fediseer το ίδιο μπορεί επίσης να εγγυηθεί στο υψηλότερο επίπεδο,
ελπίζουμε ότι οι διαχειριστές των διακομιστών θα εγγυηθούν τους άλλους διακομιστές που γνωρίζουν
και θα βοηθήσουν να διασφαλιστεί η υγεία όλου του δικτύου.
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "What is the chain of trust?",
"stub": "chain of trust",
"document":
"""Because each instance on the fediseer can guarantee and be guaranteed by a single instance, this causes a chain to form starting from the fediseer itself. Any instance guaranteed by such an unbroken chain is considered as ham. If the guarantee for any instance in this chain is revoked, the chain of trust is broken and any instances below are considered not-guaranteed.
This allows the fediseer to quickly deal with spam instances that sneaked into the fediseer and then guaranteed a bunch more of the spammy friends. As the chain can be revoked higher up, even a whole spam network can be countered by revoking the guarantee from the first spammer guaranteed.
[Chain of Trust Devlog](https://dbzer0.com/blog/overseer-a-fediverse-chain-of-trust/)
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "What is an endorsement?",
"stub": "endorsement",
"document":
"""An endorsement is a completely subjective positive judgement from one instance to another. Effectively signifying that instance A "approves" of instance B. The reason for this can be anything and do not have to be stated.
An instance can be approve of any number of instances and be endorsed by any number of instances. One can even get an autogenerated badge with the amount of endorsements they've received to display.
When looking at the instance whitelist, one can also filter by amount of endorsements. Likewise one can also export the list of instances endorsed by a subset of instances.
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "What is a censure?",
"stub": "censure",
"document":
"""An censure is a completely subjective negative judgement from one instance to another. Effectively signifying that instance A "disapproves" of instance B. The reason for this can be anything and do not have to be stated.
An instance can be censure any number of instances and be censured by any number of instances.
One can export the list of instances censured by a subset of instances.
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "What is a hesitation?",
"stub": "hesitation",
"document":
"""An hesitation is a mulder version of a censure, it signifies some sort of mistrust of one instance towards another. The reason for this can be anything and do not have to be stated.
An instance can be hesitate against number of instances and be doubted by number of instances.
One can export the list of instances hesitate by a subset of instances.
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "What is an instance claim?",
"stub": "claim",
"document":
"""A claimed instance is an instance whose admin has requisted an API key with which to use the fediseer as their instance.
Fediseer has no users. Instead it's driven by instance admins only. Instance admins likewise only act as their instances.
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "What are instance visibilities?",
"stub": "visibilities",
"document":
"""An instance can set the visibility of its endorsements, censures, and/or hesitations to one of the following:
* `OPEN`: Anyone can see and retrieve that list
* `ENDORSED`: Only instances endorsed by the source instance, can see that list
* `PRIVATE`: Only the source instance can see that list.
Note that guarantees are always public as this is necessary for the good functioning of the chain of trust.
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-25",
"question": "What is an instance flag?",
"stub": "flag",
"document":
"""An instance flag represents some marking from the fediverse admins toward an instance. There's currently the following flags
* `RESTRICTED`: The instance cannot guarantee, endorse, censure or hesitate other instances anymore. This flag is only used against egregious trolling or malicious behaviour.
* `MUTED`: The instance's visibilities are forcefully set to `PRIVATE` and cannot be changed. This flag is meant to used against trolling or harassing behaviour.
"""
},
{
"category": "terminology",
"category_translated": "τερμινολογία",
"added": "2023-09-27",
"question": "What is an instance tag?",
"stub": "tag",
"document":
f"""An instance tag is up to {MAX_TAGS} voluntary classifications by the instance admins for their own instance.
These tags can be anything that the owner wishes to use to describe their instance in a few words.
The tags can then be used by integrators to filter instances for their block or allow lists,
or to help people discover instances relevant to their interests.
Like always, no hate speech is allowed.
"""
},
{
"category": "functionality",
"category_translated": "λειτουργικότητα",
"added": "2023-09-25",
"question": "How can I claim my instance?",
"stub": "instance claim",
"document":
"""You can either use the rest API we have provided, providing your instance domain and admin username on it. Alternativey you can use one of our frontends.
You will then receive an API key in PMs, which you can afterwards use to represent your instance on the fediseer.
"""
},
{
"category": "functionality",
"category_translated": "λειτουργικότητα",
"added": "2023-09-25",
"question": "What can I write in my reasons for endorsements, hesitations and censures?",
"stub": "reasons",
"document":
"""This is an optional free-form field for up to 255 characters. If will be handled as a comma-separated list, so we suggest using commas to split your reasons. As the reasons are meant to be used for filtering by others, we suggest you limit each entry to 2-5 words.
You are not allowed to use hate speech in your reasons.
"""
},
{
"category": "functionality",
"category_translated": "λειτουργικότητα",
"added": "2023-09-25",
"question": "What can I write in my evidence for censures and hesitations?",
"stub": "evidence",
"document":
"""This is an optional free-form field you can use to provide receipts for this judgement or explain your reasoning in depth. If you want to provide screenshots, we suggest linking to them, for example by [opening a thread in fediblock](https://lemmy.dbzer0.com/c/fediblock).
You are not allowed to use hate speech in your evidence.
"""
},
{
"category": "philosophy",
"category_translated": "φιλοσοφία",
"added": "2023-09-25",
"question": "Doesn't this all cause fediverse centralization?",
"stub": "centralization",
"document":
"""No. The fediseer has no official integration with fediverse software. The fediseer simply provides the information within in a machine-readable REST API. How this information is utilized is up to the various instance admins. One is perfectly free to not utilize the fediseer whatsoever.
Not only that, but the fediseer is free and open source software, allowing anyone to re-host it and run it according to their own principles. If you do not trust this fediseer instance, you can rehost yourself and people can switch instances by changing a domain name.
"""
},
{
"category": "philosophy",
"category_translated": "φιλοσοφία",
"added": "2023-09-25",
"question": "Doesn't this make the fediseer an authority on the fediverse?",
"stub": "authority",
"document":
"""The fediseer is designed to be completely crowd-sourced as pertains to the chain of trust. The admin of the fediseer does not control what people guarantee, endorse or censure. The various instance admins are driving the chain of trust.
"""
},
]

View File

@ -1,8 +1,9 @@
from fediseer.consts import MAX_TAGS
FEDISEER_FAQ = [
ENG_FAQ = [
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What is the Fediseer?",
"stub": "fediseer",
@ -18,6 +19,7 @@ The fediseer provides a machine readable API to consume the data contained withi
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What is a guarantee?",
"stub": "guarantee",
@ -31,6 +33,7 @@ Guarantees are community driven. While the fediseer can guarantee at the top lev
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What is the chain of trust?",
"stub": "chain of trust",
@ -44,6 +47,7 @@ This allows the fediseer to quickly deal with spam instances that sneaked into t
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What is an endorsement?",
"stub": "endorsement",
@ -57,6 +61,7 @@ When looking at the instance whitelist, one can also filter by amount of endorse
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What is a censure?",
"stub": "censure",
@ -70,6 +75,7 @@ One can export the list of instances censured by a subset of instances.
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What is a hesitation?",
"stub": "hesitation",
@ -83,6 +89,7 @@ One can export the list of instances hesitate by a subset of instances.
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What is an instance claim?",
"stub": "claim",
@ -94,6 +101,7 @@ Fediseer has no users. Instead it's driven by instance admins only. Instance adm
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What are instance visibilities?",
"stub": "visibilities",
@ -109,6 +117,7 @@ Note that guarantees are always public as this is necessary for the good functio
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-25",
"question": "What is an instance flag?",
"stub": "flag",
@ -121,6 +130,7 @@ Note that guarantees are always public as this is necessary for the good functio
},
{
"category": "terminology",
"category_translated": "terminology",
"added": "2023-09-27",
"question": "What is an instance tag?",
"stub": "tag",
@ -136,6 +146,7 @@ Like always, no hate speech is allowed.
},
{
"category": "functionality",
"category_translated": "functionality",
"added": "2023-09-25",
"question": "How can I claim my instance?",
"stub": "instance claim",
@ -147,6 +158,7 @@ You will then receive an API key in PMs, which you can afterwards use to represe
},
{
"category": "functionality",
"category_translated": "functionality",
"added": "2023-09-25",
"question": "What can I write in my reasons for endorsements, hesitations and censures?",
"stub": "reasons",
@ -158,6 +170,7 @@ You are not allowed to use hate speech in your reasons.
},
{
"category": "functionality",
"category_translated": "functionality",
"added": "2023-09-25",
"question": "What can I write in my evidence for censures and hesitations?",
"stub": "evidence",
@ -169,6 +182,7 @@ You are not allowed to use hate speech in your evidence.
},
{
"category": "philosophy",
"category_translated": "philosophy",
"added": "2023-09-25",
"question": "Doesn't this all cause fediverse centralization?",
"stub": "centralization",
@ -180,6 +194,7 @@ Not only that, but the fediseer is free and open source software, allowing anyon
},
{
"category": "philosophy",
"category_translated": "philosophy",
"added": "2023-09-25",
"question": "Doesn't this make the fediseer an authority on the fediverse?",
"stub": "authority",

View File

@ -37,7 +37,6 @@ class InstanceInfo():
self.instance_info = {}
return
if domain == "fediseer.com":
# Fake instances for testing chain of trust
self.open_registrations = False
self.approval_required = False
self.email_verify = False

View File

@ -2,7 +2,7 @@ from flask import render_template, redirect, url_for, request
from markdown import markdown
from loguru import logger
from fediseer.flask import OVERSEER
from fediseer.faq import FEDISEER_FAQ
from fediseer.faq import FAQ_LANGUAGES
import fediseer.exceptions as e
@logger.catch(reraise=True)
@ -59,7 +59,7 @@ def faq():
</head>
"""
faq_dict = {}
for entry in FEDISEER_FAQ:
for entry in FAQ_LANGUAGES["eng"]:
if entry["category"] not in faq_dict:
faq_dict[entry["category"]] = []
faq_dict[entry["category"]].append(entry)