mirror of
https://github.com/imgfloat/server.git
synced 2026-02-05 03:39:26 +00:00
Add listing
This commit is contained in:
@@ -62,13 +62,18 @@ function draw() {
|
||||
}
|
||||
|
||||
function uploadAsset() {
|
||||
const url = document.getElementById('asset-url').value;
|
||||
const width = parseFloat(document.getElementById('asset-width').value);
|
||||
const height = parseFloat(document.getElementById('asset-height').value);
|
||||
const fileInput = document.getElementById('asset-file');
|
||||
if (!fileInput || !fileInput.files || fileInput.files.length === 0) {
|
||||
alert('Please choose an image to upload.');
|
||||
return;
|
||||
}
|
||||
const data = new FormData();
|
||||
data.append('file', fileInput.files[0]);
|
||||
fetch(`/api/channels/${broadcaster}/assets`, {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({url, width, height})
|
||||
body: data
|
||||
}).then(() => {
|
||||
fileInput.value = '';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user