目录
# 外置FDP配置更新器(Python版本)
经过测试可以使用(请使用python3.8.10进行运行)
使用了HTTP BASIC验证来进行验证防护,当然了还有HWID验证和时间戳验证和私有浏览器UA验证和完整性验证和内存解压什么的,但是都太复杂了呜呜呜
点下我呀
|  |  | 
# 服务端是什么
CloudFlare Worker的反代脚本
点下我呀
|  |  | 
# Go语言版本
Golang1.20.7
点下我呀
  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
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package main
import (
	"io"
	"net/http"
	"os"
	"path/filepath"
	"strings"
	"time"
	"github.com/andlabs/ui"
)
var (
	mainwin *ui.Window
)
func setupUI() {
	mainwin = ui.NewWindow("FDP配置文件在线更新", 300, 150, false)
	mainwin.OnClosing(func(*ui.Window) bool {
		ui.Quit()
		return true
	})
	ui.OnShouldQuit(func() bool {
		mainwin.Destroy()
		return true
	})
	vbox := ui.NewVerticalBox()
	vbox.SetPadded(true)
	hbox := ui.NewHorizontalBox()
	hbox.SetPadded(true)
	vbox.Append(hbox, false)
	welcomeLabel := ui.NewLabel("欢迎使用OVO")
	hbox.Append(welcomeLabel, false)
	updateLabel := ui.NewLabel("开始更新FDP配置")
	vbox.Append(updateLabel, false)
	button := ui.NewButton("更新配置文件")
	button.OnClicked(func(*ui.Button) {
		downloadConfirmation()
	})
	vbox.Append(button, false)
	mainwin.SetChild(vbox)
	mainwin.SetMargined(true)
}
func downloadConfirmation() {
	window := ui.NewWindow("确认下载", 100, 50, false)
	box := ui.NewVerticalBox()
	box.SetPadded(true)
	box.Append(ui.NewLabel("确定要更新配置文件吗,可能会覆盖你的配置文件"), false)
	hbox := ui.NewHorizontalBox()
	hbox.SetPadded(true)
	box.Append(hbox, false)
	buttonYes := ui.NewButton("Yes")
	buttonYes.OnClicked(func(*ui.Button) {
		window.Destroy()
		configsDir := filepath.Join(".minecraft", "versions", "FDP", "FDPCLIENT-1.8", "configs")
		files, _ := os.ReadDir(configsDir)
		for _, file := range files {
			if strings.HasSuffix(file.Name(), ".json") {
				os.Remove(filepath.Join(configsDir, file.Name()))
			}
		}
		downloadAllJSONs("https://tr7mur567m8r6573n67.xpdbk.com/fite.txt")
	})
	hbox.Append(buttonYes, true)
	buttonNo := ui.NewButton("No")
	buttonNo.OnClicked(func(*ui.Button) {
		window.Destroy()
	})
	hbox.Append(buttonNo, true)
	window.SetChild(box)
	window.Show()
}
func downloadAllJSONs(url string) {
	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		panic(err)
	}
	jsonURLs := strings.Split(string(body), "\n")
	for _, jsonURL := range jsonURLs {
		jsonURL = strings.TrimSpace(jsonURL)
		if strings.HasSuffix(jsonURL, ".json") {
			jsonFilename := filepath.Base(jsonURL)
			savePath := filepath.Join(".minecraft", "versions", "FDP", "FDPCLIENT-1.8", "configs", jsonFilename)
			downloadJSON(jsonURL, savePath)
		}
	}
	time.AfterFunc(100*time.Second, func() { os.Exit(0) })
}
func downloadJSON(url string, savePath string) {
	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	outFile, err := os.Create(savePath)
	if err != nil {
		panic(err)
	}
	defer outFile.Close()
	io.Copy(outFile, resp.Body)
}
func main() {
	ui.Main(setupUI)
}