Skip to content

Commit 3518d30

Browse files
committed
all: change apis under gossa
1 parent eaa4f1c commit 3518d30

File tree

5 files changed

+10
-37
lines changed

5 files changed

+10
-37
lines changed

public/dark.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

public/index.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
<input type="text" value="" placeholder="e.g. -N -l" id="gcflags">
2424
</div>
2525
<div id="aboutControls">
26-
<!-- doesn't work for iframe -->
27-
<!-- <label class="switch">
28-
<input id="dark-mode-checkbox" type="checkbox">
29-
<span class="slider"></span>
30-
</label> -->
3126
<input type="button" value="About" id="aboutbtn">
3227
</div>
3328
</div>
@@ -57,7 +52,5 @@
5752
</div>
5853
</div>
5954
<script src="/gossa/main.js"></script>
60-
<!-- <script src="/gossa/magic.js"></script>
61-
<script src="/gossa/dark.js"></script> -->
6255
</body>
6356
</html>

public/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// by a GPLv3 license that can be found in the LICENSE file.
44

55
function ping() {
6-
fetch('/api/v1/ping').then(res => res.json()).then(data => {
6+
fetch('/gossa/api/v1/ping').then(res => res.json()).then(data => {
77
document.getElementById('version').innerText = data.go_version;
88
});
99
}
@@ -40,7 +40,7 @@ function build() {
4040
lastGcflags = gcflags
4141
setMessageBox('Waiting for response...', false)
4242

43-
fetch('/api/v1/buildssa', {
43+
fetch('/gossa/api/v1/buildssa', {
4444
method: 'POST',
4545
headers: {'Content-Type': 'application/json'},
4646
body: JSON.stringify({

src/route/api.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@ func Pong(c *gin.Context) {
4040
})
4141
}
4242

43+
// BuildSSAInput ...
4344
type BuildSSAInput struct {
4445
FuncName string `json:"funcname"`
4546
GcFlags string `json:"gcflags"`
4647
Code string `json:"code"`
4748
}
49+
50+
// BuildSSAOutput ...
4851
type BuildSSAOutput struct {
4952
BuildID string `json:"build_id"`
5053
Msg string `json:"msg"`

src/route/router.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,27 @@ func Register() *gin.Engine {
2727
return r.Engine
2828
}
2929

30+
// Router ...
3031
type Router struct {
3132
Engine *gin.Engine
3233
}
3334

35+
// SetupAPI ...
3436
func (r *Router) SetupAPI() {
35-
v1 := r.Engine.Group("/api/v1")
37+
v1 := r.Engine.Group("/gossa/api/v1")
3638
{
3739
v1.GET("/ping", Pong)
3840
v1.POST("/buildssa", BuildSSA)
3941
}
4042
}
4143

44+
// SetupApp ...
4245
func (r *Router) SetupApp() {
4346
r.Engine.Use(static("/gossa"))
4447
logrus.Infof("GoSSAWeb is on: http://%s, static: %s", config.Get().Addr, config.Get().Static)
4548
}
4649

47-
// profile the standard HandlerFuncs from the net/http/pprof package with
50+
// SetupProfile profiles the standard HandlerFuncs from the net/http/pprof package with
4851
// the provided gin.Engine. prefixOptions is a optional. If not prefixOptions,
4952
// the default path prefix is used, otherwise first prefixOptions will be path prefix.
5053
//

0 commit comments

Comments
 (0)