Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pureGavin
Syzkaller
提交
f1f9726a
S
Syzkaller
项目概览
pureGavin
/
Syzkaller
9 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Syzkaller
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f1f9726a
编写于
6月 16, 2023
作者:
T
Taras Madan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dashboard/app: prepare json generation code for extension
上级
d521bc56
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
12 deletion
+21
-12
dashboard/app/main.go
dashboard/app/main.go
+2
-6
dashboard/app/public_json_api.go
dashboard/app/public_json_api.go
+19
-6
未找到文件。
dashboard/app/main.go
浏览文件 @
f1f9726a
...
...
@@ -5,7 +5,6 @@ package main
import
(
"bytes"
"encoding/json"
"fmt"
"html/template"
"net/http"
...
...
@@ -1024,11 +1023,8 @@ func isJSONRequested(request *http.Request) bool {
return
request
.
FormValue
(
"json"
)
==
"1"
}
func
writeJSONVersionOf
(
writer
http
.
ResponseWriter
,
bugPage
*
uiBugPage
)
error
{
data
,
err
:=
json
.
MarshalIndent
(
GetExtAPIDescrForBugPage
(
bugPage
),
""
,
"
\t
"
)
func
writeJSONVersionOf
(
writer
http
.
ResponseWriter
,
page
interface
{})
error
{
data
,
err
:=
GetJSONDescrFor
(
page
)
if
err
!=
nil
{
return
err
}
...
...
dashboard/app/public_json_api.go
浏览文件 @
f1f9726a
...
...
@@ -3,17 +3,19 @@
package
main
import
"encoding/json"
// publicApiBugDescription is used to serve the /bug HTTP requests
// and provide JSON description of the BUG. Backward compatible.
type
P
ublicAPIBugDescription
struct
{
type
p
ublicAPIBugDescription
struct
{
Version
int
`json:"version"`
Title
string
`json:"title,omitempty"`
// links to the discussions
Discussions
[]
string
`json:"discussions,omitempty"`
Crashes
[]
P
ublicAPICrashDescription
`json:"crashes,omitempty"`
Crashes
[]
p
ublicAPICrashDescription
`json:"crashes,omitempty"`
}
type
P
ublicAPICrashDescription
struct
{
type
p
ublicAPICrashDescription
struct
{
SyzReproducer
string
`json:"syz-reproducer,omitempty"`
CReproducer
string
`json:"c-reproducer,omitempty"`
KernelConfig
string
`json:"kernel-config,omitempty"`
...
...
@@ -25,9 +27,9 @@ type PublicAPICrashDescription struct {
Architecture
string
`json:"architecture,omitempty"`
}
func
GetExtAPIDescrForBugPage
(
bugPage
*
uiBugPage
)
*
P
ublicAPIBugDescription
{
func
getExtAPIDescrForBugPage
(
bugPage
*
uiBugPage
)
*
p
ublicAPIBugDescription
{
crash
:=
bugPage
.
Crashes
.
Crashes
[
0
]
return
&
P
ublicAPIBugDescription
{
return
&
p
ublicAPIBugDescription
{
Version
:
1
,
Title
:
bugPage
.
Bug
.
Title
,
Discussions
:
func
()
[]
string
{
...
...
@@ -36,7 +38,7 @@ func GetExtAPIDescrForBugPage(bugPage *uiBugPage) *PublicAPIBugDescription {
}
return
[]
string
{
bugPage
.
Bug
.
ExternalLink
}
}(),
Crashes
:
[]
P
ublicAPICrashDescription
{{
Crashes
:
[]
p
ublicAPICrashDescription
{{
SyzReproducer
:
crash
.
ReproSyzLink
,
CReproducer
:
crash
.
ReproCLink
,
KernelConfig
:
crash
.
KernelConfigLink
,
...
...
@@ -49,3 +51,14 @@ func GetExtAPIDescrForBugPage(bugPage *uiBugPage) *PublicAPIBugDescription {
}},
}
}
func
GetJSONDescrFor
(
page
interface
{})
([]
byte
,
error
)
{
var
res
interface
{}
switch
i
:=
page
.
(
type
)
{
case
*
uiBugPage
:
res
=
getExtAPIDescrForBugPage
(
i
)
default
:
return
nil
,
ErrClientNotFound
}
return
json
.
MarshalIndent
(
res
,
""
,
"
\t
"
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录