mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-10-31 17:44:03 +00:00 
			
		
		
		
	Fix HTTPS requirement
This commit is contained in:
		| @@ -1,3 +1,4 @@ | ||||
| import { conf } from "../helpers/ConfigHelper"; | ||||
| import { Response, Request } from "express"; | ||||
| import { APIHelper } from "../helpers/APIHelper"; | ||||
| import { APIClient } from "./APIClient"; | ||||
| @@ -486,7 +487,7 @@ export class RequestHandler { | ||||
| 		 | ||||
| 		if(client.domain) { | ||||
| 			 | ||||
| 			const allowedOrigin = "http://" + client.domain; | ||||
| 			const allowedOrigin = (conf().force_clients_https ? "https://" : "http://") + client.domain; | ||||
|  | ||||
| 			const referer = this.req.get("Referer"); | ||||
| 			if(!referer || !referer.startsWith(allowedOrigin)) | ||||
| @@ -621,4 +622,4 @@ export class RequestHandler { | ||||
|  | ||||
| 		this.response.send(data); | ||||
| 	} | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -20,7 +20,8 @@ export interface Configuration { | ||||
| 	storageURL : string, | ||||
| 	storagePath : string, | ||||
| 	database : DatabaseConfiguration, | ||||
| 	proxy ?: string | ||||
| 	proxy ?: string, | ||||
| 	force_clients_https ?: boolean | ||||
| } | ||||
|  | ||||
| export class ConfigurationHelper { | ||||
| @@ -46,4 +47,4 @@ export class ConfigurationHelper { | ||||
|  */ | ||||
| export function conf() : Configuration { | ||||
| 	return ConfigurationHelper.getConf(); | ||||
| } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Comunic Server
					Comunic Server