mirror of
https://github.com/cnsilvan/UnblockNeteaseMusic.git
synced 2025-01-09 04:28:41 +08:00
fix: blocked Pop-up for Paid Songs in Playlist。
This commit is contained in:
parent
7c7769c13e
commit
b9905f0c8e
3
app.go
3
app.go
@ -5,6 +5,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"runtime/debug"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/cnsilvan/UnblockNeteaseMusic/config"
|
"github.com/cnsilvan/UnblockNeteaseMusic/config"
|
||||||
@ -23,7 +24,7 @@ func main() {
|
|||||||
//fmt.Println(version.AppVersion())
|
//fmt.Println(version.AppVersion())
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
log.Println("Recover panic : ", r)
|
log.Println("Recover panic : "+"\n"+string(debug.Stack()), r)
|
||||||
restoreHosts()
|
restoreHosts()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -320,9 +320,8 @@ func localVIP(netease *Netease) bool {
|
|||||||
expireTime += 3162240000000
|
expireTime += 3162240000000
|
||||||
info.(common.MapType)["data"].(common.MapType)["redVipLevel"] = 7
|
info.(common.MapType)["data"].(common.MapType)["redVipLevel"] = 7
|
||||||
info.(common.MapType)["data"].(common.MapType)["redVipAnnualCount"] = 1
|
info.(common.MapType)["data"].(common.MapType)["redVipAnnualCount"] = 1
|
||||||
info.(common.MapType)["data"].(common.MapType)["musicPackage"].(common.MapType)["expireTime"] = expireTime
|
info.(common.MapType)["data"].(common.MapType)["musicPackage"] = &common.MapType{"expireTime": expireTime, "vipCode": 230}
|
||||||
info.(common.MapType)["data"].(common.MapType)["musicPackage"].(common.MapType)["vipCode"] = 230
|
info.(common.MapType)["data"].(common.MapType)["associator"] = &common.MapType{"expireTime": expireTime}
|
||||||
info.(common.MapType)["data"].(common.MapType)["associator"].(common.MapType)["expireTime"] = expireTime
|
|
||||||
}
|
}
|
||||||
return modified
|
return modified
|
||||||
}
|
}
|
||||||
@ -631,24 +630,64 @@ func processSliceJson(jsonSlice common.SliceType) bool {
|
|||||||
}
|
}
|
||||||
func processMapJson(jsonMap common.MapType) bool {
|
func processMapJson(jsonMap common.MapType) bool {
|
||||||
needModify := false
|
needModify := false
|
||||||
if utils.Exists([]string{"st", "subp", "pl", "dl"}, jsonMap) {
|
if utils.Exists([]string{"st", "subp", "pl", "dl", "chargeType", "cannotListenReason", "paidBigBang", "resConsumable", "cp", "fee", "payed", "fl", "flLevel", "plLevel"}, jsonMap) {
|
||||||
if v, _ := jsonMap["st"]; v.(json.Number).String() != "0" {
|
if v, _ := jsonMap["st"]; v != nil && v.(json.Number).String() != "0" {
|
||||||
// open gray song
|
// open gray song
|
||||||
jsonMap["st"] = 0
|
jsonMap["st"] = 0
|
||||||
needModify = true
|
needModify = true
|
||||||
}
|
}
|
||||||
if v, _ := jsonMap["subp"]; v.(json.Number).String() != "1" {
|
if v, _ := jsonMap["subp"]; v != nil && v.(json.Number).String() != "1" {
|
||||||
jsonMap["subp"] = 1
|
jsonMap["subp"] = 1
|
||||||
needModify = true
|
needModify = true
|
||||||
}
|
}
|
||||||
if v, _ := jsonMap["pl"]; v.(json.Number).String() == "0" {
|
if v, _ := jsonMap["pl"]; v != nil && v.(json.Number).String() == "0" {
|
||||||
jsonMap["pl"] = 320000
|
jsonMap["pl"] = 320000
|
||||||
needModify = true
|
needModify = true
|
||||||
}
|
}
|
||||||
if v, _ := jsonMap["dl"]; v.(json.Number).String() == "0" {
|
if v, _ := jsonMap["dl"]; v != nil && v.(json.Number).String() == "0" {
|
||||||
jsonMap["dl"] = 320000
|
jsonMap["dl"] = 320000
|
||||||
needModify = true
|
needModify = true
|
||||||
}
|
}
|
||||||
|
if v, _ := jsonMap["chargeType"]; v != nil && v.(json.Number).String() == "1" {
|
||||||
|
jsonMap["chargeType"] = 0
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
|
if v, _ := jsonMap["paidBigBang"]; v != nil {
|
||||||
|
jsonMap["paidBigBang"] = true
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
|
if v, _ := jsonMap["resConsumable"]; v != nil {
|
||||||
|
jsonMap["resConsumable"] = false
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
|
if v, _ := jsonMap["cannotListenReason"]; v != nil {
|
||||||
|
jsonMap["cannotListenReason"] = nil
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
|
if v, _ := jsonMap["cp"]; v != nil && v.(json.Number).String() == "0" {
|
||||||
|
jsonMap["cp"] = 1
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
|
//if v, _ := jsonMap["fee"]; v != nil && v.(json.Number).String() == "1" {
|
||||||
|
// jsonMap["fee"] = 8
|
||||||
|
// needModify = true
|
||||||
|
//}
|
||||||
|
if v, _ := jsonMap["fl"]; v != nil && v.(json.Number).String() == "0" {
|
||||||
|
jsonMap["fl"] = 320000
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
|
if v, _ := jsonMap["flLevel"]; v != nil && v == "none" {
|
||||||
|
jsonMap["flLevel"] = "exhigh"
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
|
if v, _ := jsonMap["plLevel"]; v != nil && v == "none" {
|
||||||
|
jsonMap["plLevel"] = "exhigh"
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
|
if v, _ := jsonMap["payed"]; v != nil {
|
||||||
|
jsonMap["payed"] = 1
|
||||||
|
needModify = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, value := range jsonMap {
|
for _, value := range jsonMap {
|
||||||
switch value.(type) {
|
switch value.(type) {
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -54,7 +55,7 @@ func InitProxy() {
|
|||||||
func (h *HttpHandler) ServeHTTP(resp http.ResponseWriter, request *http.Request) {
|
func (h *HttpHandler) ServeHTTP(resp http.ResponseWriter, request *http.Request) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
log.Println("Recover panic : ", r)
|
log.Println("Recover panic : "+"\n"+string(debug.Stack()), r)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
//printMemStats()
|
//printMemStats()
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime/debug"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -86,7 +87,7 @@ func ParseJsonV4(reader io.Reader, dest interface{}) error {
|
|||||||
func PanicWrapper(f func()) {
|
func PanicWrapper(f func()) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
log.Println("Recover panic : ", r)
|
log.Println("Recover panic : "+"\n"+string(debug.Stack()), r)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
f()
|
f()
|
||||||
@ -105,11 +106,11 @@ func ToJson(object interface{}) string {
|
|||||||
}
|
}
|
||||||
func Exists(keys []string, h map[string]interface{}) bool {
|
func Exists(keys []string, h map[string]interface{}) bool {
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
if !Exist(key, h) {
|
if Exist(key, h) {
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
func Exist(key string, h map[string]interface{}) bool {
|
func Exist(key string, h map[string]interface{}) bool {
|
||||||
_, ok := h[key]
|
_, ok := h[key]
|
||||||
|
Loading…
Reference in New Issue
Block a user