Coverage for an_website/services/services.py: 100.000%

17 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-16 19:56 +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/>. 

13 

14"""A page with a list of services that are cool and hosted by us.""" 

15 

16from __future__ import annotations 

17 

18import dataclasses 

19 

20from ..utils.request_handler import HTMLRequestHandler 

21from ..utils.utils import ModuleInfo 

22 

23 

24def get_module_info() -> ModuleInfo: 

25 """Create and return the ModuleInfo for this module.""" 

26 return ModuleInfo( 

27 handlers=(("/services", ServicesHandler),), 

28 name="Service-Liste", 

29 description="Liste von coolen Services des Asozialen Netzwerks", 

30 path="/services", 

31 keywords=("Service", "Liste"), 

32 aliases=("/services-list",), 

33 ) 

34 

35 

36@dataclasses.dataclass(slots=True) 

37class Service: 

38 """A class representing a service.""" 

39 

40 title: str 

41 text: str 

42 infos: None | dict[str, str] 

43 

44 

45SERVICES: tuple[Service, ...] = ( 

46 Service( 

47 "Minceraft-Server", 

48 ( 

49 "Der Survival-Minceraft-Server des Asozialen Netzwerks funktioniert" 

50 " auch ohne einen Minceraft-Account und hat dafür eine Integration" 

51 " mit ely.by, damit auch Spieler, die ihren Minceraft-Account nicht" 

52 " verraten möchten, einen eigenen Skin nutzen können." 

53 ), 

54 { 

55 "Domain": "minceraft.asozial.org", 

56 "Version": "1.15.2 (1.7-1.19 wird unterstützt)", 

57 "Karte": "https://minceraft.asozial.org", 

58 }, 

59 ), 

60 Service( 

61 "SuperTuxKart-Server", 

62 ( 

63 "Der SuperTuxKart-Server des Asozialen Netzwerks ist durchgehend " 

64 "online." 

65 ), 

66 { 

67 "Name": "Das Asoziale Netzwerk", 

68 "SuperTuxKart-Download": "https://supertuxkart.net/Download", 

69 }, 

70 ), 

71 Service( 

72 "Syncplay-Server", 

73 ( 

74 "Mit dem Syncplay-Server des Asozialen Netzwerks kann man Online " 

75 "zusammen Sachen gucken." 

76 ), 

77 { 

78 "Domain": "syncplay.asozial.org:8999", 

79 "Installations-Guide": "https://syncplay.pl/guide/install", 

80 }, 

81 ), 

82 # Service( 

83 # "Matrix-Heimserver", 

84 # ( 

85 # "Der Matrix-Heimserver des Asozialen Netzwerks ist zuverlässig und" 

86 # " nutzt im Gegensatz zu den meisten anderen Servern Dendrite" 

87 # " anstatt Synapse. Die Erstellung eines Accounts ist 100% kostenlos" 

88 # " und ohne E-Mail-Adresse oder Telefonnummer möglich." 

89 # ), 

90 # { 

91 # "Domain": "asozial.org", 

92 # "Matrix-Client": "https://chat.asozial.org", 

93 # }, 

94 # ), 

95 Service( 

96 "XMPP-Server", 

97 "Das Asoziale Netzwerk hat einen XMPP-Server.", 

98 { 

99 "Domain": "asozial.org", 

100 "Software": "ejabberd", 

101 }, 

102 ), 

103) 

104 

105 

106class ServicesHandler(HTMLRequestHandler): 

107 """The request handler for this page.""" 

108 

109 async def get(self, *, head: bool = False) -> None: 

110 """Handle GET requests to the service list page.""" 

111 if head: 

112 return 

113 await self.render( 

114 "pages/services.html", 

115 services=SERVICES, 

116 )