refactor: remove tjaf dependency; add local TJA parser
This commit is contained in:
25
public/upload/index.html
Normal file
25
public/upload/index.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>太鼓ウェブあっぷろーだー</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="upload.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>太鼓ウェブあっぷろーだー</h1>
|
||||
|
||||
<form id="upload-form" enctype="multipart/form-data">
|
||||
<label for="file_tja">TJA ファイル:</label>
|
||||
<input type="file" name="file_tja" accept=".tja" required>
|
||||
|
||||
<label for="file_music">音楽ファイル:</label>
|
||||
<input type="file" name="file_music" accept=".ogg,.mp3,.wav" required>
|
||||
</form>
|
||||
|
||||
<button type="button" onclick="uploadFiles()">今すぐ投稿! (1分ほどかかる場合があります)</button>
|
||||
|
||||
<div id="error-view"></div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
public/upload/roboto/Roboto-Black.ttf
Normal file
BIN
public/upload/roboto/Roboto-Black.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-BlackItalic.ttf
Normal file
BIN
public/upload/roboto/Roboto-BlackItalic.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-Bold.ttf
Normal file
BIN
public/upload/roboto/Roboto-Bold.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-BoldItalic.ttf
Normal file
BIN
public/upload/roboto/Roboto-BoldItalic.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-Italic.ttf
Normal file
BIN
public/upload/roboto/Roboto-Italic.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-Light.ttf
Normal file
BIN
public/upload/roboto/Roboto-Light.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-LightItalic.ttf
Normal file
BIN
public/upload/roboto/Roboto-LightItalic.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-Medium.ttf
Normal file
BIN
public/upload/roboto/Roboto-Medium.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-MediumItalic.ttf
Normal file
BIN
public/upload/roboto/Roboto-MediumItalic.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-Regular.ttf
Normal file
BIN
public/upload/roboto/Roboto-Regular.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-Thin.ttf
Normal file
BIN
public/upload/roboto/Roboto-Thin.ttf
Normal file
Binary file not shown.
BIN
public/upload/roboto/Roboto-ThinItalic.ttf
Normal file
BIN
public/upload/roboto/Roboto-ThinItalic.ttf
Normal file
Binary file not shown.
23
public/upload/style.css
Normal file
23
public/upload/style.css
Normal file
@@ -0,0 +1,23 @@
|
||||
@font-face {
|
||||
font-family: "Roboto";
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: swap;
|
||||
src: url(roboto/Roboto-Regular.ttf) format("truetype");
|
||||
}
|
||||
|
||||
body * {
|
||||
margin: 0;
|
||||
font-family: "Roboto", sans-serif;
|
||||
white-space: pre-line;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
body > :not(:last-child) {
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
27
public/upload/upload.js
Normal file
27
public/upload/upload.js
Normal file
@@ -0,0 +1,27 @@
|
||||
function uploadFiles() {
|
||||
const form = document.querySelector("#upload-form");
|
||||
const formData = new FormData(form);
|
||||
|
||||
fetch("/api/upload", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.ok) {
|
||||
return res.json();
|
||||
} else {
|
||||
throw new Error(res.url + " で " + res.status.toString() + " が発生しました。");
|
||||
}
|
||||
})
|
||||
.then((data) => {
|
||||
if (data.success) {
|
||||
alert("おめでとう!ファイルの投稿に成功しました!");
|
||||
} else {
|
||||
throw new Error(data.error);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("エラー:", error);
|
||||
document.querySelector("#error-view").textContent = error;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user