Simplify frontend
Just a login form and a list of applications. No modals or anything like that.
This commit is contained in:
24
src/browser/pages/app.css
Normal file
24
src/browser/pages/app.css
Normal file
@ -0,0 +1,24 @@
|
||||
/* NOTE: Disable scrollbars since an oversized element creates them. */
|
||||
.app-input {
|
||||
height: 100%;
|
||||
left: 0;
|
||||
outline: none;
|
||||
position: fixed;
|
||||
scrollbar-width: none;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.app-input::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.app-render {
|
||||
height: 100%;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
}
|
17
src/browser/pages/app.html
Normal file
17
src/browser/pages/app.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<title>code-server — {{APP_NAME}}</title>
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
|
||||
<meta id="coder-options" data-settings="{{OPTIONS}}">
|
||||
</head>
|
||||
<body>
|
||||
<script src="{{BASE}}/static-{{COMMIT}}/dist/app.js"></script>
|
||||
</body>
|
||||
</html>
|
14
src/browser/pages/app.ts
Normal file
14
src/browser/pages/app.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { getOptions } from "../../common/util"
|
||||
|
||||
import "./app.css"
|
||||
import "./error.css"
|
||||
import "./global.css"
|
||||
import "./home.css"
|
||||
import "./login.css"
|
||||
|
||||
const options = getOptions()
|
||||
const parts = window.location.pathname.replace(/^\//g, "").split("/")
|
||||
parts[parts.length - 1] = options.base
|
||||
const url = new URL(window.location.origin + "/" + parts.join("/"))
|
||||
|
||||
console.log(url)
|
@ -1,33 +0,0 @@
|
||||
import * as React from "react"
|
||||
import { FilesResponse } from "../../common/api"
|
||||
import { HttpError } from "../../common/http"
|
||||
import { getFiles } from "../api"
|
||||
import { RequestError } from "../components/error"
|
||||
|
||||
/**
|
||||
* File browser.
|
||||
*/
|
||||
export const Browse: React.FunctionComponent = (props) => {
|
||||
const [response, setResponse] = React.useState<FilesResponse>()
|
||||
const [error, setError] = React.useState<HttpError>()
|
||||
|
||||
React.useEffect(() => {
|
||||
getFiles()
|
||||
.then(setResponse)
|
||||
.catch(setError)
|
||||
}, [props])
|
||||
|
||||
return (
|
||||
<>
|
||||
{error || (response && response.files.length === 0) ? (
|
||||
<RequestError error={error || "Empty directory"} />
|
||||
) : (
|
||||
<ul>
|
||||
{((response && response.files) || []).map((f, i) => (
|
||||
<li key={i}>{f.name}</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
20
src/browser/pages/error.css
Normal file
20
src/browser/pages/error.css
Normal file
@ -0,0 +1,20 @@
|
||||
.error-display {
|
||||
box-sizing: border-box;
|
||||
color: #fcfcfc;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.error-display > .links {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.error-display > .links > .link {
|
||||
color: #b6b6b6;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.error-display > .links > .link:hover {
|
||||
color: #fcfcfc;
|
||||
text-decoration: underline;
|
||||
}
|
26
src/browser/pages/error.html
Normal file
26
src/browser/pages/error.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<title>code-server {{ERROR_TITLE}}</title>
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="center-container">
|
||||
<div class="error-display">
|
||||
<h2 class="header">{{ERROR_HEADER}}</h2>
|
||||
<div class="body">
|
||||
{{ERROR_BODY}}
|
||||
</div>
|
||||
<div class="links">
|
||||
<a class="link" href="{{BASE}}">go home</a
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
27
src/browser/pages/global.css
Normal file
27
src/browser/pages/global.css
Normal file
@ -0,0 +1,27 @@
|
||||
html,
|
||||
body,
|
||||
#root,
|
||||
.center-container {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #272727;
|
||||
color: #f4f4f4;
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
button {
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.center-container {
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
}
|
@ -1,8 +1,70 @@
|
||||
.orientation-guide {
|
||||
align-items: center;
|
||||
.app-lists {
|
||||
max-width: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.app-list > .header {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.app-list > .none {
|
||||
color: #b6b6b6;
|
||||
}
|
||||
|
||||
.app-list + .app-list {
|
||||
border-top: 1px solid #666;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.app-row {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.app-row > .open {
|
||||
color: #b6b6b6;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.app-row > .open:hover {
|
||||
color: #fafafa;
|
||||
}
|
||||
|
||||
.app-row > .open > .icon {
|
||||
height: 1rem;
|
||||
margin-right: 5px;
|
||||
width: 1rem;
|
||||
}
|
||||
|
||||
.app-row > .open > .icon.-missing {
|
||||
background-color: #eee;
|
||||
color: #b6b6b6;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.app-row > .open > .icon.-missing::after {
|
||||
content: "?";
|
||||
font-size: 0.7rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.kill-form {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.kill-form > .kill {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
color: #b6b6b6;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
line-height: 1rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.kill-form > .kill:hover {
|
||||
color: #fafafa;
|
||||
}
|
||||
|
34
src/browser/pages/home.html
Normal file
34
src/browser/pages/home.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<title>code-server</title>
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
|
||||
<meta id="coder-options" data-settings="{{OPTIONS}}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="center-container">
|
||||
<div class="app-lists">
|
||||
<div class="app-list">
|
||||
<h2 class="header">Running Applications</h2>
|
||||
{{APP_LIST:RUNNING}}
|
||||
</div>
|
||||
|
||||
<div class="app-list">
|
||||
<h2 class="header">Editors</h2>
|
||||
{{APP_LIST:EDITORS}}
|
||||
</div>
|
||||
|
||||
<div class="app-list">
|
||||
<h2 class="header">Other</h2>
|
||||
{{APP_LIST:OTHER}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,22 +0,0 @@
|
||||
import * as React from "react"
|
||||
import { Application } from "../../common/api"
|
||||
import { authenticate, setAuthed } from "../api"
|
||||
|
||||
export interface HomeProps {
|
||||
app?: Application
|
||||
}
|
||||
|
||||
export const Home: React.FunctionComponent<HomeProps> = (props) => {
|
||||
React.useEffect(() => {
|
||||
authenticate()
|
||||
.then(() => setAuthed(true))
|
||||
.catch(() => undefined)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="orientation-guide">
|
||||
<div className="welcome">Welcome to code-server.</div>
|
||||
{props.app && !props.app.loaded ? <div className="loader">loading...</div> : undefined}
|
||||
</div>
|
||||
)
|
||||
}
|
@ -1,10 +1,25 @@
|
||||
.login-form {
|
||||
align-items: center;
|
||||
background: #fcfcfc;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
||||
color: rgba(0, 0, 0, 0.37);
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
justify-content: center;
|
||||
max-height: 400px;
|
||||
max-width: 664px;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-form > .header {
|
||||
align-items: center;
|
||||
color: #b6b6b6;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.login-form > .field {
|
||||
@ -13,18 +28,19 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-form > .field-error {
|
||||
margin-top: 1em;
|
||||
.login-form > .error {
|
||||
color: red;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.login-form > .field > .password {
|
||||
border: 1px solid #b6b6b6;
|
||||
box-sizing: border-box;
|
||||
padding: 1em;
|
||||
padding: 1rem;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.login-form > .field > .user {
|
||||
.login-form > .user {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -33,11 +49,5 @@
|
||||
border: 1px solid #b6b6b6;
|
||||
box-sizing: border-box;
|
||||
margin-left: -1px;
|
||||
padding: 1em 2em;
|
||||
}
|
||||
|
||||
.login-header {
|
||||
align-items: center;
|
||||
color: #b6b6b6;
|
||||
margin-bottom: 1em;
|
||||
padding: 1rem 2rem;
|
||||
}
|
||||
|
48
src/browser/pages/login.html
Normal file
48
src/browser/pages/login.html
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; script-src 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:;">
|
||||
<title>code-server login</title>
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="center-container">
|
||||
<form class="login-form" method="post">
|
||||
<div class="header">
|
||||
<div class="main">Welcome to code-server</div>
|
||||
<div class="sub">Please log in below</div>
|
||||
</div>
|
||||
<input class="user" type="text" autocomplete="username" />
|
||||
<input id="base" type="hidden" name="base" value="/" />
|
||||
<div class="field">
|
||||
<!-- The onfocus code places the cursor at the end of the value. -->
|
||||
<input
|
||||
required autofocus
|
||||
value="{{VALUE}}"
|
||||
onfocus="const value=this.value;this.value='';this.value=value;"
|
||||
class="password"
|
||||
type="password"
|
||||
placeholder="password"
|
||||
name="password"
|
||||
autocomplete="current-password"
|
||||
/>
|
||||
<button class="submit" type="submit">
|
||||
Log In
|
||||
</button>
|
||||
</div>
|
||||
{{ERROR}}
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
<script>
|
||||
const parts = window.location.pathname.replace(/^\//g, "").split("/")
|
||||
parts[parts.length - 1] = "{{BASE}}"
|
||||
const url = new URL(window.location.origin + "/" + parts.join("/"))
|
||||
document.getElementById("base").value = url.pathname
|
||||
</script>
|
||||
</html>
|
@ -1,59 +0,0 @@
|
||||
import * as React from "react"
|
||||
import { Application } from "../../common/api"
|
||||
import { HttpError } from "../../common/http"
|
||||
import { authenticate, setAuthed } from "../api"
|
||||
import { FieldError } from "../components/error"
|
||||
|
||||
export interface LoginProps {
|
||||
setApp(app: Application): void
|
||||
}
|
||||
|
||||
/**
|
||||
* Login page. Will redirect on success.
|
||||
*/
|
||||
export const Login: React.FunctionComponent<LoginProps> = (props) => {
|
||||
const [password, setPassword] = React.useState<string>("")
|
||||
const [error, setError] = React.useState<HttpError>()
|
||||
|
||||
async function handleSubmit(event: React.FormEvent<HTMLFormElement>): Promise<void> {
|
||||
event.preventDefault()
|
||||
authenticate({ password })
|
||||
.then((response) => {
|
||||
if (response.app) {
|
||||
props.setApp(response.app)
|
||||
}
|
||||
setAuthed(true)
|
||||
})
|
||||
.catch(setError)
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
authenticate()
|
||||
.then(() => setAuthed(true))
|
||||
.catch(() => undefined)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<form className="login-form" onSubmit={handleSubmit}>
|
||||
<div className="login-header">
|
||||
<div className="main">Welcome to code-server</div>
|
||||
<div className="sub">Please log in below</div>
|
||||
</div>
|
||||
<div className="field">
|
||||
<input className="user" type="text" autoComplete="username" />
|
||||
<input
|
||||
autoFocus
|
||||
className="password"
|
||||
type="password"
|
||||
placeholder="password"
|
||||
autoComplete="current-password"
|
||||
onChange={(event: React.ChangeEvent<HTMLInputElement>): void => setPassword(event.target.value)}
|
||||
/>
|
||||
<button className="submit" type="submit">
|
||||
Log In
|
||||
</button>
|
||||
</div>
|
||||
{error ? <FieldError error={error} /> : undefined}
|
||||
</form>
|
||||
)
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
.missing-message {
|
||||
align-items: center;
|
||||
color: #b6b6b6;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
import * as React from "react"
|
||||
|
||||
export const Missing: React.FunctionComponent = () => {
|
||||
return (
|
||||
<div className="missing-message">
|
||||
<div className="message">404</div>
|
||||
</div>
|
||||
)
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
import * as React from "react"
|
||||
import { Application } from "../../common/api"
|
||||
import { getApplications } from "../api"
|
||||
import { ApplicationSection, AppLoader } from "../components/list"
|
||||
|
||||
export interface OpenProps {
|
||||
app?: Application
|
||||
setApp(app: Application): void
|
||||
}
|
||||
|
||||
/**
|
||||
* Display recently used applications.
|
||||
*/
|
||||
export const Open: React.FunctionComponent<OpenProps> = (props) => {
|
||||
return (
|
||||
<AppLoader
|
||||
getApps={async (): Promise<ReadonlyArray<ApplicationSection>> => {
|
||||
const response = await getApplications()
|
||||
return [
|
||||
{
|
||||
header: "Applications",
|
||||
apps: response && response.applications,
|
||||
},
|
||||
]
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
import * as React from "react"
|
||||
import { Application } from "../../common/api"
|
||||
import { getRecent } from "../api"
|
||||
import { ApplicationSection, AppLoader } from "../components/list"
|
||||
|
||||
export interface RecentProps {
|
||||
app?: Application
|
||||
setApp(app: Application): void
|
||||
}
|
||||
|
||||
/**
|
||||
* Display recently used applications.
|
||||
*/
|
||||
export const Recent: React.FunctionComponent<RecentProps> = (props) => {
|
||||
return (
|
||||
<AppLoader
|
||||
getApps={async (): Promise<ReadonlyArray<ApplicationSection>> => {
|
||||
const response = await getRecent()
|
||||
return [
|
||||
{
|
||||
header: "Running Applications",
|
||||
apps: response && response.running,
|
||||
},
|
||||
{
|
||||
header: "Recent Applications",
|
||||
apps: response && response.recent,
|
||||
},
|
||||
]
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
92
src/browser/pages/vscode.html
Normal file
92
src/browser/pages/vscode.html
Normal file
@ -0,0 +1,92 @@
|
||||
<!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<meta http-equiv="Content-Security-Policy" content="font-src 'self'; connect-src 'self' https:; default-src ws: wss: 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; manifest-src 'self'; img-src 'self' data:;">
|
||||
|
||||
<!-- Disable pinch zooming -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
|
||||
<!-- Workbench Configuration -->
|
||||
<meta id="vscode-workbench-web-configuration" data-settings="{{WORKBENCH_WEB_CONFIGURATION}}">
|
||||
|
||||
<!-- Workarounds/Hacks (remote user data uri) -->
|
||||
<meta id="vscode-remote-user-data-uri" data-settings="{{REMOTE_USER_DATA_URI}}">
|
||||
<meta id="vscode-remote-commit" data-settings="{{COMMIT}}">
|
||||
<meta id="vscode-remote-product-configuration" data-settings="{{PRODUCT_CONFIGURATION}}">
|
||||
<meta id="vscode-remote-nls-configuration" data-settings="{{NLS_CONFIGURATION}}">
|
||||
|
||||
<!-- Workbench Icon/Manifest/CSS -->
|
||||
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
|
||||
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
|
||||
<!-- PROD_ONLY
|
||||
<link data-name="vs/workbench/workbench.web.api" rel="stylesheet" href="{{VS_BASE}}/static-{{COMMIT}}/out/vs/workbench/workbench.web.api.css">
|
||||
END_PROD_ONLY -->
|
||||
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<!-- Prefetch to avoid waterfall -->
|
||||
<!-- PROD_ONLY
|
||||
<link rel="prefetch" href="{{VS_BASE}}/static-{{COMMIT}}/node_modules/semver-umd/lib/semver-umd.js">
|
||||
END_PROD_ONLY -->
|
||||
</head>
|
||||
|
||||
<body aria-label="">
|
||||
</body>
|
||||
|
||||
<!-- Startup (do not modify order of script tags!) -->
|
||||
<script>
|
||||
const parts = window.location.pathname.replace(/^\//g, "").split("/")
|
||||
parts[parts.length - 1] = "{{VS_BASE}}"
|
||||
const url = new URL(window.location.origin + "/" + parts.join("/"))
|
||||
const el = document.getElementById('vscode-remote-commit');
|
||||
const commit = el ? el.getAttribute('data-settings') : "";
|
||||
const staticBase = url.href + '/static-' + commit;
|
||||
let nlsConfig;
|
||||
try {
|
||||
nlsConfig = JSON.parse(document.getElementById('vscode-remote-nls-configuration').getAttribute('data-settings'));
|
||||
if (nlsConfig._resolvedLanguagePackCoreLocation) {
|
||||
const bundles = Object.create(null);
|
||||
nlsConfig.loadBundle = (bundle, language, cb) => {
|
||||
let result = bundles[bundle];
|
||||
if (result) {
|
||||
return cb(undefined, result);
|
||||
}
|
||||
// FIXME: Only works if path separators are /.
|
||||
const path = nlsConfig._resolvedLanguagePackCoreLocation
|
||||
+ '/' + bundle.replace(/\//g, '!') + '.nls.json';
|
||||
fetch(`${url.href}/resource/?path=${encodeURIComponent(path)}`)
|
||||
.then((response) => response.json())
|
||||
.then((json) => {
|
||||
bundles[bundle] = json;
|
||||
cb(undefined, json);
|
||||
})
|
||||
.catch(cb);
|
||||
};
|
||||
}
|
||||
} catch (error) { /* Probably fine. */ }
|
||||
self.require = {
|
||||
baseUrl: `${staticBase}/out`,
|
||||
paths: {
|
||||
'vscode-textmate': `${staticBase}/node_modules/vscode-textmate/release/main`,
|
||||
'onigasm-umd': `${staticBase}/node_modules/onigasm-umd/release/main`,
|
||||
'xterm': `${staticBase}/node_modules/xterm/lib/xterm.js`,
|
||||
'xterm-addon-search': `${staticBase}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
|
||||
'xterm-addon-web-links': `${staticBase}/node_modules/xterm-addon-web-links/lib/xterm-addon-web-links.js`,
|
||||
'xterm-addon-webgl': `${staticBase}/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
|
||||
'semver-umd': `${staticBase}/node_modules/semver-umd/lib/semver-umd.js`,
|
||||
},
|
||||
'vs/nls': nlsConfig,
|
||||
};
|
||||
</script>
|
||||
<script src="{{VS_BASE}}/static-{{COMMIT}}/out/vs/loader.js"></script>
|
||||
<!-- PROD_ONLY
|
||||
<script src="{{VS_BASE}}/static-{{COMMIT}}/out/vs/workbench/workbench.web.api.nls.js"></script>
|
||||
<script src="{{VS_BASE}}/static-{{COMMIT}}/out/vs/workbench/workbench.web.api.js"></script>
|
||||
END_PROD_ONLY -->
|
||||
<script>
|
||||
require(['vs/code/browser/workbench/workbench'], function() {});
|
||||
</script>
|
||||
</html>
|
Reference in New Issue
Block a user