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
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 @@
<h4
i18n
>
快捷方式
</h4>
<div
class=
"checkbox"
>
<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 == 'win32'"
for=
"create_application_shortcut"
>
创建开始菜单快捷方式
</label>
</div>
...
...
@@ -362,4 +363,4 @@
</div>
</div>
</div>
</div>
\ No newline at end of file
</div>
app/apps.service.ts
View file @
6ee42d78
import
{
ApplicationRef
,
EventEmitter
,
Injectable
,
NgZone
}
from
'
@angular/core
'
;
import
{
Http
}
from
'
@angular/http
'
;
import
{
ApplicationRef
,
EventEmitter
,
Injectable
,
NgZone
}
from
'
@angular/core
'
;
import
{
Http
}
from
'
@angular/http
'
;
import
*
as
child_process
from
'
child_process
'
;
import
{
ChildProcess
}
from
'
child_process
'
;
import
{
ChildProcess
}
from
'
child_process
'
;
import
*
as
crypto
from
'
crypto
'
;
import
{
remote
}
from
'
electron
'
;
import
{
remote
}
from
'
electron
'
;
import
*
as
sudo
from
'
electron-sudo
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
glob
from
'
glob
'
;
...
...
@@ -11,16 +11,17 @@ import * as ini from 'ini';
import
*
as
path
from
'
path
'
;
import
*
as
readline
from
'
readline
'
;
import
'
rxjs/Rx
'
;
import
{
Observable
,
Observer
}
from
'
rxjs/Rx
'
;
import
{
Action
,
App
,
AppStatus
}
from
'
./app
'
;
import
{
AppLocal
}
from
'
./app-local
'
;
import
{
DownloadService
,
DownloadStatus
}
from
'
./download.service
'
;
import
{
InstallOption
}
from
'
./install-option
'
;
import
{
LoginService
}
from
'
./login.service
'
;
import
{
SettingsService
}
from
'
./settings.sevices
'
;
import
{
ComparableSet
}
from
'
./shared/ComparableSet
'
;
import
{
Observable
,
Observer
}
from
'
rxjs/Rx
'
;
import
{
Action
,
App
,
AppStatus
}
from
'
./app
'
;
import
{
AppLocal
}
from
'
./app-local
'
;
import
{
DownloadService
,
DownloadStatus
}
from
'
./download.service
'
;
import
{
InstallOption
}
from
'
./install-option
'
;
import
{
LoginService
}
from
'
./login.service
'
;
import
{
SettingsService
}
from
'
./settings.sevices
'
;
import
{
ComparableSet
}
from
'
./shared/ComparableSet
'
;
import
Timer
=
NodeJS
.
Timer
;
import
ReadableStream
=
NodeJS
.
ReadableStream
;
const
Logger
=
{
info
:
(...
message
:
any
[])
=>
{
console
.
log
(
'
AppService [INFO]:
'
,
...
message
);
...
...
@@ -29,16 +30,19 @@ const Logger = {
console
.
error
(
'
AppService [ERROR]:
'
,
...
message
);
}
};
interface
InstallTask
{
app
:
App
;
option
:
InstallOption
;
}
interface
InstallStatus
{
status
:
string
;
progress
:
number
;
total
:
number
;
lastItem
:
string
;
}
interface
Connection
{
connection
:
WebSocket
;
address
:
string
|
null
;
...
...
@@ -49,16 +53,14 @@ declare const System: any;
@
Injectable
()
export
class
AppsService
{
private
apps
:
Map
<
string
,
App
>
;
eventEmitter
=
new
EventEmitter
<
void
>
();
map
:
Map
<
string
,
string
>
=
new
Map
();
connections
=
new
Map
<
App
,
Connection
>
();
maotama
:
Promise
<
ChildProcess
>
;
readonly
tarPath
=
process
.
platform
===
'
win32
'
?
path
.
join
(
process
.
env
[
'
NODE_ENV
'
]
===
'
production
'
?
process
.
resourcesPath
!
:
''
,
'
bin
'
,
'
bsdtar.exe
'
)
:
'
bsdtar
'
;
private
apps
:
Map
<
string
,
App
>
;
constructor
(
private
http
:
Http
,
private
settingsService
:
SettingsService
,
private
ref
:
ApplicationRef
,
private
downloadService
:
DownloadService
,
private
ngZone
:
NgZone
,
private
loginService
:
LoginService
)
{
...
...
@@ -264,6 +266,8 @@ export class AppsService {
if
(
app
[
key
])
{
if
(
app
[
key
][
platform
])
{
app
[
key
]
=
app
[
key
][
platform
];
}
else
if
(
platform
===
'
linux
'
&&
app
[
key
].
darwin
)
{
app
[
key
]
=
app
[
key
].
darwin
;
}
else
{
app
[
key
]
=
null
;
}
...
...
@@ -475,7 +479,7 @@ export class AppsService {
}
else
{
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
'
;
try
{
Logger
.
info
(
'
Checking updating:
'
,
app
);
...
...
@@ -1026,8 +1030,7 @@ export class AppsService {
}
catch
(
e
)
{
console
.
log
(
'
exception in doInstall
'
,
e
);
throw
e
;
}
finally
{
}
finally
{
this
.
eventEmitter
.
emit
();
}
...
...
app/download.service.ts
View file @
6ee42d78
...
...
@@ -199,7 +199,7 @@ export class DownloadService {
}
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
taskId
=
this
.
createId
();
this
.
taskMap
.
set
(
taskId
,
gidList
);
...
...
app/ygopro.component.ts
View file @
6ee42d78
...
...
@@ -611,7 +611,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
};
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
options_buffer
.
writeUInt8
((
room
.
private
?
2
:
1
)
<<
4
,
1
);
options_buffer
.
writeUInt8
(
...
...
@@ -655,7 +655,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
}
join_room
(
room
:
Room
)
{
let
options_buffer
=
new
Buffer
(
6
);
let
options_buffer
=
Buffer
.
alloc
(
6
);
options_buffer
.
writeUInt8
(
3
<<
4
,
1
);
let
checksum
=
0
;
for
(
let
i
=
1
;
i
<
options_buffer
.
length
;
i
++
)
{
...
...
@@ -675,7 +675,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
}
join_private
(
password
:
string
)
{
let
options_buffer
=
new
Buffer
(
6
);
let
options_buffer
=
Buffer
.
alloc
(
6
);
options_buffer
.
writeUInt8
(
5
<<
4
,
1
);
let
checksum
=
0
;
for
(
let
i
=
1
;
i
<
options_buffer
.
length
;
i
++
)
{
...
...
index.js
View file @
6ee42d78
...
...
@@ -12,7 +12,7 @@ function handleElevate() {
if
(
process
.
platform
===
'
darwin
'
)
{
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
()
{
process
.
send
=
(
message
,
sendHandle
,
options
,
callback
)
=>
this
.
write
(
JSON
.
stringify
(
message
)
+
require
(
'
os
'
).
EOL
,
callback
);
this
.
on
(
'
end
'
,
()
=>
process
.
emit
(
'
disconnect
'
));
...
...
maotama.js
View file @
6ee42d78
...
...
@@ -2,7 +2,7 @@ const raw = require("raw-socket");
let
socket
=
raw
.
createSocket
({
protocol
:
raw
.
Protocol
.
UDP
});
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
(
remote_port
,
2
);
buffer
.
writeUInt16BE
(
buffer
.
length
,
4
);
...
...
@@ -21,4 +21,4 @@ process.on('message', (message)=> {
process
.
on
(
'
disconnect
'
,
process
.
exit
);
process
.
send
(
'
initialized
'
);
\ No newline at end of file
process
.
send
(
'
initialized
'
);
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