Coverage for an_website / wiki / wiki.py: 92.857%
14 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-24 17:35 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-24 17:35 +0000
1# This program is free software: you can redistribute it and/or modify
2# it under the terms of the GNU Affero General Public License as
3# published by the Free Software Foundation, either version 3 of the
4# License, or (at your option) any later version.
5#
6# This program is distributed in the hope that it will be useful,
7# but WITHOUT ANY WARRANTY; without even the implied warranty of
8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9# GNU Affero General Public License for more details.
10#
11# You should have received a copy of the GNU Affero General Public License
12# along with this program. If not, see <https://www.gnu.org/licenses/>.
14"""A redirect to an external wiki about the AN."""
16from typing import Final
18from ..utils.request_handler import HTMLRequestHandler
19from ..utils.utils import ModuleInfo
21WIKI_URL: Final = "https://wiki.asozial.org"
24def get_module_info() -> ModuleInfo:
25 """Create and return the ModuleInfo for this module."""
26 return ModuleInfo(
27 handlers=(
28 (
29 r"/wiki",
30 WikiHandler,
31 ),
32 ),
33 name="Asoziales Wiki",
34 description="Ein Wiki mit Sachen des Asozialen Netzwerkes",
35 path="/wiki",
36 keywords=(
37 "Wiki",
38 "asozial",
39 ),
40 )
43class WikiHandler(HTMLRequestHandler):
44 """The request handler for the wiki page."""
46 async def get(self, *, head: bool = False) -> None:
47 """Handle GET requestss to the wiki page."""
48 if not self.user_settings.ask_before_leaving:
49 self.redirect(WIKI_URL)
50 return
51 if head:
52 return
53 await self.render(
54 "pages/redirect.html",
55 send_referrer=True,
56 redirect_url=WIKI_URL,
57 from_url=None,
58 discord=False,
59 )