Spaces:
Sleeping
Sleeping
abdulsalam2121 commited on
Commit ·
cf366bb
1
Parent(s): a1ec5b3
remove the target url from frontend
Browse files- app/static/app.js +1 -14
- app/templates/index.html +3 -10
- app/web_app.py +1 -7
app/static/app.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
const elements = {
|
| 2 |
-
targetUrl: document.getElementById('target_url'),
|
| 3 |
startBtn: document.getElementById('startBtn'),
|
| 4 |
stopBtn: document.getElementById('stopBtn'),
|
| 5 |
clearLogsBtn: document.getElementById('clearLogsBtn'),
|
|
@@ -46,12 +45,6 @@ function clearBanners() {
|
|
| 46 |
setBanner(elements.successBanner, '');
|
| 47 |
}
|
| 48 |
|
| 49 |
-
function readFormData() {
|
| 50 |
-
return {
|
| 51 |
-
target_url: elements.targetUrl.value.trim(),
|
| 52 |
-
};
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
function setRunningState(isRunning) {
|
| 56 |
running = isRunning;
|
| 57 |
elements.startBtn.disabled = isRunning;
|
|
@@ -110,18 +103,12 @@ async function fetchStatus() {
|
|
| 110 |
|
| 111 |
async function startBot() {
|
| 112 |
clearBanners();
|
| 113 |
-
const payload = readFormData();
|
| 114 |
-
|
| 115 |
-
if (!payload.target_url) {
|
| 116 |
-
showError('Please enter a target URL.');
|
| 117 |
-
return;
|
| 118 |
-
}
|
| 119 |
|
| 120 |
try {
|
| 121 |
const response = await fetch('/start', {
|
| 122 |
method: 'POST',
|
| 123 |
headers: { 'Content-Type': 'application/json' },
|
| 124 |
-
body: JSON.stringify(
|
| 125 |
});
|
| 126 |
const data = await response.json();
|
| 127 |
if (!response.ok || !data.ok) {
|
|
|
|
| 1 |
const elements = {
|
|
|
|
| 2 |
startBtn: document.getElementById('startBtn'),
|
| 3 |
stopBtn: document.getElementById('stopBtn'),
|
| 4 |
clearLogsBtn: document.getElementById('clearLogsBtn'),
|
|
|
|
| 45 |
setBanner(elements.successBanner, '');
|
| 46 |
}
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
function setRunningState(isRunning) {
|
| 49 |
running = isRunning;
|
| 50 |
elements.startBtn.disabled = isRunning;
|
|
|
|
| 103 |
|
| 104 |
async function startBot() {
|
| 105 |
clearBanners();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
try {
|
| 108 |
const response = await fetch('/start', {
|
| 109 |
method: 'POST',
|
| 110 |
headers: { 'Content-Type': 'application/json' },
|
| 111 |
+
body: JSON.stringify({}),
|
| 112 |
});
|
| 113 |
const data = await response.json();
|
| 114 |
if (!response.ok || !data.ok) {
|
app/templates/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
| 12 |
<div>
|
| 13 |
<p class="eyebrow">AdultDVDMarketplace Automation</p>
|
| 14 |
<h1>ADM PURCHASING TOOLS</h1>
|
| 15 |
-
<p class="hero-copy">
|
| 16 |
</div>
|
| 17 |
<div class="hero-badge">
|
| 18 |
<span class="dot"></span>
|
|
@@ -23,20 +23,13 @@
|
|
| 23 |
<main class="layout">
|
| 24 |
<section class="panel panel-form">
|
| 25 |
<div class="panel-head">
|
| 26 |
-
<h2>Automation
|
| 27 |
-
<p>
|
| 28 |
</div>
|
| 29 |
|
| 30 |
<div id="errorBanner" class="banner banner-error hidden"></div>
|
| 31 |
<div id="successBanner" class="banner banner-success hidden"></div>
|
| 32 |
|
| 33 |
-
<form id="botForm" class="form-grid">
|
| 34 |
-
<label class="span-2">
|
| 35 |
-
<span>Target URL</span>
|
| 36 |
-
<input id="target_url" name="target_url" type="text" value="{{ settings.target_url }}" placeholder="https://www.adultdvdmarketplace.com/xcart/adult_dvd/modify_listings.php" />
|
| 37 |
-
</label>
|
| 38 |
-
</form>
|
| 39 |
-
|
| 40 |
<div class="button-row">
|
| 41 |
<button id="startBtn" class="btn btn-primary" type="button">Start Bot</button>
|
| 42 |
<button id="stopBtn" class="btn btn-secondary" type="button" disabled>Stop Bot</button>
|
|
|
|
| 12 |
<div>
|
| 13 |
<p class="eyebrow">AdultDVDMarketplace Automation</p>
|
| 14 |
<h1>ADM PURCHASING TOOLS</h1>
|
| 15 |
+
<p class="hero-copy">Run the listings updater with one click, then stop it whenever needed.</p>
|
| 16 |
</div>
|
| 17 |
<div class="hero-badge">
|
| 18 |
<span class="dot"></span>
|
|
|
|
| 23 |
<main class="layout">
|
| 24 |
<section class="panel panel-form">
|
| 25 |
<div class="panel-head">
|
| 26 |
+
<h2>Automation Controls</h2>
|
| 27 |
+
<p>Start or stop the listing price updater.</p>
|
| 28 |
</div>
|
| 29 |
|
| 30 |
<div id="errorBanner" class="banner banner-error hidden"></div>
|
| 31 |
<div id="successBanner" class="banner banner-success hidden"></div>
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
<div class="button-row">
|
| 34 |
<button id="startBtn" class="btn btn-primary" type="button">Start Bot</button>
|
| 35 |
<button id="stopBtn" class="btn btn-secondary" type="button" disabled>Stop Bot</button>
|
app/web_app.py
CHANGED
|
@@ -56,13 +56,7 @@ def index():
|
|
| 56 |
|
| 57 |
@app.post("/start")
|
| 58 |
def start():
|
| 59 |
-
|
| 60 |
-
target_url = str(payload.get("target_url", "")).strip()
|
| 61 |
-
|
| 62 |
-
if not target_url:
|
| 63 |
-
return jsonify({"ok": False, "error": "Target URL is required"}), 400
|
| 64 |
-
|
| 65 |
-
result = controller.start(target_url=target_url)
|
| 66 |
status_code = 200 if result.get("ok") else 400
|
| 67 |
return jsonify(result), status_code
|
| 68 |
|
|
|
|
| 56 |
|
| 57 |
@app.post("/start")
|
| 58 |
def start():
|
| 59 |
+
result = controller.start(target_url=DEFAULT_TARGET_URL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
status_code = 200 if result.get("ok") else 400
|
| 61 |
return jsonify(result), status_code
|
| 62 |
|