mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 05:32:25 -05:00 
			
		
		
		
	🐸restructure frontend stuff, include admin and future user panel in main repo, properly deduplicate bundles for css+js across uses
This commit is contained in:
		
					parent
					
						
							
								f3b44426f4
							
						
					
				
			
			
				commit
				
					
						f971763743
					
				
			
		
					 36 changed files with 8978 additions and 1252 deletions
				
			
		
							
								
								
									
										55
									
								
								web/source/dev-server.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								web/source/dev-server.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | |||
| "use strict"; | ||||
| 
 | ||||
| const express = require("express"); | ||||
| 
 | ||||
| const app = express(); | ||||
| 
 | ||||
| function html(title, css, js) { | ||||
| 	return ` | ||||
| 	<!DOCTYPE html> | ||||
| 	<html lang="en"> | ||||
| 	<head> | ||||
| 		<meta charset="UTF-8"> | ||||
| 		<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||||
| 		<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||
| 	${["_colors.css", "base.css", ...css].map((file) => { | ||||
| 		return `<link rel="stylesheet" href="/${file}"></link>`; | ||||
| 	}).join("\n")} | ||||
| 		<title>GoToSocial ${title} Panel</title> | ||||
| 	</head> | ||||
| 	<body> | ||||
| 		<header> | ||||
| 			<img src="/assets/logo.png" alt="Instance Logo"> | ||||
| 			<div> | ||||
| 				<h1> | ||||
| 					GoToSocial ${title} Panel | ||||
| 				</h1> | ||||
| 			</div> | ||||
| 		</header> | ||||
| 		<main class="lightgray"> | ||||
| 			<div id="root"></div> | ||||
| 		</main> | ||||
| 	${["bundle.js", ...js].map((file) => { | ||||
| 		return `<script src="/${file}"></script>`; | ||||
| 	}).join("\n")} | ||||
| 	</body> | ||||
| 	</html> | ||||
| `;
 | ||||
| } | ||||
| 
 | ||||
| app.get("/admin", (req, res) => { | ||||
| 	res.send(html("Admin", ["panels-admin-style.css"], ["admin-panel.js"])); | ||||
| }); | ||||
| 
 | ||||
| app.get("/user", (req, res) => { | ||||
| 	res.send(html("Settings", ["panels-user-style.css"], ["user-panel.js"])); | ||||
| }); | ||||
| 
 | ||||
| app.use("/assets", express.static("../assets/")); | ||||
| 
 | ||||
| if (process.env.NODE_ENV != "development") { | ||||
| 	console.log("adding static asset route"); | ||||
| 	app.use(express.static("../assets/bundled")); | ||||
| } | ||||
| 
 | ||||
| module.exports = app; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue