@@ -25,25 +25,23 @@ export default class ClanController {
2525 // Returns the clans page (a list of some existing clans)
2626 this . app . get ( "/clans/" , ( req : express . Request , res : express . Response ) => {
2727 res . send (
28- readFileSync ( __dirname + "/index_anon_templ .html", "utf8" )
28+ readFileSync ( "./public/clans/index .html", "utf8" )
2929 ) ;
3030 } ) ;
3131
3232 // GET /clans/view/:clan
3333 // Retrieve information about a specific clan
3434 this . app . get ( "/clans/view/:clan" , async ( req : express . Request , res : express . Response ) => {
3535 if ( Array . isArray ( req . params ) ) return ;
36- if ( ! req . params . clan ) return res . send ( "Please specify a clan" ) ;
36+ if ( ! req . params . clan ) return res . send (
37+ readFileSync ( "./public/errors/404.html" , "utf8" )
38+ ) ;
3739 const clan : ClanData | undefined = await this . db . get ( "SELECT * FROM clans WHERE name=?" , req . params . clan ) ;
38- if ( ! clan ) return res . send ( "Clan was not found" ) ;
40+ if ( ! clan ) return res . send (
41+ readFileSync ( "./public/errors/404.html" , "utf8" )
42+ ) ;
3943 res . send (
40- readFileSync ( __dirname + "/clan_view_anon_templ.html" , "utf8" )
41- . replace ( / { l e a d e r } / g, clan . leader )
42- . replace ( / { c r } / g, String ( clan . cr ) )
43- . replace ( / { m e m b e r s } / g, clan . members . split ( "," ) . join ( ", " ) . slice ( 1 , - 1 ) )
44- . replace ( / { d e s c r i p t i o n } / g, ( clan . description || "-" )
45- . replace ( / < / g, "<" )
46- . replace ( / > / g, ">" ) )
44+ readFileSync ( "./public/clans/clan.html" , "utf8" )
4745 ) ;
4846 } ) ;
4947 }
0 commit comments