feat(modpack): added curseforge importer
This commit is contained in:
@@ -5,6 +5,15 @@
|
||||
<div class="import-section">
|
||||
<h2>Импорт нового модпака</h2>
|
||||
<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">
|
||||
<label for="name">Системное имя (латиница, без пробелов)</label>
|
||||
<input id="name" v-model="form.name" type="text" required pattern="^[a-zA-Z0-9_]+$" />
|
||||
@@ -45,6 +54,7 @@ const form = reactive({
|
||||
displayName: "",
|
||||
mcVersion: "",
|
||||
file: null as File | null,
|
||||
importerType: "simple", // Тип импортера по умолчанию
|
||||
});
|
||||
|
||||
const isLoading = ref(false);
|
||||
@@ -73,6 +83,8 @@ const handleImport = async () => {
|
||||
formData.append("displayName", form.displayName);
|
||||
formData.append("mcVersion", form.mcVersion);
|
||||
formData.append("file", form.file);
|
||||
formData.append("importerType", form.importerType);
|
||||
formData.append("importMethod", "file"); // Пока поддерживаем только импорт файла
|
||||
|
||||
try {
|
||||
const response = await apiClient.post("/admin/modpacks/import", formData, {
|
||||
@@ -97,22 +109,19 @@ const handleImport = async () => {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.import-form .form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.import-form label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.import-form input {
|
||||
.import-form input,
|
||||
.import-form select {
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.error-message,
|
||||
.success-message {
|
||||
margin-top: 1rem;
|
||||
@@ -120,19 +129,16 @@ const handleImport = async () => {
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
background-color: #f8d7da;
|
||||
color: #721c24;
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
|
||||
.success-message {
|
||||
background-color: #d4edda;
|
||||
color: #155724;
|
||||
border: 1px solid #c3e6cb;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 0.75rem 1.5rem;
|
||||
background-color: #42b983;
|
||||
@@ -141,7 +147,6 @@ button {
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
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