idk
This commit is contained in:
		
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							@@ -124,7 +124,7 @@ export default class Flummpress {
 | 
				
			|||||||
            res.reply({ code, type: "text/html", body });
 | 
					            res.reply({ code, type: "text/html", body });
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        res.redirect = (target, code = 302) => {
 | 
					        res.redirect = (target, code = 302) => {
 | 
				
			||||||
            res.writeHead(code, { Location: target });
 | 
					            res.writeHead(code, { Location: encodeURI(target) });
 | 
				
			||||||
            res.end();
 | 
					            res.end();
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        return res;
 | 
					        return res;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								dist/router.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								dist/router.js
									
									
									
									
										vendored
									
									
								
							@@ -13,7 +13,6 @@ import Tpl from "./template.js";
 | 
				
			|||||||
export default class Router {
 | 
					export default class Router {
 | 
				
			||||||
    constructor() {
 | 
					    constructor() {
 | 
				
			||||||
        this.routes = [];
 | 
					        this.routes = [];
 | 
				
			||||||
        this.routes;
 | 
					 | 
				
			||||||
        this.mimes = new Map();
 | 
					        this.mimes = new Map();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    importRoutesFromPath(p_1) {
 | 
					    importRoutesFromPath(p_1) {
 | 
				
			||||||
@@ -71,6 +70,7 @@ export default class Router {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    use(obj) {
 | 
					    use(obj) {
 | 
				
			||||||
        if (obj instanceof Router) {
 | 
					        if (obj instanceof Router) {
 | 
				
			||||||
 | 
					            this.routes = Object.assign(Object.assign({}, this.routes), obj.routes);
 | 
				
			||||||
            this.sortRoutes();
 | 
					            this.sortRoutes();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (obj instanceof Tpl) {
 | 
					        if (obj instanceof Tpl) {
 | 
				
			||||||
@@ -102,12 +102,12 @@ export default class Router {
 | 
				
			|||||||
        return this;
 | 
					        return this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    registerRoute(path, method, handler) {
 | 
					    registerRoute(path, method, handler) {
 | 
				
			||||||
        const existingRoute = this.routes.find(route => typeof route.path === "string"
 | 
					        const route = this.routes.find(route => typeof route.path === "string"
 | 
				
			||||||
            ? route.path === path
 | 
					            ? route.path === path
 | 
				
			||||||
            : route.path instanceof RegExp && path instanceof RegExp && route.path.toString() === path.toString());
 | 
					            : route.path instanceof RegExp && path instanceof RegExp && route.path.toString() === path.toString());
 | 
				
			||||||
        if (existingRoute) {
 | 
					        if (route) {
 | 
				
			||||||
            existingRoute.methods[method] = [
 | 
					            route.methods[method] = [
 | 
				
			||||||
                ...(existingRoute.methods[method] || []),
 | 
					                ...(route.methods[method] || []),
 | 
				
			||||||
                ...handler
 | 
					                ...handler
 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -198,7 +198,7 @@ export default class Flummpress {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.redirect = (target, code = 302) => {
 | 
					    res.redirect = (target, code = 302) => {
 | 
				
			||||||
      res.writeHead(code, { Location: target });
 | 
					      res.writeHead(code, { Location: encodeURI(target) });
 | 
				
			||||||
      res.end();
 | 
					      res.end();
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user