-
Notifications
You must be signed in to change notification settings - Fork 51
/
pjsk.go
32 lines (28 loc) · 811 Bytes
/
pjsk.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package mediaunlocktest
import (
"context"
"net/http"
"time"
)
// Project Sekai: Colorful Stage
func PJSK(c http.Client) Result {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
req, err := http.NewRequestWithContext(ctx, "GET", "https://game-version.sekai.colorfulpalette.org/1.8.1/3ed70b6a-8352-4532-b819-108837926ff5", nil)
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
req.Header.Set("User-Agent", "pjsekai/48 CFNetwork/1240.0.4 Darwin/20.6.0")
resp, err := cdo(c, req)
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
switch resp.StatusCode {
case 200:
return Result{Status: StatusOK}
case 403:
return Result{Status: StatusNo}
}
return Result{Status: StatusUnexpected}
}