优化drawio路径

This commit is contained in:
kuaifan 2022-02-21 18:11:41 +08:00
parent 6f35fe9936
commit a99588c766
5 changed files with 29 additions and 14 deletions

View File

@ -17,9 +17,8 @@
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#d89000">
<script type="text/javascript">
window.EXPORT_URL = window.location.origin + "/api/drawio/export";
window.PLANT_URL = window.location.origin + "/api/drawio/plant";
window.DRAWIO_LIGHTBOX_URL = window.location.origin + "/drawio";
window.EXPORT_URL = window.location.origin + "/drawio/export/";
window.DRAWIO_LIGHTBOX_URL = window.location.origin + "/drawio/webapp";
/**
* URL Parameters and protocol description are here:

View File

@ -112,11 +112,11 @@ server {
proxy_pass http://office/;
}
location /drawio/ {
location /drawio/webapp/ {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-Host $the_host/drawio;
proxy_set_header X-Forwarded-Host $the_host/drawio/webapp;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
@ -129,6 +129,24 @@ server {
proxy_set_header Connection $connection_upgrade;
proxy_pass http://drawio-webapp:8080/;
}
location /drawio/export/ {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-Host $the_host/drawio/export;
proxy_set_header X-Forwarded-Proto $the_scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header Server-Protocol $server_protocol;
proxy_set_header Server-Name $server_name;
proxy_set_header Server-Addr $server_addr;
proxy_set_header Server-Port $server_port;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_pass http://drawio-export:8000/;
}
}
include /etc/nginx/conf.d/conf.d/*.conf;

2
electron/build.js vendored
View File

@ -20,7 +20,7 @@ function cloneDrawio(systemInfo) {
child_process.spawnSync("git", ["submodule", "update", "--quiet", "--init", "--depth=1"], {stdio: "inherit"});
const drawioSrcDir = path.resolve(__dirname, "../resources/drawio/src/main/webapp");
const drawioCoverDir = path.resolve(__dirname, "../docker/drawio/webapp");
const drawioDestDir = path.resolve(electronDir, "drawio");
const drawioDestDir = path.resolve(electronDir, "drawio/webapp");
fse.copySync(drawioSrcDir, drawioDestDir)
fse.copySync(drawioCoverDir, drawioDestDir)
//

10
electron/drawio.js vendored
View File

@ -5,9 +5,7 @@ if (window.cacheServerUrl) {
window.systemInfo.apiUrl = window.cacheServerUrl
}
window.EXPORT_URL = window.systemInfo.apiUrl + "drawio/export";
window.PLANT_URL = window.systemInfo.apiUrl + "drawio/plant";
window.DRAWIO_LIGHTBOX_URL = window.systemInfo.apiUrl + "../drawio";
while (window.DRAWIO_LIGHTBOX_URL.indexOf("/../") !== -1) {
window.DRAWIO_LIGHTBOX_URL = window.DRAWIO_LIGHTBOX_URL.replace(/\/(((?!\/).)*)\/\.\.\//, "/")
}
window.EXPORT_URL = window.systemInfo.apiUrl + "../drawio/export/";
window.DRAWIO_LIGHTBOX_URL = window.systemInfo.apiUrl + "../drawio/webapp";
while (window.EXPORT_URL.indexOf("/../") !== -1) {window.EXPORT_URL = window.EXPORT_URL.replace(/\/(((?!\/).)*)\/\.\.\//, "/")}
while (window.DRAWIO_LIGHTBOX_URL.indexOf("/../") !== -1) {window.DRAWIO_LIGHTBOX_URL = window.DRAWIO_LIGHTBOX_URL.replace(/\/(((?!\/).)*)\/\.\.\//, "/")}

View File

@ -72,9 +72,9 @@ export default {
let theme = this.themeIsDark ? 'dark' : 'kennedy';
let query = `?chrome=${chrome}&lightbox=${lightbox}&ui=${theme}&lang=${language}&embed=1&noLangIcon=1&noExitBtn=1&noSaveBtn=1&saveAndExit=0&spin=1&proto=json`;
if (this.$Electron) {
this.url = $A.originUrl(`drawio/index.html${query}`);
this.url = $A.originUrl(`drawio/webapp/index.html${query}`);
} else {
this.url = $A.apiUrl(`../drawio/${query}`);
this.url = $A.apiUrl(`../drawio/webapp/${query}`);
}
},
mounted() {