Fix calendar drag snap-back, IG filter, and default to 2026.

Prefer the latest year in the archive, normalize Instagram casing so stories show under IG/FB, sync pipeline dates on move, and stop stale plan re-renders from undoing a successful drag.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
4Ventures
2026-10-07 15:29:49 +02:00
parent 2759aa87f6
commit 83de3fb3aa
5 changed files with 281 additions and 72 deletions

View File

@@ -15,7 +15,7 @@ BASE = "https://dokploy.4ventures.es"
APP_ID = "NZS797t9Rnq9Pj4mHiii3"
SCHEDULE_NAME = "pipeline-publish"
CRON_EXPR = "*/5 * * * *"
# Public URL + env expansion via bash -lc so CRON_SECRET from app env is used.
# Runs inside the app container so $CRON_SECRET from Dokploy env is available.
CMD = (
"bash -lc "
"'curl -sS -H \"Authorization: Bearer $CRON_SECRET\" "
@@ -71,39 +71,51 @@ def main() -> int:
try { json = JSON.parse(text); } catch {}
return { ok: r.ok, status: r.status, text: text.slice(0, 1200), json };
};
const get = async (path) => {
const r = await fetch(path, { credentials: 'include' });
const text = await r.text();
let json = null;
try { json = JSON.parse(text); } catch {}
return { ok: r.ok, status: r.status, text: text.slice(0, 2000), json };
};
// Delete existing schedules with same name
for (const listPath of [
'/api/schedule.all',
'/api/schedule.byApplicationId',
]) {
const listed = await post(listPath, { applicationId: appId });
const rows = Array.isArray(listed.json)
? listed.json
: listed.json?.data || listed.json?.schedules || [];
if (Array.isArray(rows)) {
for (const row of rows) {
const n = row?.name || row?.scheduleName;
const id = row?.scheduleId || row?.id;
if (n === name && id) {
await post('/api/schedule.delete', { scheduleId: id });
await post('/api/schedule.remove', { scheduleId: id });
}
}
}
// List application schedules (Dokploy v0.30)
const listed = await get(
'/api/trpc/schedule.list?batch=1&input=' +
encodeURIComponent(JSON.stringify({
'0': { json: { id: appId, scheduleType: 'application' } }
}))
);
const rows =
listed.json?.[0]?.result?.data?.json ||
listed.json?.[0]?.result?.data ||
[];
const existing = Array.isArray(rows)
? rows.filter((r) => (r?.name || '') === name)
: [];
for (const row of existing) {
const sid = row.scheduleId || row.id;
if (!sid) continue;
await post('/api/trpc/schedule.delete?batch=1', {
'0': { json: { scheduleId: sid } },
});
}
const created = await post('/api/schedule.create', {
applicationId: appId,
name,
cron,
cronExpression: cron,
command,
shellType: 'bash',
enabled: true,
scheduleType: 'application',
const created = await post('/api/trpc/schedule.create?batch=1', {
'0': {
json: {
name,
cronExpression: cron,
shellType: 'bash',
command,
applicationId: appId,
scheduleType: 'application',
enabled: true,
},
},
});
return { created };
return { deleted: existing.length, created };
}""",
{
"appId": APP_ID,