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
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
MyCard
mycard
Commits
6ee42d78
Commit
6ee42d78
authored
Jul 09, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
buffer things
parent
69014ef8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
26 deletions
+30
-26
app/app-detail.component.html
app/app-detail.component.html
+2
-1
app/apps.service.ts
app/apps.service.ts
+21
-18
app/download.service.ts
app/download.service.ts
+1
-1
app/ygopro.component.ts
app/ygopro.component.ts
+3
-3
index.js
index.js
+1
-1
maotama.js
maotama.js
+2
-2
No files found.
app/app-detail.component.html
View file @
6ee42d78
...
@@ -214,6 +214,7 @@
...
@@ -214,6 +214,7 @@
<h4
i18n
>
快捷方式
</h4>
<h4
i18n
>
快捷方式
</h4>
<div
class=
"checkbox"
>
<div
class=
"checkbox"
>
<input
id=
"create_application_shortcut"
type=
"checkbox"
name=
"application"
[(ngModel)]=
"installOption.createShortcut"
>
<input
id=
"create_application_shortcut"
type=
"checkbox"
name=
"application"
[(ngModel)]=
"installOption.createShortcut"
>
<label
i18n
*ngIf=
"platform == 'linux'"
for=
"create_application_shortcut"
>
创建启动菜单快捷方式
</label>
<label
i18n
*ngIf=
"platform == 'darwin'"
for=
"create_application_shortcut"
>
创建 LaunchPad 快捷方式
</label>
<label
i18n
*ngIf=
"platform == 'darwin'"
for=
"create_application_shortcut"
>
创建 LaunchPad 快捷方式
</label>
<label
i18n
*ngIf=
"platform == 'win32'"
for=
"create_application_shortcut"
>
创建开始菜单快捷方式
</label>
<label
i18n
*ngIf=
"platform == 'win32'"
for=
"create_application_shortcut"
>
创建开始菜单快捷方式
</label>
</div>
</div>
...
@@ -362,4 +363,4 @@
...
@@ -362,4 +363,4 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
app/apps.service.ts
View file @
6ee42d78
import
{
ApplicationRef
,
EventEmitter
,
Injectable
,
NgZone
}
from
'
@angular/core
'
;
import
{
ApplicationRef
,
EventEmitter
,
Injectable
,
NgZone
}
from
'
@angular/core
'
;
import
{
Http
}
from
'
@angular/http
'
;
import
{
Http
}
from
'
@angular/http
'
;
import
*
as
child_process
from
'
child_process
'
;
import
*
as
child_process
from
'
child_process
'
;
import
{
ChildProcess
}
from
'
child_process
'
;
import
{
ChildProcess
}
from
'
child_process
'
;
import
*
as
crypto
from
'
crypto
'
;
import
*
as
crypto
from
'
crypto
'
;
import
{
remote
}
from
'
electron
'
;
import
{
remote
}
from
'
electron
'
;
import
*
as
sudo
from
'
electron-sudo
'
;
import
*
as
sudo
from
'
electron-sudo
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
glob
from
'
glob
'
;
import
*
as
glob
from
'
glob
'
;
...
@@ -11,16 +11,17 @@ import * as ini from 'ini';
...
@@ -11,16 +11,17 @@ import * as ini from 'ini';
import
*
as
path
from
'
path
'
;
import
*
as
path
from
'
path
'
;
import
*
as
readline
from
'
readline
'
;
import
*
as
readline
from
'
readline
'
;
import
'
rxjs/Rx
'
;
import
'
rxjs/Rx
'
;
import
{
Observable
,
Observer
}
from
'
rxjs/Rx
'
;
import
{
Observable
,
Observer
}
from
'
rxjs/Rx
'
;
import
{
Action
,
App
,
AppStatus
}
from
'
./app
'
;
import
{
Action
,
App
,
AppStatus
}
from
'
./app
'
;
import
{
AppLocal
}
from
'
./app-local
'
;
import
{
AppLocal
}
from
'
./app-local
'
;
import
{
DownloadService
,
DownloadStatus
}
from
'
./download.service
'
;
import
{
DownloadService
,
DownloadStatus
}
from
'
./download.service
'
;
import
{
InstallOption
}
from
'
./install-option
'
;
import
{
InstallOption
}
from
'
./install-option
'
;
import
{
LoginService
}
from
'
./login.service
'
;
import
{
LoginService
}
from
'
./login.service
'
;
import
{
SettingsService
}
from
'
./settings.sevices
'
;
import
{
SettingsService
}
from
'
./settings.sevices
'
;
import
{
ComparableSet
}
from
'
./shared/ComparableSet
'
;
import
{
ComparableSet
}
from
'
./shared/ComparableSet
'
;
import
Timer
=
NodeJS
.
Timer
;
import
Timer
=
NodeJS
.
Timer
;
import
ReadableStream
=
NodeJS
.
ReadableStream
;
import
ReadableStream
=
NodeJS
.
ReadableStream
;
const
Logger
=
{
const
Logger
=
{
info
:
(...
message
:
any
[])
=>
{
info
:
(...
message
:
any
[])
=>
{
console
.
log
(
'
AppService [INFO]:
'
,
...
message
);
console
.
log
(
'
AppService [INFO]:
'
,
...
message
);
...
@@ -29,16 +30,19 @@ const Logger = {
...
@@ -29,16 +30,19 @@ const Logger = {
console
.
error
(
'
AppService [ERROR]:
'
,
...
message
);
console
.
error
(
'
AppService [ERROR]:
'
,
...
message
);
}
}
};
};
interface
InstallTask
{
interface
InstallTask
{
app
:
App
;
app
:
App
;
option
:
InstallOption
;
option
:
InstallOption
;
}
}
interface
InstallStatus
{
interface
InstallStatus
{
status
:
string
;
status
:
string
;
progress
:
number
;
progress
:
number
;
total
:
number
;
total
:
number
;
lastItem
:
string
;
lastItem
:
string
;
}
}
interface
Connection
{
interface
Connection
{
connection
:
WebSocket
;
connection
:
WebSocket
;
address
:
string
|
null
;
address
:
string
|
null
;
...
@@ -49,16 +53,14 @@ declare const System: any;
...
@@ -49,16 +53,14 @@ declare const System: any;
@
Injectable
()
@
Injectable
()
export
class
AppsService
{
export
class
AppsService
{
private
apps
:
Map
<
string
,
App
>
;
eventEmitter
=
new
EventEmitter
<
void
>
();
eventEmitter
=
new
EventEmitter
<
void
>
();
map
:
Map
<
string
,
string
>
=
new
Map
();
map
:
Map
<
string
,
string
>
=
new
Map
();
connections
=
new
Map
<
App
,
Connection
>
();
connections
=
new
Map
<
App
,
Connection
>
();
maotama
:
Promise
<
ChildProcess
>
;
maotama
:
Promise
<
ChildProcess
>
;
readonly
tarPath
=
process
.
platform
===
'
win32
'
?
readonly
tarPath
=
process
.
platform
===
'
win32
'
?
path
.
join
(
process
.
env
[
'
NODE_ENV
'
]
===
'
production
'
?
process
.
resourcesPath
!
:
''
,
'
bin
'
,
'
bsdtar.exe
'
)
path
.
join
(
process
.
env
[
'
NODE_ENV
'
]
===
'
production
'
?
process
.
resourcesPath
!
:
''
,
'
bin
'
,
'
bsdtar.exe
'
)
:
'
bsdtar
'
;
:
'
bsdtar
'
;
private
apps
:
Map
<
string
,
App
>
;
constructor
(
private
http
:
Http
,
private
settingsService
:
SettingsService
,
private
ref
:
ApplicationRef
,
constructor
(
private
http
:
Http
,
private
settingsService
:
SettingsService
,
private
ref
:
ApplicationRef
,
private
downloadService
:
DownloadService
,
private
ngZone
:
NgZone
,
private
loginService
:
LoginService
)
{
private
downloadService
:
DownloadService
,
private
ngZone
:
NgZone
,
private
loginService
:
LoginService
)
{
...
@@ -264,6 +266,8 @@ export class AppsService {
...
@@ -264,6 +266,8 @@ export class AppsService {
if
(
app
[
key
])
{
if
(
app
[
key
])
{
if
(
app
[
key
][
platform
])
{
if
(
app
[
key
][
platform
])
{
app
[
key
]
=
app
[
key
][
platform
];
app
[
key
]
=
app
[
key
][
platform
];
}
else
if
(
platform
===
'
linux
'
&&
app
[
key
].
darwin
)
{
app
[
key
]
=
app
[
key
].
darwin
;
}
else
{
}
else
{
app
[
key
]
=
null
;
app
[
key
]
=
null
;
}
}
...
@@ -475,7 +479,7 @@ export class AppsService {
...
@@ -475,7 +479,7 @@ export class AppsService {
}
else
{
}
else
{
readyToUpdate
=
app
.
isReady
()
&&
mods
.
every
((
mod
)
=>
mod
.
isReady
());
readyToUpdate
=
app
.
isReady
()
&&
mods
.
every
((
mod
)
=>
mod
.
isReady
());
}
}
if
(
readyToUpdate
&&
(
verify
||
app
.
local
!
.
version
!==
app
.
version
))
{
if
(
readyToUpdate
&&
(
verify
||
app
.
local
!
.
version
!==
app
.
version
))
{
app
.
status
.
status
=
'
updating
'
;
app
.
status
.
status
=
'
updating
'
;
try
{
try
{
Logger
.
info
(
'
Checking updating:
'
,
app
);
Logger
.
info
(
'
Checking updating:
'
,
app
);
...
@@ -1026,8 +1030,7 @@ export class AppsService {
...
@@ -1026,8 +1030,7 @@ export class AppsService {
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
exception in doInstall
'
,
e
);
console
.
log
(
'
exception in doInstall
'
,
e
);
throw
e
;
throw
e
;
}
}
finally
{
finally
{
this
.
eventEmitter
.
emit
();
this
.
eventEmitter
.
emit
();
}
}
...
...
app/download.service.ts
View file @
6ee42d78
...
@@ -199,7 +199,7 @@ export class DownloadService {
...
@@ -199,7 +199,7 @@ export class DownloadService {
}
}
async
addMetalink
(
metalink
:
string
,
library
:
string
):
Promise
<
string
>
{
async
addMetalink
(
metalink
:
string
,
library
:
string
):
Promise
<
string
>
{
let
encodedMeta4
=
new
Buffer
((
metalink
)).
toString
(
'
base64
'
);
let
encodedMeta4
=
Buffer
.
from
((
metalink
)).
toString
(
'
base64
'
);
let
gidList
=
await
this
.
aria2
.
addMetalink
(
encodedMeta4
,
{
dir
:
library
});
let
gidList
=
await
this
.
aria2
.
addMetalink
(
encodedMeta4
,
{
dir
:
library
});
let
taskId
=
this
.
createId
();
let
taskId
=
this
.
createId
();
this
.
taskMap
.
set
(
taskId
,
gidList
);
this
.
taskMap
.
set
(
taskId
,
gidList
);
...
...
app/ygopro.component.ts
View file @
6ee42d78
...
@@ -611,7 +611,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -611,7 +611,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
};
};
create_room
(
room
:
Room
)
{
create_room
(
room
:
Room
)
{
let
options_buffer
=
new
Buffer
(
6
);
let
options_buffer
=
Buffer
.
alloc
(
6
);
// 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
// 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
options_buffer
.
writeUInt8
((
room
.
private
?
2
:
1
)
<<
4
,
1
);
options_buffer
.
writeUInt8
((
room
.
private
?
2
:
1
)
<<
4
,
1
);
options_buffer
.
writeUInt8
(
options_buffer
.
writeUInt8
(
...
@@ -655,7 +655,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -655,7 +655,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
}
}
join_room
(
room
:
Room
)
{
join_room
(
room
:
Room
)
{
let
options_buffer
=
new
Buffer
(
6
);
let
options_buffer
=
Buffer
.
alloc
(
6
);
options_buffer
.
writeUInt8
(
3
<<
4
,
1
);
options_buffer
.
writeUInt8
(
3
<<
4
,
1
);
let
checksum
=
0
;
let
checksum
=
0
;
for
(
let
i
=
1
;
i
<
options_buffer
.
length
;
i
++
)
{
for
(
let
i
=
1
;
i
<
options_buffer
.
length
;
i
++
)
{
...
@@ -675,7 +675,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -675,7 +675,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
}
}
join_private
(
password
:
string
)
{
join_private
(
password
:
string
)
{
let
options_buffer
=
new
Buffer
(
6
);
let
options_buffer
=
Buffer
.
alloc
(
6
);
options_buffer
.
writeUInt8
(
5
<<
4
,
1
);
options_buffer
.
writeUInt8
(
5
<<
4
,
1
);
let
checksum
=
0
;
let
checksum
=
0
;
for
(
let
i
=
1
;
i
<
options_buffer
.
length
;
i
++
)
{
for
(
let
i
=
1
;
i
<
options_buffer
.
length
;
i
++
)
{
...
...
index.js
View file @
6ee42d78
...
@@ -12,7 +12,7 @@ function handleElevate() {
...
@@ -12,7 +12,7 @@ function handleElevate() {
if
(
process
.
platform
===
'
darwin
'
)
{
if
(
process
.
platform
===
'
darwin
'
)
{
require
(
'
electron
'
).
app
.
dock
.
hide
();
require
(
'
electron
'
).
app
.
dock
.
hide
();
}
}
let
elevate
=
JSON
.
parse
(
new
Buffer
(
process
.
argv
[
2
],
'
base64
'
).
toString
());
let
elevate
=
JSON
.
parse
(
Buffer
.
from
(
process
.
argv
[
2
],
'
base64
'
).
toString
());
require
(
'
net
'
).
connect
(
elevate
[
'
ipc
'
],
function
()
{
require
(
'
net
'
).
connect
(
elevate
[
'
ipc
'
],
function
()
{
process
.
send
=
(
message
,
sendHandle
,
options
,
callback
)
=>
this
.
write
(
JSON
.
stringify
(
message
)
+
require
(
'
os
'
).
EOL
,
callback
);
process
.
send
=
(
message
,
sendHandle
,
options
,
callback
)
=>
this
.
write
(
JSON
.
stringify
(
message
)
+
require
(
'
os
'
).
EOL
,
callback
);
this
.
on
(
'
end
'
,
()
=>
process
.
emit
(
'
disconnect
'
));
this
.
on
(
'
end
'
,
()
=>
process
.
emit
(
'
disconnect
'
));
...
...
maotama.js
View file @
6ee42d78
...
@@ -2,7 +2,7 @@ const raw = require("raw-socket");
...
@@ -2,7 +2,7 @@ const raw = require("raw-socket");
let
socket
=
raw
.
createSocket
({
protocol
:
raw
.
Protocol
.
UDP
});
let
socket
=
raw
.
createSocket
({
protocol
:
raw
.
Protocol
.
UDP
});
let
connect
=
(
local_port
,
remote_port
,
remote_address
)
=>
{
let
connect
=
(
local_port
,
remote_port
,
remote_address
)
=>
{
let
buffer
=
new
Buffer
(
9
);
let
buffer
=
Buffer
.
alloc
(
9
);
buffer
.
writeUInt16BE
(
local_port
,
0
);
buffer
.
writeUInt16BE
(
local_port
,
0
);
buffer
.
writeUInt16BE
(
remote_port
,
2
);
buffer
.
writeUInt16BE
(
remote_port
,
2
);
buffer
.
writeUInt16BE
(
buffer
.
length
,
4
);
buffer
.
writeUInt16BE
(
buffer
.
length
,
4
);
...
@@ -21,4 +21,4 @@ process.on('message', (message)=> {
...
@@ -21,4 +21,4 @@ process.on('message', (message)=> {
process
.
on
(
'
disconnect
'
,
process
.
exit
);
process
.
on
(
'
disconnect
'
,
process
.
exit
);
process
.
send
(
'
initialized
'
);
process
.
send
(
'
initialized
'
);
\ No newline at end of file
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