feat:最终
5
.gitignore
vendored
@@ -25,4 +25,7 @@ dist-ssr
|
||||
*.zip
|
||||
Dex-v3-core.exe
|
||||
core-x86_64-pc-windows-msvc.exe
|
||||
config.json
|
||||
config.json
|
||||
*.exe
|
||||
*.jar
|
||||
instance
|
||||
@@ -22,11 +22,10 @@ export class Dex {
|
||||
this.ws = e
|
||||
})
|
||||
this.in = {}
|
||||
console.log(this.ws)
|
||||
}
|
||||
}
|
||||
|
||||
public async Main(buffer: Buffer) {
|
||||
const first = new Date().getTime()
|
||||
const first = Date.now()
|
||||
const info = await this._getinfo(buffer)
|
||||
const plat = what_platform(info)
|
||||
const mpname = this.in.name
|
||||
@@ -46,8 +45,7 @@ export class Dex {
|
||||
})); //改变状态(DeEarth筛选模组完毕)
|
||||
const mlinfo = await platform(plat).getinfo(this.in)
|
||||
await mlsetup(mlinfo.loader,mlinfo.minecraft,mlinfo.loader_version,unpath) //安装服务端
|
||||
const latest = new Date().getTime()
|
||||
console.log(latest - first)
|
||||
const latest = Date.now()
|
||||
this.ws.send(JSON.stringify({
|
||||
status: "finish",
|
||||
result: latest - first
|
||||
|
||||
@@ -40,7 +40,7 @@ export class Fabric{
|
||||
async install(){
|
||||
await execPromise(`java -jar fabric-installer.jar server -dir . -mcversion ${this.minecraft} -loader ${this.loaderVersion}`,{
|
||||
cwd:this.path
|
||||
})
|
||||
}).catch(e=>console.log(e))
|
||||
}
|
||||
|
||||
private async wshell(){
|
||||
|
||||
@@ -30,7 +30,7 @@ export function modloader(ml:string,mcv:string,mlv:string,path:string){
|
||||
|
||||
export async function mlsetup(ml:string,mcv:string,mlv:string,path:string){
|
||||
const minecraft = new Minecraft(ml,mcv,mlv,path);
|
||||
console.log(ml)
|
||||
//console.log(ml)
|
||||
await modloader(ml,mcv,mlv,path).setup()
|
||||
await minecraft.setup()
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export class Minecraft {
|
||||
const mcpath = `${this.path}/server.jar`
|
||||
await fastdownload([`https://bmclapi2.bangbang93.com/version/${this.minecraft}/server`, mcpath])
|
||||
// 依赖解压
|
||||
const zip = await yauzl_promise(await fs.promises.readFile(mcpath))
|
||||
/*const zip = await yauzl_promise(await fs.promises.readFile(mcpath))
|
||||
for await (const entry of zip) {
|
||||
// if (entry.fileName.startsWith("META-INF/libraries/") && entry.fileName.endsWith("/") &&entry.fileName !== "META-INF/libraries/") {
|
||||
// fs.promises.mkdir(`${this.path}/libraries/${entry.fileName.replace("META-INF/libraries/", "")}`,{
|
||||
@@ -105,16 +105,12 @@ export class Minecraft {
|
||||
const out = entry.ReadEntrySync
|
||||
await fsExtra.outputFile(`${this.path}/libraries/${entry.fileName.replace("META-INF/libraries/", "")}`,out)
|
||||
}
|
||||
}
|
||||
}*/
|
||||
// 依赖解压
|
||||
}
|
||||
|
||||
async eula(){
|
||||
const context = `
|
||||
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
|
||||
#Spawn by DeEarthX(QQgroup:559349662) Tianpao:(https://space.bilibili.com/1728953419)
|
||||
eula=true
|
||||
`
|
||||
const context = `#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).\n#Spawn by DeEarthX(QQgroup:559349662) Tianpao:(https://space.bilibili.com/1728953419)\neula=true`
|
||||
await fs.promises.writeFile(`${this.path}/eula.txt`,context)
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import got from "got"
|
||||
import { Utils } from "./utils.js"
|
||||
import pa from "node:path"
|
||||
import WebSocket from "ws"
|
||||
import config from "./config.js"
|
||||
interface IMixins{
|
||||
name: string
|
||||
data: string
|
||||
@@ -43,10 +44,19 @@ export class DeEarth{
|
||||
fs.mkdirSync(this.movepath,{recursive:true})
|
||||
}
|
||||
await this.getFile()
|
||||
const hash = await this.Check_Hashes()
|
||||
const mixins = await this.Check_Mixins()
|
||||
let hash;
|
||||
let mixins;
|
||||
if (config.filter.hashes){ //Hash
|
||||
hash = await this.Check_Hashes()
|
||||
}
|
||||
if (config.filter.mixins){ //Mixins
|
||||
mixins = await this.Check_Mixins()
|
||||
}
|
||||
if(!hash||mixins){
|
||||
return;
|
||||
}
|
||||
const result = [...new Set(hash.concat(mixins))]
|
||||
console.log(result)
|
||||
//console.log(result)
|
||||
result.forEach(async e=>{
|
||||
await fs.promises.rename(`${e}`,`${this.movepath}/${e}`.replace(this.modspath,""))
|
||||
//await fs.promises.rename(`${this.modspath}/${e}`,`${this.movepath}/${e}`)
|
||||
@@ -57,7 +67,7 @@ export class DeEarth{
|
||||
const cmap = new Map<string,string>()
|
||||
const fmap = new Map<string,string>()
|
||||
const hashes:string[] = []
|
||||
const files = this.file.forEach(e=>{
|
||||
this.file.forEach(e=>{
|
||||
hashes.push(e.hash);
|
||||
cmap.set(e.hash,e.filename)
|
||||
})
|
||||
|
||||
7
backend/src/utils/debugger.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
class Debugger{
|
||||
static log(msg: any){
|
||||
if (process.env.DEBUG){
|
||||
console.log(msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,8 @@ export async function fastdownload(data: [string, string]) {
|
||||
return 0;
|
||||
}
|
||||
})();*/
|
||||
console.log(e)
|
||||
|
||||
//console.log(e)
|
||||
await got
|
||||
.get(e[0], {
|
||||
responseType: "buffer",
|
||||
@@ -172,7 +173,7 @@ export async function xfastdownload(data: [string, string][]) {
|
||||
return 0;
|
||||
}
|
||||
})();*/
|
||||
console.log(e)
|
||||
//console.log(e)
|
||||
await got
|
||||
.get(e[0], {
|
||||
responseType: "buffer",
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
"shell:default",
|
||||
"shell:allow-execute",
|
||||
"shell:allow-spawn",
|
||||
"shell:allow-kill",
|
||||
"shell:allow-open",
|
||||
{
|
||||
"identifier": "shell:allow-execute",
|
||||
"identifier": "shell:allow-spawn",
|
||||
"allow": [
|
||||
{
|
||||
"name": "core",
|
||||
|
||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
front/src-tauri/icons/128x128.png1
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
front/src-tauri/icons/128x128@2x.png1
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 974 B After Width: | Height: | Size: 2.6 KiB |
BIN
front/src-tauri/icons/32x32.png1
Normal file
|
After Width: | Height: | Size: 974 B |
BIN
front/src-tauri/icons/icon.icns1
Normal file
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 66 KiB |
BIN
front/src-tauri/icons/icon.ico1
Normal file
|
After Width: | Height: | Size: 85 KiB |
@@ -1,3 +1,5 @@
|
||||
use tauri::Manager;
|
||||
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
#[tauri::command]
|
||||
fn greet(name: &str) -> String {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "dex-v3-ui",
|
||||
"productName": "DeEarthX-V3",
|
||||
"version": "0.1.0",
|
||||
"identifier": "top.tianpao.dex-v3-ui",
|
||||
"build": {
|
||||
@@ -15,7 +15,10 @@
|
||||
"title": "DeEarthX V3",
|
||||
"width": 1280,
|
||||
"height": 720,
|
||||
"dragDropEnabled": false
|
||||
"dragDropEnabled": false,
|
||||
"fullscreen": false,
|
||||
"resizable": false,
|
||||
"center": true
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
@@ -32,6 +35,19 @@
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"externalBin": ["binaries/core"]
|
||||
"externalBin": ["binaries/core"],
|
||||
"windows": {
|
||||
"webviewInstallMode": {
|
||||
"type": "downloadBootstrapper"
|
||||
},
|
||||
"nsis": {
|
||||
"languages": ["SimpChinese","English"],
|
||||
"displayLanguageSelector": true,
|
||||
"installMode": "perMachine"
|
||||
},
|
||||
"wix": {
|
||||
"language": "zh-CN"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,43 @@
|
||||
<script lang="ts" setup>
|
||||
import { h, ref } from 'vue';
|
||||
import { MenuProps } from 'ant-design-vue';
|
||||
import { MenuProps, message } from 'ant-design-vue';
|
||||
import { SettingOutlined, UserOutlined, WindowsOutlined } from '@ant-design/icons-vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import * as shell from '@tauri-apps/plugin-shell';
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
async function contant(){
|
||||
await invoke("open_url",{url:"https://space.bilibili.com/1728953419"})
|
||||
}
|
||||
|
||||
//屏蔽右键菜单
|
||||
document.oncontextmenu = function (event: any) {
|
||||
try {
|
||||
var the = event.srcElement
|
||||
if (
|
||||
!(
|
||||
(the.tagName == 'INPUT' && the.type.toLowerCase() == 'text') ||
|
||||
the.tagName == 'TEXTAREA'
|
||||
)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/* 启动后端 */
|
||||
message.loading("DeEarthX.Core启动中,此过程中请勿执行任何操作......").then(()=>{
|
||||
shell.Command.create("core").spawn().then(()=>{
|
||||
message.success("DeEarthX.Core 启动成功")
|
||||
console.log(`DeEarthX V3 Core`)
|
||||
}).catch((e)=>{
|
||||
console.log(e)
|
||||
message.error("DeEarthX.Core 启动失败,请检查37019是否被占用!")
|
||||
})
|
||||
})
|
||||
const router = useRouter();
|
||||
const selectedKeys = ref(['main']);
|
||||
const items: MenuProps['items'] = [
|
||||
@@ -49,7 +83,14 @@ const handleClick: MenuProps['onClick'] = (e) => {
|
||||
<template>
|
||||
<div class="tw:h-screen tw:w-screen">
|
||||
<a-page-header class="tw:fixed tw:h-16" style="border: 1px solid rgb(235, 237, 240)" title="DeEarthX"
|
||||
sub-title="V3" />
|
||||
sub-title="V3"
|
||||
:avatar="{ src: '../assets/tianpao.jpg' }"
|
||||
>
|
||||
<template #extra>
|
||||
<a-button @click="contant">作者B站</a-button>
|
||||
</template>
|
||||
|
||||
</a-page-header>
|
||||
<div class="tw:flex tw:full tw:h-89/100">
|
||||
<a-menu id="menu" style="width: 144px;" :selectedKeys="selectedKeys" mode="inline" :items="items" @click="handleClick"/>
|
||||
<RouterView />
|
||||
@@ -58,4 +99,40 @@ const handleClick: MenuProps['onClick'] = (e) => {
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped></style>
|
||||
<style>
|
||||
/* 禁止选择文本的样式 */
|
||||
h1 {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
li {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
p {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
span {
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select:none;
|
||||
}
|
||||
|
||||
/* 禁止拖拽图片 */
|
||||
img {
|
||||
-webkit-user-drag: none;
|
||||
-moz-user-drag: none;
|
||||
-ms-user-drag: none;
|
||||
}
|
||||
</style>
|
||||
BIN
front/src/assets/tianpao.jpg
Normal file
|
After Width: | Height: | Size: 45 KiB |
@@ -15,12 +15,18 @@ async function contant(idc:string){
|
||||
|
||||
<template>
|
||||
<div class="tw:h-full tw:w-full">
|
||||
<div class="w-full h-64"> <!-- 广告位 -->
|
||||
<div class="tw:w-full tw:h-64"> <!-- 广告位 -->
|
||||
<h1 class="tw:text-2xl tw:text-center tw:bg-gradient-to-r tw:from-emerald-500 tw:to-cyan-500 tw:bg-clip-text tw:text-transparent">赞助商广告位</h1>
|
||||
<div class="tw:flex tw:flex-col tw:w-30 tw:h-30 tw:ml-5 tw:mt-2" @click="contant('elfidc')"> <!-- 亿讯云 -->
|
||||
<img class="tw:w-24 tw:h-24" src="../assets/elfidc.svg"></img>
|
||||
<h1 class="tw:text-sm tw:text-center tw:text-yellow-400">亿讯云(金牌赞助)</h1>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="tw:w-full tw:h-64 flex">
|
||||
<div class="tw:flex tw:flex-col tw:w-30 tw:h-30 tw:ml-5 tw:mt-2">
|
||||
<a-avatar src="../assets/tianpao.jpg" :size="48" style="background-color: #1e90ff"/>
|
||||
<h1 class="tw:text-sm tw:text-center tw:text-yellow-400">天泡</h1>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,19 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, ref, VNodeRef } from 'vue';
|
||||
import { ref } from 'vue';
|
||||
import { InboxOutlined } from '@ant-design/icons-vue';
|
||||
import { message, StepsProps } from 'ant-design-vue';
|
||||
import type { UploadFile, UploadChangeParam, Upload } from 'ant-design-vue';
|
||||
import {
|
||||
isPermissionGranted,
|
||||
requestPermission,
|
||||
sendNotification,
|
||||
} from '@tauri-apps/plugin-notification';
|
||||
import type { UploadFile, UploadChangeParam } from 'ant-design-vue';
|
||||
import {sendNotification,} from '@tauri-apps/plugin-notification';
|
||||
interface IWSM {
|
||||
status: "unzip"|"finish"|"changed"|"downloading",
|
||||
result: any
|
||||
}
|
||||
/* 进度显示区 */
|
||||
const disp_steps = ref(true);
|
||||
const disp_steps = ref(false);
|
||||
const setyps_current = ref(0);
|
||||
const setps_items: StepsProps['items'] = [{
|
||||
title: '解压整合包',
|
||||
@@ -59,17 +55,20 @@ function handleUpload() {
|
||||
}
|
||||
runDeEarthX(FileList.value[0].originFileObj) //获取文件内容
|
||||
BtnisDisabled.value = true; //禁用按钮
|
||||
isDisabled.value = true; //禁用上传
|
||||
disp_steps.value = true; //开始显示进度条
|
||||
}
|
||||
|
||||
function reactFL() {
|
||||
FileList.value = [];
|
||||
isDisabled.value = false;
|
||||
BtnisDisabled.value = false;
|
||||
disp_steps.value = false; //关闭进度条
|
||||
}
|
||||
/* 获取文件区 */
|
||||
//shell.Command.create('core',['start']).spawn()
|
||||
function runDeEarthX(data: Blob) {
|
||||
//console.log(data)
|
||||
message.success("开始制作,请勿切换菜单!");
|
||||
const fd = new FormData();
|
||||
fd.append('file', data);
|
||||
console.log(fd.getAll('file'))
|
||||
@@ -79,10 +78,6 @@ function runDeEarthX(data: Blob) {
|
||||
}).then(async res=>res.json()).then(()=>{
|
||||
prews()
|
||||
})
|
||||
// shell.Command.create('core',['start',new BigUint64Array(data).toString()]).stdout.on('data',(data)=>{
|
||||
// console.log(data)
|
||||
// })
|
||||
reactFL()
|
||||
}
|
||||
const prog = ref({status:"active",percent:0,display:true})
|
||||
const dprog = ref({status:"active",percent:0,display:true})
|
||||
@@ -120,22 +115,17 @@ function prews(){
|
||||
}
|
||||
}
|
||||
if (_data.status === "finish"){
|
||||
const time = Math.round(_data.result / 1000 / 1000)
|
||||
console.log(_data.result)
|
||||
const time = Math.round(_data.result / 1000)
|
||||
setyps_current.value ++;
|
||||
message.success(`服务端制作完成!共用时${time}秒!`)
|
||||
sendNotification({ title: 'DeEarthX V3', body: `服务端制作完成!共用时${time}秒!` });
|
||||
setTimeout(()=>{ //恢复状态
|
||||
reactFL()
|
||||
},8*1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/* 日志区 */
|
||||
const logs = ref<{message:string}[]>([]);
|
||||
//logs.value.push({message:"114514"})
|
||||
const logContainer = ref<HTMLDivElement>();
|
||||
nextTick(()=>{
|
||||
if(logContainer.value){
|
||||
logContainer.value.scrollTop = logContainer.value.scrollHeight;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<div class="tw:h-full tw:w-full tw:relative">
|
||||
|
||||