Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
后端镜像
Tabby
提交
0008b2f0
T
Tabby
项目概览
后端镜像
/
Tabby
通知
31
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Tabby
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
0008b2f0
编写于
7月 10, 2021
作者:
E
Eugene Pankov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
preserve file modes for up- and downloads - fixes #4141
上级
3e61630c
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
35 addition
and
13 deletion
+35
-13
tabby-core/src/api/platform.ts
tabby-core/src/api/platform.ts
+6
-1
tabby-electron/src/services/platform.service.ts
tabby-electron/src/services/platform.service.ts
+16
-4
tabby-ssh/src/components/sftpPanel.component.ts
tabby-ssh/src/components/sftpPanel.component.ts
+4
-4
tabby-terminal/src/features/debug.ts
tabby-terminal/src/features/debug.ts
+1
-1
tabby-terminal/src/features/zmodem.ts
tabby-terminal/src/features/zmodem.ts
+1
-1
tabby-web/src/platform.ts
tabby-web/src/platform.ts
+7
-2
未找到文件。
tabby-core/src/api/platform.ts
浏览文件 @
0008b2f0
...
...
@@ -21,6 +21,7 @@ export interface MessageBoxResult {
export
abstract
class
FileTransfer
{
abstract
getName
():
string
abstract
getMode
():
number
abstract
getSize
():
number
abstract
close
():
void
...
...
@@ -95,7 +96,7 @@ export abstract class PlatformService {
abstract
loadConfig
():
Promise
<
string
>
abstract
saveConfig
(
content
:
string
):
Promise
<
void
>
abstract
startDownload
(
name
:
string
,
size
:
number
):
Promise
<
FileDownload
|
null
>
abstract
startDownload
(
name
:
string
,
mode
:
number
,
size
:
number
):
Promise
<
FileDownload
|
null
>
abstract
startUpload
(
options
?:
FileUploadOptions
):
Promise
<
FileUpload
[]
>
startUploadFromDragEvent
(
event
:
DragEvent
,
multiple
=
false
):
FileUpload
[]
{
...
...
@@ -188,6 +189,10 @@ export class HTMLFileUpload extends FileUpload {
return
this
.
file
.
name
}
getMode
():
number
{
return
0o644
}
getSize
():
number
{
return
this
.
file
.
size
}
...
...
tabby-electron/src/services/platform.service.ts
浏览文件 @
0008b2f0
...
...
@@ -205,7 +205,7 @@ export class ElectronPlatformService extends PlatformService {
}))
}
async
startDownload
(
name
:
string
,
size
:
number
):
Promise
<
FileDownload
|
null
>
{
async
startDownload
(
name
:
string
,
mode
:
number
,
size
:
number
):
Promise
<
FileDownload
|
null
>
{
const
result
=
await
this
.
electron
.
dialog
.
showSaveDialog
(
this
.
hostWindow
.
getWindow
(),
{
...
...
@@ -215,7 +215,7 @@ export class ElectronPlatformService extends PlatformService {
if
(
!
result
.
filePath
)
{
return
null
}
const
transfer
=
new
ElectronFileDownload
(
result
.
filePath
,
size
)
const
transfer
=
new
ElectronFileDownload
(
result
.
filePath
,
mode
,
size
)
await
wrapPromise
(
this
.
zone
,
transfer
.
open
())
this
.
fileTransferStarted
.
next
(
transfer
)
return
transfer
...
...
@@ -230,6 +230,7 @@ export class ElectronPlatformService extends PlatformService {
class
ElectronFileUpload
extends
FileUpload
{
private
size
:
number
private
mode
:
number
private
file
:
fs
.
FileHandle
private
buffer
:
Buffer
...
...
@@ -239,7 +240,9 @@ class ElectronFileUpload extends FileUpload {
}
async
open
():
Promise
<
void
>
{
this
.
size
=
(
await
fs
.
stat
(
this
.
filePath
)).
size
const
stat
=
await
fs
.
stat
(
this
.
filePath
)
this
.
size
=
stat
.
size
this
.
mode
=
stat
.
mode
this
.
file
=
await
fs
.
open
(
this
.
filePath
,
'
r
'
)
}
...
...
@@ -247,6 +250,10 @@ class ElectronFileUpload extends FileUpload {
return
path
.
basename
(
this
.
filePath
)
}
getMode
():
number
{
return
this
.
mode
}
getSize
():
number
{
return
this
.
size
}
...
...
@@ -267,19 +274,24 @@ class ElectronFileDownload extends FileDownload {
constructor
(
private
filePath
:
string
,
private
mode
:
number
,
private
size
:
number
,
)
{
super
()
}
async
open
():
Promise
<
void
>
{
this
.
file
=
await
fs
.
open
(
this
.
filePath
,
'
w
'
)
this
.
file
=
await
fs
.
open
(
this
.
filePath
,
'
w
'
,
this
.
mode
)
}
getName
():
string
{
return
path
.
basename
(
this
.
filePath
)
}
getMode
():
number
{
return
this
.
mode
}
getSize
():
number
{
return
this
.
size
}
...
...
tabby-ssh/src/components/sftpPanel.component.ts
浏览文件 @
0008b2f0
...
...
@@ -82,10 +82,10 @@ export class SFTPPanelComponent {
if
(
stat
.
isDirectory
)
{
await
this
.
navigate
(
item
.
fullPath
)
}
else
{
await
this
.
download
(
item
.
fullPath
,
stat
.
size
)
await
this
.
download
(
item
.
fullPath
,
stat
.
mode
,
stat
.
size
)
}
}
else
{
await
this
.
download
(
item
.
fullPath
,
item
.
size
)
await
this
.
download
(
item
.
fullPath
,
item
.
mode
,
item
.
size
)
}
}
...
...
@@ -117,8 +117,8 @@ export class SFTPPanelComponent {
}
}
async
download
(
itemPath
:
string
,
size
:
number
):
Promise
<
void
>
{
const
transfer
=
await
this
.
platform
.
startDownload
(
path
.
basename
(
itemPath
),
size
)
async
download
(
itemPath
:
string
,
mode
:
number
,
size
:
number
):
Promise
<
void
>
{
const
transfer
=
await
this
.
platform
.
startDownload
(
path
.
basename
(
itemPath
),
mode
,
size
)
if
(
!
transfer
)
{
return
}
...
...
tabby-terminal/src/features/debug.ts
浏览文件 @
0008b2f0
...
...
@@ -71,7 +71,7 @@ export class DebugDecorator extends TerminalDecorator {
private
async
saveFile
(
content
:
string
,
name
:
string
)
{
const
data
=
Buffer
.
from
(
content
)
const
transfer
=
await
this
.
platform
.
startDownload
(
name
,
data
.
length
)
const
transfer
=
await
this
.
platform
.
startDownload
(
name
,
0o644
,
data
.
length
)
if
(
transfer
)
{
transfer
.
write
(
data
)
transfer
.
close
()
...
...
tabby-terminal/src/features/zmodem.ts
浏览文件 @
0008b2f0
...
...
@@ -113,7 +113,7 @@ export class ZModemDecorator extends TerminalDecorator {
this
.
showMessage
(
terminal
,
colors
.
bgYellow
.
black
(
'
Offered
'
)
+
'
'
+
details
.
name
,
true
)
this
.
logger
.
info
(
'
offered
'
,
xfer
)
const
transfer
=
await
this
.
platform
.
startDownload
(
details
.
name
,
details
.
size
)
const
transfer
=
await
this
.
platform
.
startDownload
(
details
.
name
,
0o644
,
details
.
size
)
if
(
!
transfer
)
{
this
.
showMessage
(
terminal
,
colors
.
bgRed
.
black
(
'
Rejected
'
)
+
'
'
+
details
.
name
)
xfer
.
skip
()
...
...
tabby-web/src/platform.ts
浏览文件 @
0008b2f0
...
...
@@ -108,8 +108,8 @@ export class WebPlatformService extends PlatformService {
window
.
close
()
}
async
startDownload
(
name
:
string
,
size
:
number
):
Promise
<
FileDownload
|
null
>
{
const
transfer
=
new
HTMLFileDownload
(
name
,
size
)
async
startDownload
(
name
:
string
,
mode
:
number
,
size
:
number
):
Promise
<
FileDownload
|
null
>
{
const
transfer
=
new
HTMLFileDownload
(
name
,
mode
,
size
)
this
.
fileTransferStarted
.
next
(
transfer
)
return
transfer
}
...
...
@@ -145,6 +145,7 @@ class HTMLFileDownload extends FileDownload {
constructor
(
private
name
:
string
,
private
mode
:
number
,
private
size
:
number
,
)
{
super
()
...
...
@@ -154,6 +155,10 @@ class HTMLFileDownload extends FileDownload {
return
this
.
name
}
getMode
():
number
{
return
this
.
mode
}
getSize
():
number
{
return
this
.
size
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录