Added modifications
This commit is contained in:
@@ -728,6 +728,7 @@ def qb_torrents():
|
||||
"dlspeed": torrent.dlspeed,
|
||||
"upspeed": torrent.upspeed,
|
||||
"eta": torrent.eta,
|
||||
"save_path": torrent.save_path
|
||||
})
|
||||
return jsonify(torrents)
|
||||
except Exception as e:
|
||||
@@ -753,6 +754,10 @@ def qb_action():
|
||||
client.torrents_resume(torrent_hashes=hashes)
|
||||
elif action == 'delete':
|
||||
client.torrents_delete(delete_files=True, torrent_hashes=hashes)
|
||||
elif action == 'force_resume':
|
||||
client.torrents_force_resume(torrent_hashes=hashes)
|
||||
elif action == 'recheck':
|
||||
client.torrents_recheck(torrent_hashes=hashes)
|
||||
else:
|
||||
return jsonify({"error": "Invalid action."}), 400
|
||||
|
||||
@@ -760,5 +765,72 @@ def qb_action():
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
@app.route('/api/create_folder', methods=['POST'])
|
||||
def create_folder():
|
||||
data = request.get_json()
|
||||
path = data.get('path')
|
||||
folder_name = data.get('folder_name')
|
||||
|
||||
if not path or not folder_name:
|
||||
return jsonify({"error": "Path and folder name are required"}), 400
|
||||
|
||||
try:
|
||||
creds = get_smb_credentials(path)
|
||||
# Security check: Ensure destination is within the main VIDEO_PATH
|
||||
common_path = os.path.commonpath([os.path.normpath(VIDEO_PATH), os.path.normpath(path)])
|
||||
if common_path != os.path.normpath(VIDEO_PATH):
|
||||
raise ValueError("Creation path is outside the allowed base directory.")
|
||||
|
||||
new_folder_path = os.path.join(path, folder_name)
|
||||
smbclient.makedirs(new_folder_path, exist_ok=False, **creds)
|
||||
return jsonify({"success": True})
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
@app.route('/api/move_file', methods=['POST'])
|
||||
def move_file():
|
||||
data = request.get_json()
|
||||
source_path = data.get('source_path')
|
||||
dest_path = data.get('dest_path')
|
||||
|
||||
if not source_path or not dest_path:
|
||||
return jsonify({"error": "Source and destination paths are required"}), 400
|
||||
|
||||
try:
|
||||
creds = get_smb_credentials(source_path)
|
||||
# Ensure the destination directory exists
|
||||
if not smbclient.exists(dest_path, **creds):
|
||||
smbclient.makedirs(dest_path, exist_ok=True, **creds)
|
||||
|
||||
# Construct the full destination path including the filename
|
||||
filename = os.path.basename(source_path)
|
||||
full_dest_path = os.path.join(dest_path, filename)
|
||||
|
||||
smbclient.rename(source_path, full_dest_path, **creds)
|
||||
return jsonify({"success": True})
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
@app.route('/api/qb_set_location', methods=['POST'])
|
||||
def qb_set_location():
|
||||
try:
|
||||
client = get_qb_client()
|
||||
if not client:
|
||||
return jsonify({"error": "qBittorrent not configured."}), 400
|
||||
|
||||
data = request.get_json()
|
||||
hashes = data.get('hashes')
|
||||
location = data.get('location')
|
||||
|
||||
if not hashes or not location:
|
||||
return jsonify({"error": "Missing hashes or location."}), 400
|
||||
|
||||
client.torrents_set_location(torrent_hashes=hashes, location=location)
|
||||
return jsonify({"success": True})
|
||||
except Exception as e:
|
||||
return jsonify({"error": str(e)}), 500
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, port=5000, host='0.0.0.0')
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
scene_id,path,basename,path_id
|
||||
|
Binary file not shown.
@@ -0,0 +1 @@
|
||||
id,path
|
||||
|
@@ -2,4 +2,5 @@ flask[async]
|
||||
smbprotocol
|
||||
qbittorrent-api
|
||||
requests
|
||||
beautifulsoup4
|
||||
beautifulsoup4
|
||||
pandas
|
||||
@@ -0,0 +1 @@
|
||||
id,oshash
|
||||
|
@@ -134,8 +134,6 @@
|
||||
<p class="lead text-white-50">Your friendly neighborhood media manager</p>
|
||||
</header>
|
||||
|
||||
<div id="messages" class="mb-4"></div>
|
||||
|
||||
<div class="accordion" id="mainAccordion">
|
||||
|
||||
<div class="accordion-item">
|
||||
@@ -348,31 +346,31 @@
|
||||
|
||||
<div class="accordion-item">
|
||||
|
||||
<h2 class="accordion-header" id="headingQBittorrent">
|
||||
<h2 class="accordion-header" id="headingQBittorrent">
|
||||
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseQBittorrent" aria-expanded="false" aria-controls="collapseQBittorrent">
|
||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseQBittorrent" aria-expanded="false" aria-controls="collapseQBittorrent">
|
||||
|
||||
qBittorrent
|
||||
qBittorrent
|
||||
|
||||
</button>
|
||||
</button>
|
||||
|
||||
</h2>
|
||||
</h2>
|
||||
|
||||
<div id="collapseQBittorrent" class="accordion-collapse collapse" aria-labelledby="headingQBittorrent" data-bs-parent="#mainAccordion">
|
||||
<div id="collapseQBittorrent" class="accordion-collapse collapse" aria-labelledby="headingQBittorrent" data-bs-parent="#mainAccordion">
|
||||
|
||||
<div class="accordion-body">
|
||||
<div class="accordion-body">
|
||||
|
||||
<div class="card p-4">
|
||||
<div class="card p-4">
|
||||
|
||||
<h2 class="card-title h4 mb-4"></h2>
|
||||
<h2 class="card-title h4 mb-4"></h2>
|
||||
|
||||
<div id="qb-torrents" class="mt-4 table-responsive"></div>
|
||||
<div id="qb-torrents" class="mt-2 table-responsive"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -448,7 +446,7 @@
|
||||
|
||||
<label for="coomer-url" class="form-label">Artist URL</label>
|
||||
|
||||
<input type="url" class="form-control" id="coomer-url" placeholder="https://coomer.su/onlyfans/user/artistname">
|
||||
<input type="url" class="form-control" id="coomer-url" placeholder="https://coomer.st/onlyfans/user/artistname">
|
||||
|
||||
</div>
|
||||
|
||||
@@ -594,25 +592,29 @@
|
||||
|
||||
<div class="card p-4">
|
||||
|
||||
<h2 class="card-title h4 mb-4"></h2>
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<nav aria-label="breadcrumb">
|
||||
|
||||
<ol class="breadcrumb" id="breadcrumb-container">
|
||||
<ol class="breadcrumb" id="breadcrumb-container">
|
||||
|
||||
</ol>
|
||||
</ol>
|
||||
|
||||
</nav>
|
||||
</nav>
|
||||
|
||||
<div id="file-explorer-list" class="list-group"></div>
|
||||
<button id="new-folder-btn" class="btn btn-sm btn-primary">New Folder</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="file-explorer-list" class="list-group"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -656,6 +658,10 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Toast container -->
|
||||
<div class="toast-container position-fixed bottom-0 end-0 p-3">
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
@@ -826,11 +832,28 @@
|
||||
|
||||
|
||||
function showMessage(message, type = 'info') {
|
||||
const alert = `<div class="alert alert-${type} alert-dismissible fade show" role="alert">
|
||||
${message}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>`;
|
||||
messages.innerHTML += alert;
|
||||
const toastContainer = document.querySelector('.toast-container');
|
||||
const toastId = 'toast-' + Date.now();
|
||||
const toastHTML = `
|
||||
<div id="${toastId}" class="toast align-items-center text-bg-${type} border-0" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="d-flex">
|
||||
<div class="toast-body">
|
||||
${message}
|
||||
</div>
|
||||
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
toastContainer.innerHTML += toastHTML;
|
||||
|
||||
const toastEl = document.getElementById(toastId);
|
||||
const toast = new bootstrap.Toast(toastEl, {
|
||||
delay: 5000 // Auto-hide after 5 seconds
|
||||
});
|
||||
toast.show();
|
||||
toastEl.addEventListener('hidden.bs.toast', () => {
|
||||
toastEl.remove();
|
||||
});
|
||||
}
|
||||
|
||||
function poll_logs(scan_id, terminal_el) {
|
||||
@@ -1185,65 +1208,65 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const table = document.createElement('table');
|
||||
table.className = 'table table-striped table-hover';
|
||||
table.innerHTML = `
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Size</th>
|
||||
<th>Progress</th>
|
||||
<th>Status</th>
|
||||
<th>Down Speed</th>
|
||||
<th>Up Speed</th>
|
||||
<th>ETA</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
`;
|
||||
const tbody = document.createElement('tbody');
|
||||
const listGroup = document.createElement('div');
|
||||
listGroup.className = 'list-group';
|
||||
|
||||
torrents.forEach(torrent => {
|
||||
const row = document.createElement('tr');
|
||||
const progress = (torrent.progress * 100).toFixed(2);
|
||||
row.innerHTML = `
|
||||
<td>${torrent.name}</td>
|
||||
<td>${(torrent.size / 1024 / 1024 / 1024).toFixed(2)} GB</td>
|
||||
<td>
|
||||
<div class="progress" style="height: 20px;">
|
||||
<div class="progress-bar" role="progressbar" style="width: ${progress}%" aria-valuenow="${progress}" aria-valuemin="0" aria-valuemax="100">${progress}%</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>${torrent.status}</td>
|
||||
<td>${(torrent.dlspeed / 1024 / 1024).toFixed(2)} MB/s</td>
|
||||
<td>${(torrent.upspeed / 1024 / 1024).toFixed(2)} MB/s</td>
|
||||
<td>${new Date(torrent.eta * 1000).toISOString().substr(11, 8)}</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-success qb-action-btn" data-action="resume" data-hash="${torrent.hash}">▶</button>
|
||||
<button class="btn btn-sm btn-warning qb-action-btn" data-action="pause" data-hash="${torrent.hash}">❚❚</button>
|
||||
<button class="btn btn-sm btn-danger qb-action-btn" data-action="delete" data-hash="${torrent.hash}">✖</button>
|
||||
</td>
|
||||
const listItem = document.createElement('div');
|
||||
listItem.className = 'list-group-item';
|
||||
|
||||
const titleEl = document.createElement('h6');
|
||||
titleEl.className = 'mb-1 text-break'; // text-break for wrapping
|
||||
titleEl.textContent = torrent.name;
|
||||
listItem.appendChild(titleEl);
|
||||
|
||||
const savePathEl = document.createElement('small');
|
||||
savePathEl.className = 'text-muted d-block text-break';
|
||||
savePathEl.innerHTML = `📁 <strong>Path:</strong> ${torrent.save_path}`;
|
||||
listItem.appendChild(savePathEl);
|
||||
|
||||
const statusLine = document.createElement('small');
|
||||
statusLine.className = 'text-muted';
|
||||
statusLine.innerHTML = `
|
||||
Status: <strong>${torrent.status}</strong> | Progress: <strong>${(torrent.progress * 100).toFixed(2)}%</strong><br>
|
||||
Size: ${(torrent.size / 1024 / 1024 / 1024).toFixed(2)} GB | DL: ${(torrent.dlspeed / 1024 / 1024).toFixed(2)} MB/s | UP: ${(torrent.upspeed / 1024 / 1024).toFixed(2)} MB/s | ETA: ${new Date(torrent.eta * 1000).toISOString().substr(11, 8)}
|
||||
`;
|
||||
tbody.appendChild(row);
|
||||
listItem.appendChild(statusLine);
|
||||
|
||||
const actionsEl = document.createElement('div');
|
||||
actionsEl.className = 'mt-2 d-flex justify-content-start flex-wrap'; // Use flexbox for buttons
|
||||
|
||||
const resumeBtn = createButton('▶ Resume', 'btn-sm btn-success me-1 mb-1', () => qbAction('resume', torrent.hash));
|
||||
const pauseBtn = createButton('❚❚ Pause', 'btn-sm btn-warning me-1 mb-1', () => qbAction('pause', torrent.hash));
|
||||
const forceResumeBtn = createButton('⟳ Force Resume', 'btn-sm btn-info me-1 mb-1', () => qbAction('force_resume', torrent.hash));
|
||||
const recheckBtn = createButton('? Recheck', 'btn-sm btn-secondary me-1 mb-1', () => qbAction('recheck', torrent.hash));
|
||||
const setLocationBtn = createButton('Set Location', 'btn-sm btn-primary me-1 mb-1', () => openQbMoveModal(torrent.hash));
|
||||
const deleteBtn = createButton('✖ Delete', 'btn-sm btn-danger me-1 mb-1', () => qbAction('delete', torrent.hash, true));
|
||||
|
||||
actionsEl.appendChild(resumeBtn);
|
||||
actionsEl.appendChild(pauseBtn);
|
||||
actionsEl.appendChild(forceResumeBtn);
|
||||
actionsEl.appendChild(recheckBtn);
|
||||
actionsEl.appendChild(setLocationBtn);
|
||||
actionsEl.appendChild(deleteBtn);
|
||||
listItem.appendChild(actionsEl);
|
||||
|
||||
listGroup.appendChild(listItem);
|
||||
});
|
||||
|
||||
table.appendChild(tbody);
|
||||
qbTorrentsDiv.appendChild(table);
|
||||
qbTorrentsDiv.appendChild(listGroup);
|
||||
}
|
||||
|
||||
document.querySelectorAll('.qb-action-btn').forEach(button => {
|
||||
button.addEventListener('click', async (e) => {
|
||||
const action = e.target.dataset.action;
|
||||
const hash = e.target.dataset.hash;
|
||||
if (action === 'delete' && !confirm('Are you sure you want to delete this torrent and its files?')) {
|
||||
return;
|
||||
}
|
||||
await fetch('/api/qb_action', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ action, hashes: [hash] })
|
||||
});
|
||||
fetchAndRenderTorrents();
|
||||
});
|
||||
async function qbAction(action, hash, confirmDelete = false) {
|
||||
if (action === 'delete' && confirmDelete && !confirm('Are you sure you want to delete this torrent and its files?')) {
|
||||
return;
|
||||
}
|
||||
await fetch('/api/qb_action', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ action, hashes: [hash] })
|
||||
});
|
||||
fetchAndRenderTorrents();
|
||||
}
|
||||
|
||||
setInterval(fetchAndRenderTorrents, 5000); // Refresh every 5 seconds
|
||||
@@ -1268,53 +1291,52 @@
|
||||
renderBreadcrumbs(path);
|
||||
}
|
||||
|
||||
function renderFileExplorer(items) {
|
||||
fileExplorerList.innerHTML = '';
|
||||
if (items.error) {
|
||||
fileExplorerList.innerHTML = `<div class="alert alert-danger">${items.error}</div>`;
|
||||
return;
|
||||
}
|
||||
items.sort((a, b) => {
|
||||
if (a.is_dir !== b.is_dir) {
|
||||
return a.is_dir ? -1 : 1;
|
||||
}
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
items.forEach(item => {
|
||||
const isDir = item.is_dir;
|
||||
const icon = isDir ? '📁' : '📄';
|
||||
const listItem = document.createElement('div');
|
||||
listItem.className = 'list-group-item list-group-item-action d-flex justify-content-between align-items-center file-explorer-item';
|
||||
|
||||
const nameEl = document.createElement('a');
|
||||
nameEl.href = '#';
|
||||
nameEl.innerHTML = `${icon} ${item.name}`;
|
||||
nameEl.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
if (isDir) {
|
||||
browse(item.path);
|
||||
} else {
|
||||
previewFile(item.path, item.name);
|
||||
function renderFileExplorer(items) {
|
||||
fileExplorerList.innerHTML = '';
|
||||
if (items.error) {
|
||||
fileExplorerList.innerHTML = `<div class="alert alert-danger">${items.error}</div>`;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
const actionsEl = document.createElement('div');
|
||||
actionsEl.className = 'actions';
|
||||
const renameBtn = createButton('Rename', 'btn-sm btn-outline-primary me-2', () => renameFile(item.path, item.name));
|
||||
const moveBtn = createButton('Move', 'btn-sm btn-outline-secondary me-2', () => moveFile(item.path));
|
||||
const deleteBtn = createButton('Delete', 'btn-sm btn-outline-danger', () => deleteFile(item.path));
|
||||
|
||||
actionsEl.appendChild(renameBtn);
|
||||
actionsEl.appendChild(moveBtn);
|
||||
actionsEl.appendChild(deleteBtn);
|
||||
|
||||
listItem.appendChild(nameEl);
|
||||
listItem.appendChild(actionsEl);
|
||||
|
||||
fileExplorerList.appendChild(listItem);
|
||||
});
|
||||
}
|
||||
items.sort((a, b) => {
|
||||
if (a.is_dir !== b.is_dir) {
|
||||
return a.is_dir ? -1 : 1;
|
||||
}
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
items.forEach(item => {
|
||||
const isDir = item.is_dir;
|
||||
const icon = isDir ? '📁' : '📄';
|
||||
const listItem = document.createElement('div');
|
||||
listItem.className = 'list-group-item list-group-item-action d-flex justify-content-between align-items-center file-explorer-item';
|
||||
|
||||
const nameEl = document.createElement('a');
|
||||
nameEl.href = '#';
|
||||
nameEl.innerHTML = `${icon} ${item.name}`;
|
||||
nameEl.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
if (isDir) {
|
||||
browse(item.path);
|
||||
} else {
|
||||
previewFile(item.path, item.name);
|
||||
}
|
||||
});
|
||||
|
||||
const actionsEl = document.createElement('div');
|
||||
actionsEl.className = 'actions';
|
||||
const renameBtn = createButton('Rename', 'btn-sm btn-outline-primary me-2', () => renameFile(item.path, item.name));
|
||||
const moveBtn = createButton('Move', 'btn-sm btn-outline-secondary me-2', () => moveFile(item.path));
|
||||
const deleteBtn = createButton('Delete', 'btn-sm btn-outline-danger', () => deleteFile(item.path));
|
||||
|
||||
actionsEl.appendChild(renameBtn);
|
||||
actionsEl.appendChild(moveBtn);
|
||||
actionsEl.appendChild(deleteBtn);
|
||||
|
||||
listItem.appendChild(nameEl);
|
||||
listItem.appendChild(actionsEl);
|
||||
|
||||
fileExplorerList.appendChild(listItem);
|
||||
});
|
||||
}
|
||||
function createButton(text, classes, onClick) {
|
||||
const button = document.createElement('button');
|
||||
button.textContent = text;
|
||||
@@ -1346,14 +1368,28 @@
|
||||
const moveBreadcrumbContainer = document.getElementById('move-breadcrumb-container');
|
||||
let moveSourcePath = '';
|
||||
let moveCurrentPath = '';
|
||||
let modalContext = 'move'; // 'move' or 'qb_torrent_location'
|
||||
let moveTorrentHash = '';
|
||||
|
||||
async function moveFile(path) {
|
||||
console.log('moveFile called with path:', path);
|
||||
modalContext = 'move';
|
||||
moveSourcePath = path;
|
||||
document.querySelector('#move-modal .modal-title').textContent = 'Move File';
|
||||
await browseMoveModal('');
|
||||
moveModal.show();
|
||||
}
|
||||
|
||||
async function openQbMoveModal(hash) {
|
||||
modalContext = 'qb_torrent_location';
|
||||
moveTorrentHash = hash;
|
||||
document.querySelector('#move-modal .modal-title').textContent = 'Set Torrent Location';
|
||||
await browseMoveModal('');
|
||||
moveModal.show();
|
||||
}
|
||||
|
||||
async function browseMoveModal(path) {
|
||||
console.log('browseMoveModal called with path:', path);
|
||||
moveCurrentPath = path;
|
||||
moveExplorerList.innerHTML = '<div class="text-center"><div class="spinner-border" role="status"><span class="visually-hidden">Loading...</span></div></div>';
|
||||
|
||||
@@ -1367,7 +1403,7 @@
|
||||
renderMoveExplorer(items.filter(item => item.is_dir));
|
||||
renderMoveBreadcrumbs(path);
|
||||
}
|
||||
|
||||
|
||||
function renderMoveExplorer(items) {
|
||||
moveExplorerList.innerHTML = '';
|
||||
if (items.error) {
|
||||
@@ -1426,29 +1462,52 @@
|
||||
});
|
||||
breadcrumbItem.appendChild(link);
|
||||
}
|
||||
breadcrumbContainer.appendChild(breadcrumbItem);
|
||||
moveBreadcrumbContainer.appendChild(breadcrumbItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
moveConfirmBtn.addEventListener('click', async () => {
|
||||
const destPath = moveCurrentPath;
|
||||
if (moveSourcePath && destPath) {
|
||||
const response = await fetch('/api/move_file', {
|
||||
console.log('Move Confirm button clicked. Context:', modalContext);
|
||||
console.log('Source:', moveSourcePath);
|
||||
console.log('Destination:', destPath);
|
||||
|
||||
if (modalContext === 'move') {
|
||||
if (moveSourcePath && destPath) {
|
||||
const response = await fetch('/api/move_file', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({source_path: moveSourcePath, dest_path: destPath})
|
||||
});
|
||||
const result = await response.json();
|
||||
if(result.success) {
|
||||
moveModal.hide();
|
||||
showMessage('File moved successfully!', 'success');
|
||||
browse(currentPath);
|
||||
} else {
|
||||
showMessage(`Error moving file: ${result.error}`, 'danger');
|
||||
}
|
||||
}
|
||||
} else if (modalContext === 'qb_torrent_location') {
|
||||
console.log('Setting qb torrent location for hash:', moveTorrentHash);
|
||||
const response = await fetch('/api/qb_set_location', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({source_path: moveSourcePath, dest_path: destPath})
|
||||
body: JSON.stringify({hashes: [moveTorrentHash], location: destPath})
|
||||
});
|
||||
const result = await response.json();
|
||||
if(result.success) {
|
||||
moveModal.hide();
|
||||
browse(currentPath);
|
||||
showMessage('Torrent location set successfully!', 'success');
|
||||
fetchAndRenderTorrents();
|
||||
} else {
|
||||
alert(`Error: ${result.error}`);
|
||||
showMessage(`Error setting torrent location: ${result.error}`, 'danger');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
async function deleteFile(path) {
|
||||
if(confirm(`Are you sure you want to delete ${path}?`)) {
|
||||
const response = await fetch('/api/delete_files', {
|
||||
|
||||
Reference in New Issue
Block a user