Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FinClip
ligase
提交
cc2f755c
ligase
项目概览
FinClip
/
ligase
通知
33
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ligase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
cc2f755c
编写于
9月 20, 2017
作者:
E
Erik Johnston
提交者:
GitHub
9月 20, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add gosimple linter (#242)
上级
b72142ac
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
28 addition
and
66 deletion
+28
-66
linter.json
linter.json
+2
-1
src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/storage.go
...ix-org/dendrite/clientapi/auth/storage/devices/storage.go
+1
-4
src/github.com/matrix-org/dendrite/clientapi/producers/syncapi.go
...ub.com/matrix-org/dendrite/clientapi/producers/syncapi.go
+2
-5
src/github.com/matrix-org/dendrite/clientapi/producers/userupdate.go
...com/matrix-org/dendrite/clientapi/producers/userupdate.go
+2
-5
src/github.com/matrix-org/dendrite/common/keydb/server_key_table.go
....com/matrix-org/dendrite/common/keydb/server_key_table.go
+1
-4
src/github.com/matrix-org/dendrite/common/test/config.go
src/github.com/matrix-org/dendrite/common/test/config.go
+6
-12
src/github.com/matrix-org/dendrite/federationapi/writers/threepid.go
...com/matrix-org/dendrite/federationapi/writers/threepid.go
+1
-5
src/github.com/matrix-org/dendrite/mediaapi/fileutils/fileutils.go
...b.com/matrix-org/dendrite/mediaapi/fileutils/fileutils.go
+1
-1
src/github.com/matrix-org/dendrite/mediaapi/thumbnailer/thumbnailer.go
...m/matrix-org/dendrite/mediaapi/thumbnailer/thumbnailer.go
+1
-5
src/github.com/matrix-org/dendrite/mediaapi/thumbnailer/thumbnailer_nfnt.go
...rix-org/dendrite/mediaapi/thumbnailer/thumbnailer_nfnt.go
+1
-1
src/github.com/matrix-org/dendrite/mediaapi/writers/download.go
...thub.com/matrix-org/dendrite/mediaapi/writers/download.go
+3
-3
src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go
...github.com/matrix-org/dendrite/mediaapi/writers/upload.go
+1
-1
src/github.com/matrix-org/dendrite/publicroomsapi/directory/public_rooms.go
...rix-org/dendrite/publicroomsapi/directory/public_rooms.go
+1
-4
src/github.com/matrix-org/dendrite/roomserver/alias/alias.go
src/github.com/matrix-org/dendrite/roomserver/alias/alias.go
+1
-5
src/github.com/matrix-org/dendrite/roomserver/input/latest_events.go
...com/matrix-org/dendrite/roomserver/input/latest_events.go
+3
-7
src/github.com/matrix-org/dendrite/syncapi/storage/syncserver.go
...hub.com/matrix-org/dendrite/syncapi/storage/syncserver.go
+1
-3
未找到文件。
linter.json
浏览文件 @
cc2f755c
...
...
@@ -16,6 +16,7 @@
"misspell"
,
"unparam"
,
"errcheck"
,
"vet"
"vet"
,
"gosimple"
]
}
src/github.com/matrix-org/dendrite/clientapi/auth/storage/devices/storage.go
浏览文件 @
cc2f755c
...
...
@@ -67,10 +67,7 @@ func (d *Database) CreateDevice(
}
dev
,
err
=
d
.
devices
.
insertDevice
(
ctx
,
txn
,
deviceID
,
localpart
,
accessToken
)
if
err
!=
nil
{
return
err
}
return
nil
return
err
})
return
}
...
...
src/github.com/matrix-org/dendrite/clientapi/producers/syncapi.go
浏览文件 @
cc2f755c
...
...
@@ -45,9 +45,6 @@ func (p *SyncAPIProducer) SendData(userID string, roomID string, dataType string
m
.
Key
=
sarama
.
StringEncoder
(
userID
)
m
.
Value
=
sarama
.
ByteEncoder
(
value
)
if
_
,
_
,
err
:=
p
.
Producer
.
SendMessage
(
&
m
);
err
!=
nil
{
return
err
}
return
nil
_
,
_
,
err
=
p
.
Producer
.
SendMessage
(
&
m
)
return
err
}
src/github.com/matrix-org/dendrite/clientapi/producers/userupdate.go
浏览文件 @
cc2f755c
...
...
@@ -57,9 +57,6 @@ func (p *UserUpdateProducer) SendUpdate(
}
m
.
Value
=
sarama
.
ByteEncoder
(
value
)
if
_
,
_
,
err
:=
p
.
Producer
.
SendMessage
(
&
m
);
err
!=
nil
{
return
err
}
return
nil
_
,
_
,
err
=
p
.
Producer
.
SendMessage
(
&
m
)
return
err
}
src/github.com/matrix-org/dendrite/common/keydb/server_key_table.go
浏览文件 @
cc2f755c
...
...
@@ -116,10 +116,7 @@ func (s *serverKeyStatements) upsertServerKeys(
string
(
request
.
ServerName
),
string
(
request
.
KeyID
),
nameAndKeyID
(
request
),
int64
(
keys
.
ValidUntilTS
),
keyJSON
,
)
if
err
!=
nil
{
return
err
}
return
nil
return
err
}
func
nameAndKeyID
(
request
gomatrixserverlib
.
PublicKeyRequest
)
string
{
...
...
src/github.com/matrix-org/dendrite/common/test/config.go
浏览文件 @
cc2f755c
...
...
@@ -135,17 +135,14 @@ func NewMatrixKey(matrixKeyPath string) (err error) {
err
=
keyOut
.
Close
()
})()
if
err
=
pem
.
Encode
(
keyOut
,
&
pem
.
Block
{
err
=
pem
.
Encode
(
keyOut
,
&
pem
.
Block
{
Type
:
"MATRIX PRIVATE KEY"
,
Headers
:
map
[
string
]
string
{
"Key-ID"
:
"ed25519:"
+
base64
.
RawStdEncoding
.
EncodeToString
(
data
[
:
3
]),
},
Bytes
:
data
[
3
:
],
});
err
!=
nil
{
return
err
}
return
nil
})
return
err
}
const
certificateDuration
=
time
.
Hour
*
24
*
365
*
10
...
...
@@ -191,12 +188,9 @@ func NewTLSKey(tlsKeyPath, tlsCertPath string) error {
return
err
}
defer
keyOut
.
Close
()
// nolint: errcheck
if
err
=
pem
.
Encode
(
keyOut
,
&
pem
.
Block
{
err
=
pem
.
Encode
(
keyOut
,
&
pem
.
Block
{
Type
:
"RSA PRIVATE KEY"
,
Bytes
:
x509
.
MarshalPKCS1PrivateKey
(
priv
),
});
err
!=
nil
{
return
err
}
return
nil
})
return
err
}
src/github.com/matrix-org/dendrite/federationapi/writers/threepid.go
浏览文件 @
cc2f755c
...
...
@@ -347,9 +347,5 @@ func fillDisplayName(
// Use the m.room.third_party_invite event to fill the "displayname" and
// update the m.room.member event's content with it
content
.
ThirdPartyInvite
.
DisplayName
=
thirdPartyInviteContent
.
DisplayName
if
err
:=
builder
.
SetContent
(
content
);
err
!=
nil
{
return
err
}
return
nil
return
builder
.
SetContent
(
content
)
}
src/github.com/matrix-org/dendrite/mediaapi/fileutils/fileutils.go
浏览文件 @
cc2f755c
...
...
@@ -55,7 +55,7 @@ func GetPathFromBase64Hash(base64Hash types.Base64Hash, absBasePath config.Path)
// check if the absolute absBasePath is a prefix of the absolute filePath
// if so, no directory escape has occurred and the filePath is valid
// Note: absBasePath is already absolute
if
strings
.
HasPrefix
(
filePath
,
string
(
absBasePath
))
==
false
{
if
!
strings
.
HasPrefix
(
filePath
,
string
(
absBasePath
))
{
return
""
,
fmt
.
Errorf
(
"Invalid filePath (not within absBasePath %v): %v"
,
absBasePath
,
filePath
)
}
...
...
src/github.com/matrix-org/dendrite/mediaapi/thumbnailer/thumbnailer.go
浏览文件 @
cc2f755c
...
...
@@ -80,11 +80,7 @@ func SelectThumbnail(desired types.ThumbnailSize, thumbnails []*types.ThumbnailM
fitness
:=
calcThumbnailFitness
(
types
.
ThumbnailSize
(
thumbnailSize
),
nil
,
desired
)
if
isBetter
:=
fitness
.
betterThan
(
bestFit
,
desired
.
ResizeMethod
==
"crop"
);
isBetter
{
bestFit
=
fitness
chosenThumbnailSize
=
&
types
.
ThumbnailSize
{
Width
:
thumbnailSize
.
Width
,
Height
:
thumbnailSize
.
Height
,
ResizeMethod
:
thumbnailSize
.
ResizeMethod
,
}
chosenThumbnailSize
=
(
*
types
.
ThumbnailSize
)(
&
thumbnailSize
)
}
}
...
...
src/github.com/matrix-org/dendrite/mediaapi/thumbnailer/thumbnailer_nfnt.go
浏览文件 @
cc2f755c
...
...
@@ -156,7 +156,7 @@ func createThumbnail(src types.Path, img image.Image, config types.ThumbnailSize
logger
.
WithFields
(
log
.
Fields
{
"ActualWidth"
:
width
,
"ActualHeight"
:
height
,
"processTime"
:
time
.
Now
()
.
Sub
(
start
),
"processTime"
:
time
.
Since
(
start
),
})
.
Info
(
"Generated thumbnail"
)
stat
,
err
:=
os
.
Stat
(
string
(
dst
))
...
...
src/github.com/matrix-org/dendrite/mediaapi/writers/download.go
浏览文件 @
cc2f755c
...
...
@@ -155,7 +155,7 @@ func (r *downloadRequest) jsonErrorResponse(w http.ResponseWriter, res util.JSON
// Validate validates the downloadRequest fields
func
(
r
*
downloadRequest
)
Validate
()
*
util
.
JSONResponse
{
if
mediaIDRegex
.
MatchString
(
string
(
r
.
MediaMetadata
.
MediaID
))
==
false
{
if
!
mediaIDRegex
.
MatchString
(
string
(
r
.
MediaMetadata
.
MediaID
))
{
return
&
util
.
JSONResponse
{
Code
:
404
,
JSON
:
jsonerror
.
NotFound
(
fmt
.
Sprintf
(
"mediaId must be a non-empty string using only characters in %v"
,
mediaIDCharacters
)),
...
...
@@ -337,7 +337,7 @@ func (r *downloadRequest) getThumbnailFile(
thumbnail
,
thumbnailSize
=
thumbnailer
.
SelectThumbnail
(
r
.
ThumbnailSize
,
thumbnails
,
thumbnailSizes
)
// If dynamicThumbnails is true and we are not over-loaded then we would have generated what was requested above.
// So we don't try to generate a pre-generated thumbnail here.
if
thumbnailSize
!=
nil
&&
dynamicThumbnails
==
false
{
if
thumbnailSize
!=
nil
&&
!
dynamicThumbnails
{
r
.
Logger
.
WithFields
(
log
.
Fields
{
"Width"
:
thumbnailSize
.
Width
,
"Height"
:
thumbnailSize
.
Height
,
...
...
@@ -525,7 +525,7 @@ func (r *downloadRequest) fetchRemoteFileAndStoreMetadata(
// If the file is a duplicate (has the same hash as an existing file) then
// there is valid metadata in the database for that file. As such we only
// remove the file if it is not a duplicate.
if
duplicate
==
fals
e
{
if
!
duplicat
e
{
finalDir
:=
filepath
.
Dir
(
string
(
finalPath
))
fileutils
.
RemoveDir
(
types
.
Path
(
finalDir
),
r
.
Logger
)
}
...
...
src/github.com/matrix-org/dendrite/mediaapi/writers/upload.go
浏览文件 @
cc2f755c
...
...
@@ -226,7 +226,7 @@ func (r *uploadRequest) storeFileAndMetadata(tmpDir types.Path, absBasePath conf
// If the file is a duplicate (has the same hash as an existing file) then
// there is valid metadata in the database for that file. As such we only
// remove the file if it is not a duplicate.
if
duplicate
==
fals
e
{
if
!
duplicat
e
{
fileutils
.
RemoveDir
(
types
.
Path
(
path
.
Dir
(
string
(
finalPath
))),
r
.
Logger
)
}
return
&
util
.
JSONResponse
{
...
...
src/github.com/matrix-org/dendrite/publicroomsapi/directory/public_rooms.go
浏览文件 @
cc2f755c
...
...
@@ -102,10 +102,7 @@ func fillPublicRoomsReq(httpReq *http.Request, request *publicRoomReq) *util.JSO
request
.
Since
=
httpReq
.
FormValue
(
"since"
)
return
nil
}
else
if
httpReq
.
Method
==
"POST"
{
if
reqErr
:=
httputil
.
UnmarshalJSONRequest
(
httpReq
,
request
);
reqErr
!=
nil
{
return
reqErr
}
return
nil
return
httputil
.
UnmarshalJSONRequest
(
httpReq
,
request
)
}
return
&
util
.
JSONResponse
{
...
...
src/github.com/matrix-org/dendrite/roomserver/alias/alias.go
浏览文件 @
cc2f755c
...
...
@@ -217,11 +217,7 @@ func (r *RoomserverAliasAPI) sendUpdatedAliasesEvent(
var
inputRes
api
.
InputRoomEventsResponse
// Send the request
if
err
:=
r
.
InputAPI
.
InputRoomEvents
(
ctx
,
&
inputReq
,
&
inputRes
);
err
!=
nil
{
return
err
}
return
nil
return
r
.
InputAPI
.
InputRoomEvents
(
ctx
,
&
inputReq
,
&
inputRes
)
}
// SetupHTTP adds the RoomserverAliasAPI handlers to the http.ServeMux.
...
...
src/github.com/matrix-org/dendrite/roomserver/input/latest_events.go
浏览文件 @
cc2f755c
...
...
@@ -102,8 +102,7 @@ type latestEventsUpdater struct {
}
func
(
u
*
latestEventsUpdater
)
doUpdateLatestEvents
()
error
{
var
prevEvents
[]
gomatrixserverlib
.
EventReference
prevEvents
=
u
.
event
.
PrevEvents
()
prevEvents
:=
u
.
event
.
PrevEvents
()
oldLatest
:=
u
.
updater
.
LatestEvents
()
u
.
lastEventIDSent
=
u
.
updater
.
LastEventIDSent
()
u
.
oldStateNID
=
u
.
updater
.
CurrentStateSnapshotNID
()
...
...
@@ -194,10 +193,7 @@ func (u *latestEventsUpdater) latestState() error {
u
.
stateBeforeEventRemoves
,
u
.
stateBeforeEventAdds
,
err
=
state
.
DifferenceBetweeenStateSnapshots
(
u
.
ctx
,
u
.
db
,
u
.
newStateNID
,
u
.
stateAtEvent
.
BeforeStateSnapshotNID
,
)
if
err
!=
nil
{
return
err
}
return
nil
return
err
}
func
calculateLatest
(
...
...
@@ -211,7 +207,7 @@ func calculateLatest(
for
_
,
l
:=
range
oldLatest
{
keep
:=
true
for
_
,
prevEvent
:=
range
prevEvents
{
if
l
.
EventID
==
prevEvent
.
EventID
&&
bytes
.
Compare
(
l
.
EventSHA256
,
prevEvent
.
EventSHA256
)
==
0
{
if
l
.
EventID
==
prevEvent
.
EventID
&&
bytes
.
Equal
(
l
.
EventSHA256
,
prevEvent
.
EventSHA256
)
{
// This event can be removed from the latest events cause we've found an event that references it.
// (If an event is referenced by another event then it can't be one of the latest events in the room
// because we have an event that comes after it)
...
...
src/github.com/matrix-org/dendrite/syncapi/storage/syncserver.go
浏览文件 @
cc2f755c
...
...
@@ -461,9 +461,7 @@ func (d *SyncServerDatabase) fetchMissingStateEvents(
if
len
(
stateEvents
)
!=
len
(
missing
)
{
return
nil
,
fmt
.
Errorf
(
"failed to map all event IDs to events: (got %d, wanted %d)"
,
len
(
stateEvents
),
len
(
missing
))
}
for
_
,
e
:=
range
stateEvents
{
events
=
append
(
events
,
e
)
}
events
=
append
(
events
,
stateEvents
...
)
return
events
,
nil
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录