robots.txt
This commit is contained in:
		
							
								
								
									
										6
									
								
								public/robots.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								public/robots.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					User-agent: *
 | 
				
			||||||
 | 
					Disallow: /tag
 | 
				
			||||||
 | 
					Disallow: /user
 | 
				
			||||||
 | 
					Disallow: /audio
 | 
				
			||||||
 | 
					Disallow: /video
 | 
				
			||||||
 | 
					Disallow: /image
 | 
				
			||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
import path from "path";
 | 
					import path from "path";
 | 
				
			||||||
 | 
					import { promises as fs } from "fs";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default (router, tpl) => {
 | 
					export default (router, tpl) => {
 | 
				
			||||||
  router.static({
 | 
					  router.static({
 | 
				
			||||||
@@ -20,4 +21,11 @@ export default (router, tpl) => {
 | 
				
			|||||||
    dir: path.resolve() + "/public/ca",
 | 
					    dir: path.resolve() + "/public/ca",
 | 
				
			||||||
    route: /^\/ca\//
 | 
					    route: /^\/ca\//
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  router.get(/^\/robots\.txt$/, async (req, res) => {
 | 
				
			||||||
 | 
					    res.reply({
 | 
				
			||||||
 | 
					      type: "text/plain",
 | 
				
			||||||
 | 
					      body: await fs.readFile(path.resolve() + "/public/robots.txt", "utf-8")
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user