Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
63c630a6
Commit
63c630a6
authored
Nov 28, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复中文用户名登录不进聊天室和Mac ygopro意外退出的问题
parent
7af45124
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
32 deletions
+73
-32
app/download.service.ts
app/download.service.ts
+2
-2
app/mycard.component.html
app/mycard.component.html
+6
-5
app/mycard.component.ts
app/mycard.component.ts
+20
-3
app/ygopro.component.ts
app/ygopro.component.ts
+20
-7
apps.json
apps.json
+1
-3
candy/index.html
candy/index.html
+3
-3
index.js
index.js
+21
-9
No files found.
app/download.service.ts
View file @
63c630a6
...
...
@@ -83,7 +83,7 @@ export class DownloadService {
map
:
Map
<
string
,
any
>
=
new
Map
();
async
addMetalink
(
metalink
:
string
,
library
:
string
)
{
let
meta4
=
btoa
(
metalink
);
let
meta4
=
new
Buffer
((
metalink
)).
toString
(
'
base64
'
);
let
gid
=
(
await
this
.
aria2
.
addMetalink
(
meta4
,
{
dir
:
library
}))[
0
];
return
Observable
.
create
((
observer
)
=>
{
this
.
map
.
set
(
gid
,
observer
);
...
...
@@ -111,7 +111,7 @@ export class DownloadService {
meta4link
=
`
${
this
.
baseURL
}${
id
}
-
${
process
.
platform
}
.meta4`
}
let
response
=
await
this
.
http
.
get
(
meta4link
).
toPromise
();
let
meta4
=
btoa
(
response
.
text
()
);
let
meta4
=
new
Buffer
(
response
.
text
()).
toString
(
'
base64
'
);
let
gid
=
(
await
this
.
aria2
.
addMetalink
(
meta4
,
{
dir
:
path
}))[
0
];
this
.
appGidMap
.
set
(
app
,
gid
);
this
.
gidAppMap
.
set
(
gid
,
app
);
...
...
app/mycard.component.html
View file @
63c630a6
...
...
@@ -23,14 +23,15 @@
<a
href=
"#"
(click)=
"loginService.logout()"
class=
"item"
>
切换账号
</a>
</div>
<div
id=
"window-buttons"
*ngIf=
"platform != 'darwin'"
>
<i
(click)=
"currentWindow.minimize()"
class=
"fa fa-minus"
aria-hidden=
"true"
></i>
<i
*ngIf=
"!currentWindow.isMaximized()"
(click)=
"currentWindow.maximize()"
class=
"fa fa-expand"
aria-hidden=
"true"
></i>
<i
*ngIf=
"currentWindow.isMaximized()"
(click)=
"currentWindow.unmaximize()"
class=
"fa fa-clone"
aria-hidden=
"true"
></i>
<i
(click)=
"window.close()"
class=
"fa fa-times"
aria-hidden=
"true"
></i>
<i
(click)=
"currentWindow.minimize()"
class=
"fa fa-minus"
></i>
<i
*ngIf=
"!currentWindow.isMaximized()"
(click)=
"currentWindow.maximize()"
class=
"fa fa-expand"
></i>
<i
*ngIf=
"currentWindow.isMaximized()"
(click)=
"currentWindow.unmaximize()"
class=
"fa fa-clone"
></i>
<i
(click)=
"window.close()"
class=
"fa fa-times"
></i>
</div>
</div>
</nav>
<login
class=
"page"
*ngIf=
"!loginService.logged_in"
></login>
<store
class=
"page"
*ngIf=
"loginService.logged_in"
[hidden]=
"currentPage != 'store'"
></store>
<lobby
class=
"page"
*ngIf=
"loginService.logged_in"
[hidden]=
"currentPage != 'lobby'"
></lobby>
<webview
id=
"community"
class=
"page"
*ngIf=
"loginService.logged_in"
[hidden]=
"currentPage != 'community'"
src=
"https://ygobbs.com"
></webview>
\ No newline at end of file
<webview
class=
"page"
*ngIf=
"loginService.logged_in"
[hidden]=
"currentPage != 'community'"
src=
"https://ygobbs.com"
></webview>
\ No newline at end of file
app/mycard.component.ts
View file @
63c630a6
import
{
Component
,
Renderer
,
ChangeDetectorRef
,
OnInit
}
from
"
@angular/core
"
;
import
{
TranslateService
}
from
"
ng2-translate
"
;
import
{
remote
}
from
"
electron
"
;
import
{
ipcRenderer
,
remote
}
from
"
electron
"
;
import
{
LoginService
}
from
"
./login.service
"
;
const
autoUpdater
:
Electron
.
AutoUpdater
=
remote
.
getGlobal
(
'
autoUpdater
'
);
@
Component
({
...
...
@@ -34,7 +35,23 @@ export class MyCardComponent implements OnInit {
// the lang to use, if the lang isn't available, it will use the current loader to get them
translate
.
use
(
remote
.
app
.
getLocale
());
this
.
currentWindow
.
on
(
'
maximize
'
,
()
=>
ref
.
detectChanges
());
this
.
currentWindow
.
on
(
'
unmaximize
'
,
()
=>
ref
.
detectChanges
());
this
.
currentWindow
.
on
(
'
maximize
'
,
()
=>
ref
.
detectChanges
());
this
.
currentWindow
.
on
(
'
unmaximize
'
,
()
=>
ref
.
detectChanges
());
autoUpdater
.
on
(
'
error
'
,
(
error
)
=>
{
console
.
log
(
'
autoUpdater
'
,
'
error
'
,
error
.
message
)
});
autoUpdater
.
on
(
'
checking-for-update
'
,
()
=>
{
console
.
log
(
'
autoUpdater
'
,
'
checking-for-update
'
)
});
autoUpdater
.
on
(
'
update-available
'
,
()
=>
{
console
.
log
(
'
autoUpdater
'
,
'
update-available
'
)
});
autoUpdater
.
on
(
'
update-not-available
'
,
()
=>
{
console
.
log
(
'
autoUpdater
'
,
'
update-not-available
'
)
});
autoUpdater
.
on
(
'
update-downloaded
'
,
(
event
)
=>
{
console
.
log
(
'
autoUpdater
'
,
'
update-downloaded
'
)
});
}
}
app/ygopro.component.ts
View file @
63c630a6
...
...
@@ -76,9 +76,9 @@ export class YGOProComponent implements OnInit {
app
:
App
;
decks
:
string
[]
=
[];
current_deck
:
string
;
system_conf
;
numfont
=
{
'
darwin
'
:
[
'
/System/Library/Fonts/PingFang.ttc
'
]}
;
textfont
=
{
'
darwin
'
:
[
'
/System/Library/Fonts/PingFang.ttc
'
]}
;
system_conf
:
string
;
numfont
:
string
[]
;
textfont
:
string
[]
;
windbot
=
[
"
琪露诺
"
,
"
谜之剑士LV4
"
,
"
复制植物
"
,
"
尼亚
"
];
...
...
@@ -108,6 +108,16 @@ export class YGOProComponent implements OnInit {
connections
:
WebSocket
[]
=
[];
constructor
(
private
http
:
Http
,
private
appsService
:
AppsService
,
private
loginService
:
LoginService
,
private
ref
:
ChangeDetectorRef
)
{
switch
(
process
.
platform
)
{
case
'
darwin
'
:
this
.
numfont
=
[
'
/System/Library/Fonts/SFNSTextCondensed-Bold.otf
'
];
this
.
textfont
=
[
'
/System/Library/Fonts/PingFang.ttc
'
];
break
;
case
'
win32
'
:
this
.
numfont
=
[
path
.
join
(
process
.
env
[
'
SystemRoot
'
],
'
Fonts
'
,
'
arialbd.ttf
'
)];
this
.
textfont
=
[
path
.
join
(
process
.
env
[
'
SystemRoot
'
],
'
Fonts
'
,
'
simsun.ttc
'
)];
break
;
}
}
ngOnInit
()
{
...
...
@@ -173,8 +183,10 @@ export class YGOProComponent implements OnInit {
}
async
get_font
(
files
:
string
[]):
Promise
<
string
|
undefined
>
{
for
(
let
file
in
files
)
{
for
(
let
file
of
files
)
{
console
.
log
(
file
);
let
found
=
await
new
Promise
((
resolve
)
=>
fs
.
access
(
file
,
fs
.
constants
.
R_OK
,
error
=>
resolve
(
!
error
)));
console
.
log
(
found
);
if
(
found
)
{
return
file
;
}
...
...
@@ -188,14 +200,14 @@ export class YGOProComponent implements OnInit {
async
fix_fonts
(
data
)
{
if
(
!
await
this
.
get_font
([
data
.
numfont
]))
{
let
font
=
await
this
.
get_font
(
this
.
numfont
[
process
.
platform
]
);
let
font
=
await
this
.
get_font
(
this
.
numfont
);
if
(
font
)
{
data
[
'
numfont
'
]
=
font
}
}
if
(
!
await
this
.
get_font
([
data
.
textfont
.
split
(
'
'
,
2
)[
0
]]))
{
let
font
=
await
this
.
get_font
(
this
.
textfont
[
process
.
platform
]
);
let
font
=
await
this
.
get_font
(
this
.
textfont
);
if
(
font
)
{
data
[
'
textfont
'
]
=
`
${
font
}
14`
}
...
...
@@ -247,6 +259,7 @@ export class YGOProComponent implements OnInit {
start_game
(
args
)
{
let
win
=
remote
.
getCurrentWindow
();
win
.
minimize
();
console
.
log
(
path
.
join
((
<
AppLocal
>
this
.
app
.
local
).
path
,
(
<
any
>
this
.
app
.
actions
.
get
(
'
main
'
)).
execute
),
args
,
{
cwd
:
(
<
AppLocal
>
this
.
app
.
local
).
path
});
return
new
Promise
((
resolve
,
reject
)
=>
{
let
child
=
child_process
.
spawn
(
path
.
join
((
<
AppLocal
>
this
.
app
.
local
).
path
,
(
<
any
>
this
.
app
.
actions
.
get
(
'
main
'
)).
execute
),
args
,
{
cwd
:
(
<
AppLocal
>
this
.
app
.
local
).
path
});
child
.
on
(
'
error
'
,
(
error
)
=>
{
...
...
@@ -310,7 +323,7 @@ export class YGOProComponent implements OnInit {
request_match
(
arena
=
'
entertain
'
)
{
let
headers
=
new
Headers
();
headers
.
append
(
"
Authorization
"
,
"
Basic
"
+
btoa
(
this
.
loginService
.
user
.
username
+
"
:
"
+
this
.
loginService
.
user
.
external_id
));
headers
.
append
(
"
Authorization
"
,
"
Basic
"
+
new
Buffer
(
this
.
loginService
.
user
.
username
+
"
:
"
+
this
.
loginService
.
user
.
external_id
).
toString
(
'
base64
'
));
let
search
=
new
URLSearchParams
();
search
.
set
(
"
arena
"
,
arena
);
this
.
matching_arena
=
arena
;
...
...
apps.json
View file @
63c630a6
...
...
@@ -2043,9 +2043,7 @@
],
"dependencies"
:
{
"win32"
:
[],
"darwin"
:
[
"wine"
]
"darwin"
:
[]
},
"references"
:
{
"win32"
:
[],
...
...
candy/index.html
View file @
63c630a6
...
...
@@ -20,15 +20,15 @@
const
{
remote
,
ipcRenderer
}
=
require
(
'
electron
'
);
require
(
'
electron-cookies
'
);
// https://github.com/hstove/electron-cookies
// remote.getCurrentWebContents().openDevTools();
// remote.getCurrentWebContents().openDevTools();
ipcRenderer
.
on
(
'
join
'
,
(
event
,
message
)
=>
{
Candy
.
Core
.
Action
.
Jabber
.
Room
.
Join
(
message
);
Candy
.
View
.
Pane
.
Chat
.
setActiveTab
(
message
);
});
// fix
Base64
.
encode
=
btoa
.
bind
(
window
);
Base64
.
decode
=
atob
.
bind
(
window
);
Base64
.
encode
=
(
data
)
=>
new
Buffer
(
data
).
toString
(
'
base64
'
);
Base64
.
decode
=
(
data
)
=>
new
Buffer
(
data
,
'
base64
'
).
toString
(
);
// candy init
const
params
=
new
URLSearchParams
(
location
.
search
);
...
...
index.js
View file @
63c630a6
...
...
@@ -12,13 +12,25 @@ if (process.platform == 'darwin') {
}
}
autoUpdater
.
on
(
'
error
'
,
(
event
)
=>
console
.
log
(
'
error
'
,
event
));
autoUpdater
.
on
(
'
checking-for-update
'
,
(
event
)
=>
console
.
log
(
'
checking-for-update
'
));
autoUpdater
.
on
(
'
update-available
'
,
(
event
)
=>
console
.
log
(
'
update-available
'
));
autoUpdater
.
on
(
'
update-not-available
'
,
(
event
)
=>
console
.
log
(
'
update-not-available
'
));
global
.
autoUpdater
=
autoUpdater
;
autoUpdater
.
on
(
'
error
'
,
(
event
)
=>
{
console
.
log
(
'
autoUpdater
'
,
'
error
'
,
event
);
});
autoUpdater
.
on
(
'
checking-for-update
'
,
()
=>
{
console
.
log
(
'
autoUpdater
'
,
'
checking-for-update
'
);
});
autoUpdater
.
on
(
'
update-available
'
,
()
=>
{
console
.
log
(
'
autoUpdater
'
,
'
update-available
'
);
});
autoUpdater
.
on
(
'
update-not-available
'
,
()
=>
{
console
.
log
(
'
autoUpdater
'
,
'
update-not-available
'
);
});
let
updateWindow
;
autoUpdater
.
on
(
'
update-downloaded
'
,
(
event
)
=>
{
autoUpdater
.
on
(
'
update-downloaded
'
,
(
event
)
=>
{
console
.
log
(
'
autoUpdater
'
,
'
update-downloaded
'
,
event
);
updateWindow
=
new
BrowserWindow
({
width
:
640
,
height
:
480
,
...
...
@@ -114,9 +126,9 @@ function createWindow() {
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app
.
on
(
'
ready
'
,
()
=>
{
autoUpdater
.
checkForUpdates
();
createWindow
()
app
.
on
(
'
ready
'
,
()
=>
{
createWindow
();
setTimeout
(
autoUpdater
.
checkForUpdates
,
2000
);
});
// Quit when all windows are closed.
...
...
@@ -135,7 +147,7 @@ app.on('activate', function () {
// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here.
app
.
on
(
'
quit
'
,
()
=>
{
app
.
on
(
'
quit
'
,
()
=>
{
// windows 在非 detach 模式下会自动退出子进程
if
(
process
.
platform
!=
'
win32
'
)
{
aria2c
.
kill
()
...
...
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