mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	webpack: Allow customizing the 5xx page.
Note that this only changes the nginx 5xx page, not the Django one.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							fde6278e34
						
					
				
				
					commit
					3c400e5f88
				
			@@ -11,6 +11,7 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")
 | 
			
		||||
os.chdir(os.path.join(os.path.dirname(__file__), "../web"))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
from scripts.lib.zulip_tools import get_config, get_config_file
 | 
			
		||||
from version import ZULIP_VERSION
 | 
			
		||||
 | 
			
		||||
webpack_command = [
 | 
			
		||||
@@ -39,6 +40,10 @@ def build_for_prod_or_puppeteer(quiet: bool, config_name: str | None = None) ->
 | 
			
		||||
        webpack_args += [f"--config-name={config_name}"]
 | 
			
		||||
    if "PUPPETEER_TESTS" in os.environ:
 | 
			
		||||
        webpack_args.append("--env=puppeteer_tests")
 | 
			
		||||
    else:
 | 
			
		||||
        custom_5xx_file = get_config(get_config_file(), "application_server", "5xx_file")
 | 
			
		||||
        if custom_5xx_file is not None:
 | 
			
		||||
            webpack_args.append(f"--env=custom_5xx_file={custom_5xx_file}")
 | 
			
		||||
 | 
			
		||||
    # Silence warnings from "browserslist" about using old data; those
 | 
			
		||||
    # warnings are only useful for development
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								web/html/5xx-cloud.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								web/html/5xx-cloud.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
        <meta charset="UTF-8" />
 | 
			
		||||
        <title>500 internal server error | Zulip</title>
 | 
			
		||||
        <meta http-equiv="refresh" content="60;URL='/'" />
 | 
			
		||||
        <!-- We use `error-styles` webpack assets to styles this page. -->
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
        <div class="header">
 | 
			
		||||
            <div class="header-main" id="top_navbar">
 | 
			
		||||
                <div class="float-left">
 | 
			
		||||
                    <a class="brand logo" href="https://zulip.com/">
 | 
			
		||||
                        <svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="68.96 55.62 1742.12 450.43" height="25">
 | 
			
		||||
                            <path fill="hsl(0, 0%, 27%)" d="M473.09 122.97c0 22.69-10.19 42.85-25.72 55.08L296.61 312.69c-2.8 2.4-6.44-1.47-4.42-4.7l55.3-110.72c1.55-3.1-.46-6.91-3.64-6.91H129.36c-33.22 0-60.4-30.32-60.4-67.37 0-37.06 27.18-67.37 60.4-67.37h283.33c33.22-.02 60.4 30.3 60.4 67.35zM129.36 506.05h283.33c33.22 0 60.4-30.32 60.4-67.37 0-37.06-27.18-67.37-60.4-67.37H198.2c-3.18 0-5.19-3.81-3.64-6.91l55.3-110.72c2.02-3.23-1.62-7.1-4.42-4.7L94.68 383.6c-15.53 12.22-25.72 32.39-25.72 55.08 0 37.05 27.18 67.37 60.4 67.37zm522.5-124.15l124.78-179.6v-1.56H663.52v-48.98h190.09v34.21L731.55 363.24v1.56h124.01v48.98h-203.7V381.9zm338.98-230.14V302.6c0 45.09 17.1 68.03 47.43 68.03 31.1 0 48.2-21.77 48.2-68.03V151.76h59.09V298.7c0 80.86-40.82 119.34-109.24 119.34-66.09 0-104.96-36.54-104.96-120.12V151.76h59.48zm244.91 0h59.48v212.25h104.18v49.76h-163.66V151.76zm297 0v262.01h-59.48V151.76h59.48zm90.18 3.5c18.27-3.11 43.93-5.44 80.08-5.44 36.54 0 62.59 7 80.08 20.99 16.72 13.22 27.99 34.99 27.99 60.64 0 25.66-8.55 47.43-24.1 62.2-20.21 19.05-50.15 27.6-85.13 27.6-7.77 0-14.77-.39-20.21-1.17v93.69h-58.7V155.26zm58.7 118.96c5.05 1.17 11.27 1.55 19.83 1.55 31.49 0 50.92-15.94 50.92-42.76 0-24.1-16.72-38.49-46.26-38.49-12.05 0-20.21 1.17-24.49 2.33v77.37z"/>
 | 
			
		||||
                        </svg>
 | 
			
		||||
                    </a>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="error_page">
 | 
			
		||||
            <img src="/static/images/errors/500art.svg" alt=""/>
 | 
			
		||||
            <div class="errorbox">
 | 
			
		||||
                <div class="errorcontent">
 | 
			
		||||
                    <h1 class="lead">Internal server error</h1>
 | 
			
		||||
                    <p>Zulip Cloud is currently experiencing some technical difficulties. Sorry about that!</p>
 | 
			
		||||
                    <p>You can check our <a href="https://status.zulip.com/">status page</a> for more information.</p>
 | 
			
		||||
                    <p>The page will reload automatically soon after service is restored.</p>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -7,9 +7,6 @@
 | 
			
		||||
        <!-- We use `error-styles` webpack assets to styles this page. -->
 | 
			
		||||
    </head>
 | 
			
		||||
    <body>
 | 
			
		||||
        <!-- TODO: Make nginx 5xx error page customizable -->
 | 
			
		||||
        <!-- This is tricky because it's not served by Django, -->
 | 
			
		||||
        <!-- so we can't use variables -->
 | 
			
		||||
        <div class="header">
 | 
			
		||||
            <div class="header-main" id="top_navbar">
 | 
			
		||||
                <div class="float-left">
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,12 @@ import assets from "./webpack.assets.json" with {type: "json"};
 | 
			
		||||
import dev_assets from "./webpack.dev-assets.json" with {type: "json"};
 | 
			
		||||
 | 
			
		||||
const config = (
 | 
			
		||||
    env: {minimize?: true; puppeteer_tests?: true; ZULIP_VERSION?: string} = {},
 | 
			
		||||
    env: {
 | 
			
		||||
        minimize?: true;
 | 
			
		||||
        puppeteer_tests?: true;
 | 
			
		||||
        ZULIP_VERSION?: string;
 | 
			
		||||
        custom_5xx_file?: string;
 | 
			
		||||
    } = {},
 | 
			
		||||
    argv: {mode?: string},
 | 
			
		||||
): webpack.Configuration[] => {
 | 
			
		||||
    const production: boolean = argv.mode === "production";
 | 
			
		||||
@@ -50,7 +55,7 @@ const config = (
 | 
			
		||||
        }),
 | 
			
		||||
        new HtmlWebpackPlugin({
 | 
			
		||||
            filename: "5xx.html",
 | 
			
		||||
            template: "html/5xx.html",
 | 
			
		||||
            template: env.custom_5xx_file ? "html/" + env.custom_5xx_file : "html/5xx.html",
 | 
			
		||||
            chunks: ["error-styles"],
 | 
			
		||||
            publicPath: production ? "/static/webpack-bundles/" : "/webpack/",
 | 
			
		||||
        }),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user