Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
736ec1a7
Commit
736ec1a7
authored
Feb 07, 2019
by
Medicean
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整 protocol
parent
7f467af4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
5 deletions
+19
-5
app.js
app.js
+18
-4
index.js
source/modules/plugin/index.js
+1
-1
index.html
views/front/index.html
+0
-0
plugin.html
views/front/plugin.html
+0
-0
No files found.
app.js
View file @
736ec1a7
...
...
@@ -10,6 +10,9 @@ const path = require('path');
const
electron
=
require
(
'electron'
);
const
{
app
,
protocol
,
BrowserWindow
}
=
require
(
'electron'
);
// 注册为标准 scheme, 默认情况下web storage apis (localStorage, sessionStorage, webSQL, indexedDB, cookies) 被禁止访问非标准schemes
protocol
.
registerStandardSchemes
([
'ant-views'
,
'ant-static'
,
'ant-src'
]);
app
.
once
(
'ready'
,
()
=>
{
/**
...
...
@@ -22,8 +25,11 @@ app
[
'src'
,
'/source/'
,
10
]
//- 通过访问访问ant-src来访问source 文件
].
map
((
_
)
=>
{
protocol
.
registerFileProtocol
(
`ant-
${
_
[
0
]}
`
,
(
req
,
cb
)
=>
{
if
(
req
.
url
.
endsWith
(
'/'
)){
req
.
url
=
req
.
url
.
substr
(
0
,
req
.
url
.
length
-
1
);
}
cb
({
path
:
path
.
join
(
__dirname
,
_
[
1
],
req
.
url
.
substr
(
_
[
2
]
))
path
:
path
.
normalize
(
path
.
join
(
__dirname
,
_
[
1
],
req
.
url
.
substr
(
_
[
2
])
))
});
});
});
...
...
@@ -32,12 +38,20 @@ app
let
mainWindow
=
new
BrowserWindow
({
width
:
1040
,
height
:
699
,
minWidth
:
888
,
minHeight
:
555
,
webgl
:
false
,
title
:
'AntSword'
title
:
'AntSword'
,
webPreferences
:
{
webgl
:
false
,
javascript
:
true
,
nodeIntegration
:
true
,
// 开启 nodejs 支持
// contextIsolation: false, // 关闭上下文隔离
// webSecurity: false,
// allowRunningInsecureContent: true,
// sandbox: false,
},
});
// 加载views
mainWindow
.
loadURL
(
'ant-views://index.html'
);
mainWindow
.
loadURL
(
'ant-views://front/index.html'
);
// 调整部分UI
const
reloadUI
=
mainWindow
.
webContents
.
send
.
bind
(
mainWindow
.
webContents
,
...
...
source/modules/plugin/index.js
View file @
736ec1a7
...
...
@@ -14,7 +14,7 @@ class Plugin {
// 注册菜单事件
antSword
[
'menubar'
].
reg
(
'plugin-store'
,
this
.
initWin
.
bind
(
this
,
'ant-views://plugin.html'
)
this
.
initWin
.
bind
(
this
,
'ant-views://
front/
plugin.html'
)
);
this
.
win
=
null
;
}
...
...
views/index.html
→
views/
front/
index.html
View file @
736ec1a7
File moved
views/plugin.html
→
views/
front/
plugin.html
View file @
736ec1a7
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment