feat(modpack): added curseforge importer
This commit is contained in:
@@ -5,6 +5,15 @@
|
|||||||
<div class="import-section">
|
<div class="import-section">
|
||||||
<h2>Импорт нового модпака</h2>
|
<h2>Импорт нового модпака</h2>
|
||||||
<form @submit.prevent="handleImport" class="import-form">
|
<form @submit.prevent="handleImport" class="import-form">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Тип сборки</label>
|
||||||
|
<select v-model="form.importerType">
|
||||||
|
<option value="simple">Простой ZIP</option>
|
||||||
|
<option value="curseforge">CurseForge</option>
|
||||||
|
<option value="modrinth" disabled>Modrinth (в разработке)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="name">Системное имя (латиница, без пробелов)</label>
|
<label for="name">Системное имя (латиница, без пробелов)</label>
|
||||||
<input id="name" v-model="form.name" type="text" required pattern="^[a-zA-Z0-9_]+$" />
|
<input id="name" v-model="form.name" type="text" required pattern="^[a-zA-Z0-9_]+$" />
|
||||||
@@ -45,6 +54,7 @@ const form = reactive({
|
|||||||
displayName: "",
|
displayName: "",
|
||||||
mcVersion: "",
|
mcVersion: "",
|
||||||
file: null as File | null,
|
file: null as File | null,
|
||||||
|
importerType: "simple", // Тип импортера по умолчанию
|
||||||
});
|
});
|
||||||
|
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
@@ -73,6 +83,8 @@ const handleImport = async () => {
|
|||||||
formData.append("displayName", form.displayName);
|
formData.append("displayName", form.displayName);
|
||||||
formData.append("mcVersion", form.mcVersion);
|
formData.append("mcVersion", form.mcVersion);
|
||||||
formData.append("file", form.file);
|
formData.append("file", form.file);
|
||||||
|
formData.append("importerType", form.importerType);
|
||||||
|
formData.append("importMethod", "file"); // Пока поддерживаем только импорт файла
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await apiClient.post("/admin/modpacks/import", formData, {
|
const response = await apiClient.post("/admin/modpacks/import", formData, {
|
||||||
@@ -97,22 +109,19 @@ const handleImport = async () => {
|
|||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.import-form .form-group {
|
.import-form .form-group {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.import-form label {
|
.import-form label {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
.import-form input,
|
||||||
.import-form input {
|
.import-form select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-message,
|
.error-message,
|
||||||
.success-message {
|
.success-message {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
@@ -120,19 +129,16 @@ const handleImport = async () => {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error-message {
|
.error-message {
|
||||||
background-color: #f8d7da;
|
background-color: #f8d7da;
|
||||||
color: #721c24;
|
color: #721c24;
|
||||||
border: 1px solid #f5c6cb;
|
border: 1px solid #f5c6cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.success-message {
|
.success-message {
|
||||||
background-color: #d4edda;
|
background-color: #d4edda;
|
||||||
color: #155724;
|
color: #155724;
|
||||||
border: 1px solid #c3e6cb;
|
border: 1px solid #c3e6cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
padding: 0.75rem 1.5rem;
|
padding: 0.75rem 1.5rem;
|
||||||
background-color: #42b983;
|
background-color: #42b983;
|
||||||
@@ -141,7 +147,6 @@ button {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
button:disabled {
|
button:disabled {
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
}
|
}
|
||||||
|
|||||||
2
vite.config.d.ts
vendored
Normal file
2
vite.config.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
declare const _default: import("vite").UserConfig;
|
||||||
|
export default _default;
|
||||||
20
vite.config.js
Normal file
20
vite.config.js
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { defineConfig } from "vite";
|
||||||
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import { URL, fileURLToPath } from "node:url";
|
||||||
|
// https://vitejs.dev/config/
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [vue()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
proxy: {
|
||||||
|
"^/api|/authserver|/sessionserver": {
|
||||||
|
target: "http://localhost:8080",
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user