Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
- 修复使用 `https` 协议时文件校验不通过问题 | Fixed an issue where file validation failed when using the `https` protocol.
- 修复部分资源文件引用路径问题 | Fixed an issue with some resource file reference paths.
  • Loading branch information
Zuoqiu-Yingyi committed Feb 25, 2022
1 parent d14bb32 commit 4578eee
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 173 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# 更改日志 | CHANGE LOG

- 修复使用 `https` 协议时文件校验不通过问题 | Fixed an issue where file validation failed when using the `https` protocol.
- 修复部分资源文件引用路径问题 | Fixed an issue with some resource file reference paths.

## v0.1.0/2022-02-24

- 自动加载块属性 `custom-data-assets` 中设置的资源文件 | The resource file set in the block attribute `custom-data-assets` is automatically loaded.
Expand Down
74 changes: 37 additions & 37 deletions index.html
Expand Up @@ -236,8 +236,8 @@

mxscript(drawDevUrl + './js/PreConfig.js');
mxscript(drawDevUrl + './js/diagramly/Init.js');
mxscript(geBasePath + './Init.js');
mxscript(mxBasePath + './mxClient.js');
mxscript(geBasePath + '/Init.js');
mxscript(mxBasePath + '/mxClient.js');

// Adds all JS code that depends on mxClient. This indirection via Devel.js is
// required in some browsers to make sure mxClient.js (and the files that it
Expand Down Expand Up @@ -441,51 +441,51 @@ <h2 id="geStatus">Loading...</h2>

<script type="module">
import {
getBlockAttrs,
} from './siyuan/api.js';

async function open() {
var urlParams = (() => {
var result = new Object();
var params = window.location.search.slice(1).split('&');
for (var i = 0; i < params.length; i++) {
let idx = params[i].indexOf('=');
if (idx > 0) {
result[params[i].substring(0, idx)] = params[i].substring(idx + 1);
getBlockAttrs,
} from './siyuan/api.js';

async function open() {
var urlParams = (() => {
var result = new Object();
var params = window.location.search.slice(1).split('&');
for (var i = 0; i < params.length; i++) {
let idx = params[i].indexOf('=');
if (idx > 0) {
result[params[i].substring(0, idx)] = params[i].substring(idx + 1);
}
}
}
return result;
})();
// console.log(urlParams);
// console.log(window.location);
return result;
})();
// console.log(urlParams);
// console.log(window.location);

var id = urlParams.id;
var id = urlParams.id;

if (id == null) {
let node = window.frameElement != null ? window.frameElement.parentElement.parentElement : null;
if (node != null) {
id = node.getAttribute('data-node-id');
let asset = node.getAttribute('custom-data-assets');
if (id == null) {
let node = window.frameElement != null ? window.frameElement.parentElement.parentElement : null;
if (node != null) {
id = node.getAttribute('data-node-id');
let asset = node.getAttribute('custom-data-assets');

let href = `${window.location.origin}${window.location.pathname}?dev=1&id=${id}#U${window.location.origin}/${asset}`;
// console.log(href);
window.location.href = href;
}
} else {
if (window.location.hash == '') {
let data = await getBlockAttrs(id);
// console.log(data);
let asset = data['custom-data-assets'];
if (asset != null) {
let href = `${window.location.origin}${window.location.pathname}?dev=1&id=${id}#U${window.location.origin}/${asset}`;
// console.log(href);
window.location.href = href;
}
} else {
if (window.location.hash == '') {
let data = await getBlockAttrs(id);
// console.log(data);
let asset = data['custom-data-assets'];
if (asset != null) {
let href = `${window.location.origin}${window.location.pathname}?dev=1&id=${id}#U${window.location.origin}/${asset}`;
// console.log(href);
window.location.href = href;
}
}
}
}
}
// console.log(window.location);
setTimeout(open, 0);
// console.log(window.location);
setTimeout(open, 0);
</script>

</html>
2 changes: 1 addition & 1 deletion js/diagramly/App.js
Expand Up @@ -643,7 +643,7 @@ App.main = function(callback, createUi)
{
var content = mxUtils.getTextContent(scripts[0]);

if (CryptoJS.MD5(content).toString() != '8445baab47ce600df0a216ded2e4ba30')
if (CryptoJS.MD5(content).toString() != '8d30a606a5a4d5fb5186a4989593c4bd')
{
console.log('Change bootstrap script MD5 in the previous line:', CryptoJS.MD5(content).toString());
alert('[Dev] Bootstrap script change requires update of CSP');
Expand Down

0 comments on commit 4578eee

Please sign in to comment.