Automatically upgrade to HTTPS in production
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -21,6 +21,14 @@ export class APIClient {
 | 
			
		||||
    return URL;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Check out whether the backend is accessed through
 | 
			
		||||
   * HTTPS or not
 | 
			
		||||
   */
 | 
			
		||||
  static IsBackendSecure(): boolean {
 | 
			
		||||
    return this.backendURL().startsWith("https");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Perform a request on the backend
 | 
			
		||||
   */
 | 
			
		||||
 
 | 
			
		||||
@@ -16,9 +16,18 @@ import { DarkThemeProvider } from "./hooks/context_providers/DarkThemeProvider";
 | 
			
		||||
import { SnackbarProvider } from "./hooks/context_providers/SnackbarProvider";
 | 
			
		||||
import { AsyncWidget } from "./widgets/AsyncWidget";
 | 
			
		||||
import { LoadingMessageProvider } from "./hooks/context_providers/LoadingMessageProvider";
 | 
			
		||||
import { APIClient } from "./api/ApiClient";
 | 
			
		||||
 | 
			
		||||
async function init() {
 | 
			
		||||
  try {
 | 
			
		||||
    if (
 | 
			
		||||
      APIClient.IsBackendSecure() &&
 | 
			
		||||
      !window.location.href.startsWith("https") &&
 | 
			
		||||
      window.location.hostname !== "localhost"
 | 
			
		||||
    ) {
 | 
			
		||||
      window.location.href = window.location.href.replace("http:", "https:");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const root = ReactDOM.createRoot(
 | 
			
		||||
      document.getElementById("root") as HTMLElement
 | 
			
		||||
    );
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user