diff options
| -rw-r--r-- | .eslintrc.json | 3 | ||||
| -rw-r--r-- | src/app.js | 25 | ||||
| -rw-r--r-- | src/frontend/components/RepositoryHeader.vue | 2 | ||||
| -rw-r--r-- | src/frontend/util/worker.js | 4 | 
4 files changed, 17 insertions, 17 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 4a59fc5..0e29f86 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,6 +19,9 @@  		"implicit-arrow-linebreak": ["warn", "beside"],  		"indent": ["warn", "tab"],  		"linebreak-style": ["warn", "unix"], +		"comma-dangle": ["error", "never"], +		"semi": ["error", "always"], +		"no-var": "error",  		"vue/max-attributes-per-line": ["warn", {  			"singleline": {  			  "max": 2, @@ -13,22 +13,23 @@ const settings_keys = Object.keys(settings);  const mandatory_settings = [ "host", "port", "title", "about", "base_dir" ]; -const mandatory_not_included = settings_keys.filter(x => !mandatory_settings.includes(x)); +// Make sure that all the required settings are present  const settings_not_included = mandatory_settings.filter(x => !settings_keys.includes(x)); -  if(settings_not_included.length !== 0) { -	console.log(`Error: settings.yml is missing ${(mandatory_not_included.length > 1) ? "keys" : "key"}:`); +	console.log(`Error: settings.yml is missing ${(settings_not_included.length > 1) ? "keys" : "key"}:`);  	console.log(settings_not_included.join(", "));  	exit(1);  } + +// Make sure that there's not an excessive amount of settings +const mandatory_not_included = settings_keys.filter(x => !mandatory_settings.includes(x));  if(mandatory_not_included.length !== 0) {  	console.log(`Error: settings.yml includes ${(mandatory_not_included.length > 1) ? "pointless keys" : "a pointless key"}:`);  	console.log(mandatory_not_included.join(", "));  	exit(1);  } -const dist_dir = path.join(__dirname, "/../dist"); - +// Make sure that the base directory specified in the settings actually exists  try {  	fs.readdirSync(settings["base_dir"]);  } @@ -37,6 +38,8 @@ catch {  	exit(1);  } +const dist_dir = path.join(__dirname, "/../dist"); +  fastify.setNotFoundHandler({  	preValidation: (req, reply, done) => done(),  	preHandler: (req, reply, done) => done() @@ -45,21 +48,15 @@ fastify.setNotFoundHandler({  	reply.send("404: Not found");  }); -  fastify.addContentTypeParser("application/x-git-upload-pack-request", (req, payload, done) => done(null, payload)); -fastify.register(fastify_static, { root: dist_dir }) +fastify.register(fastify_static, { root: dist_dir });  fastify.register(api, { prefix: "/api/v1", config: { settings: settings } });  fastify.route({  	method: "GET",  	path: "/", -	handler: (req, reply) => -	{ -		console.log("AAAA faan"); -		console.log(dist_dir) -		reply.sendFile("app.html"); -	} +	handler: (req, reply) => reply.sendFile("app.html")  });  fastify.route({ @@ -124,7 +121,7 @@ fastify.register((fastify_repo, opts, done) =>  		{  			if(!req.query.service) {  				reply.code(403).send("Missing service query parameter\n"); -				return +				return;  			}  			else if(req.query.service !== "git-upload-pack") {  				reply.code(403).send("Access denied!\n"); diff --git a/src/frontend/components/RepositoryHeader.vue b/src/frontend/components/RepositoryHeader.vue index 61b8d20..39ec00d 100644 --- a/src/frontend/components/RepositoryHeader.vue +++ b/src/frontend/components/RepositoryHeader.vue @@ -47,5 +47,5 @@ export default {  			... toRefs(state)  		};  	} -} +};  </script>
\ No newline at end of file diff --git a/src/frontend/util/worker.js b/src/frontend/util/worker.js index addb2b5..e50743a 100644 --- a/src/frontend/util/worker.js +++ b/src/frontend/util/worker.js @@ -1,6 +1,6 @@  onmessage = function(e)  {  	if(e.data.work === "sleep") { -		setTimeout(() => { postMessage("done") }, e.data.time); +		setTimeout(() => postMessage("done"), e.data.time);  	} -}
\ No newline at end of file +};
\ No newline at end of file  | 
