fix: 修复回填更新与截图刷新
This commit is contained in:
@@ -186,7 +186,12 @@ async function handleGet(request: Request) {
|
|||||||
}
|
}
|
||||||
const headers = new Headers();
|
const headers = new Headers();
|
||||||
object.writeHttpMetadata(headers);
|
object.writeHttpMetadata(headers);
|
||||||
headers.set("Cache-Control", "private, max-age=3600");
|
const isMutableEvidence =
|
||||||
|
imageKind === "publish" || imageKind === "creator";
|
||||||
|
headers.set(
|
||||||
|
"Cache-Control",
|
||||||
|
isMutableEvidence ? "private, no-store" : "private, max-age=3600",
|
||||||
|
);
|
||||||
if (imageKind === "video") {
|
if (imageKind === "video") {
|
||||||
headers.set("Content-Type", "video/mp4");
|
headers.set("Content-Type", "video/mp4");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1792,6 +1792,11 @@ footer {
|
|||||||
font-weight: 620;
|
font-weight: 620;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toast.success {
|
||||||
|
color: var(--green-deep);
|
||||||
|
font-weight: 720;
|
||||||
|
}
|
||||||
|
|
||||||
.loading-shell {
|
.loading-shell {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -127,6 +127,11 @@ function statusLabel(item: Assignment, taskType = "content_publish") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MAX_TASK_RESULT_SCREENSHOTS = 9;
|
const MAX_TASK_RESULT_SCREENSHOTS = 9;
|
||||||
|
const PUBLISH_BACKFILL_SUCCESS = "这篇笔记的发布记录回填成功啦~";
|
||||||
|
|
||||||
|
function toastClassName(message: string) {
|
||||||
|
return message === PUBLISH_BACKFILL_SUCCESS ? "toast success" : "toast";
|
||||||
|
}
|
||||||
|
|
||||||
function resultScreenshotKeys(value: string | null) {
|
function resultScreenshotKeys(value: string | null) {
|
||||||
const text = String(value ?? "").trim();
|
const text = String(value ?? "").trim();
|
||||||
@@ -594,6 +599,11 @@ export default function Home() {
|
|||||||
index: "1",
|
index: "1",
|
||||||
kind,
|
kind,
|
||||||
});
|
});
|
||||||
|
const evidenceKey =
|
||||||
|
kind === "publish"
|
||||||
|
? item.publish_screenshot_key
|
||||||
|
: item.creator_screenshot_key;
|
||||||
|
if (evidenceKey) params.set("v", evidenceKey);
|
||||||
if (delegationToken) params.set("share", delegationToken);
|
if (delegationToken) params.set("share", delegationToken);
|
||||||
else {
|
else {
|
||||||
params.set("task", taskToken);
|
params.set("task", taskToken);
|
||||||
@@ -1013,7 +1023,7 @@ export default function Home() {
|
|||||||
});
|
});
|
||||||
}, 120);
|
}, 120);
|
||||||
}
|
}
|
||||||
setToast("这篇笔记已回填,不会与其他笔记错配");
|
setToast(PUBLISH_BACKFILL_SUCCESS);
|
||||||
} catch (reason) {
|
} catch (reason) {
|
||||||
setToast(reason instanceof Error ? reason.message : "回填失败");
|
setToast(reason instanceof Error ? reason.message : "回填失败");
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1283,7 +1293,7 @@ export default function Home() {
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<ImageLightbox image={previewImage} onClose={() => setPreviewImage(null)} />
|
<ImageLightbox image={previewImage} onClose={() => setPreviewImage(null)} />
|
||||||
{toast && <div className="toast">{toast}</div>}
|
{toast && <div className={toastClassName(toast)}>{toast}</div>}
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1610,7 +1620,6 @@ export default function Home() {
|
|||||||
value={creatorExposure}
|
value={creatorExposure}
|
||||||
onChange={(event) => setCreatorExposure(event.target.value)}
|
onChange={(event) => setCreatorExposure(event.target.value)}
|
||||||
placeholder="填写截图中的曝光量"
|
placeholder="填写截图中的曝光量"
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
@@ -1624,7 +1633,6 @@ export default function Home() {
|
|||||||
value={creatorViews}
|
value={creatorViews}
|
||||||
onChange={(event) => setCreatorViews(event.target.value)}
|
onChange={(event) => setCreatorViews(event.target.value)}
|
||||||
placeholder="填写截图中的阅读量"
|
placeholder="填写截图中的阅读量"
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -1650,7 +1658,7 @@ export default function Home() {
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<ImageLightbox image={previewImage} onClose={() => setPreviewImage(null)} />
|
<ImageLightbox image={previewImage} onClose={() => setPreviewImage(null)} />
|
||||||
{toast && <div className="toast">{toast}</div>}
|
{toast && <div className={toastClassName(toast)}>{toast}</div>}
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1957,7 +1965,7 @@ export default function Home() {
|
|||||||
? "请保存当前分享链接;完成任务后通过此链接上传截图即可。"
|
? "请保存当前分享链接;完成任务后通过此链接上传截图即可。"
|
||||||
: "请保存当前分享链接;发布后仍需通过此链接回填第7天截图、曝光量和阅读量。"}
|
: "请保存当前分享链接;发布后仍需通过此链接回填第7天截图、曝光量和阅读量。"}
|
||||||
</div>
|
</div>
|
||||||
{toast && <div className="toast">{toast}</div>}
|
{toast && <div className={toastClassName(toast)}>{toast}</div>}
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -2104,7 +2112,7 @@ export default function Home() {
|
|||||||
<div><span>3</span><strong>{payload.task.type === "screenshot_collect" ? "上传截图" : "单篇回填"}</strong><p>{payload.task.type === "screenshot_collect" ? "每份任务与截图一一对应" : "昵称、链接、截图一一对应"}</p></div>
|
<div><span>3</span><strong>{payload.task.type === "screenshot_collect" ? "上传截图" : "单篇回填"}</strong><p>{payload.task.type === "screenshot_collect" ? "每份任务与截图一一对应" : "昵称、链接、截图一一对应"}</p></div>
|
||||||
</section>
|
</section>
|
||||||
<footer>由 KOC LOOP 提供任务与数据安全保障</footer>
|
<footer>由 KOC LOOP 提供任务与数据安全保障</footer>
|
||||||
{toast && <div className="toast">{toast}</div>}
|
{toast && <div className={toastClassName(toast)}>{toast}</div>}
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,9 @@ test("keeps claiming minimal and backfill one-to-one", async () => {
|
|||||||
assert.match(page, /找回领取记录/);
|
assert.match(page, /找回领取记录/);
|
||||||
assert.match(page, /action:\s*"recover"/);
|
assert.match(page, /action:\s*"recover"/);
|
||||||
assert.match(page, /同一任务多次领取会分批展示/);
|
assert.match(page, /同一任务多次领取会分批展示/);
|
||||||
assert.match(page, /这篇笔记已回填,不会与其他笔记错配/);
|
assert.match(page, /这篇笔记的发布记录回填成功啦~/);
|
||||||
|
assert.match(page, /toastClassName\(toast\)/);
|
||||||
|
assert.match(styles, /\.toast\.success/);
|
||||||
assert.match(page, /笔记内容已收起/);
|
assert.match(page, /笔记内容已收起/);
|
||||||
assert.match(page, /展开笔记内容/);
|
assert.match(page, /展开笔记内容/);
|
||||||
assert.match(page, /收起笔记内容/);
|
assert.match(page, /收起笔记内容/);
|
||||||
@@ -92,6 +94,7 @@ test("keeps claiming minimal and backfill one-to-one", async () => {
|
|||||||
assert.match(page, /creatorViews/);
|
assert.match(page, /creatorViews/);
|
||||||
assert.match(page, /截图仅用于运营核对,不再自动OCR/);
|
assert.match(page, /截图仅用于运营核对,不再自动OCR/);
|
||||||
assert.match(page, /evidenceImageUrl/);
|
assert.match(page, /evidenceImageUrl/);
|
||||||
|
assert.match(page, /params\.set\("v", evidenceKey\)/);
|
||||||
assert.match(page, /evidenceImageUrl\(selected, "publish"\)/);
|
assert.match(page, /evidenceImageUrl\(selected, "publish"\)/);
|
||||||
assert.match(page, /evidenceImageUrl\(selected, "creator"\)/);
|
assert.match(page, /evidenceImageUrl\(selected, "creator"\)/);
|
||||||
assert.match(page, /ImageLightbox/);
|
assert.match(page, /ImageLightbox/);
|
||||||
@@ -100,6 +103,8 @@ test("keeps claiming minimal and backfill one-to-one", async () => {
|
|||||||
assert.match(page, /creatorScreenshotPreview/);
|
assert.match(page, /creatorScreenshotPreview/);
|
||||||
assert.match(page, /曝光量/);
|
assert.match(page, /曝光量/);
|
||||||
assert.match(page, /阅读量/);
|
assert.match(page, /阅读量/);
|
||||||
|
assert.match(page, /placeholder="填写截图中的曝光量"\s*\/>/);
|
||||||
|
assert.match(page, /placeholder="填写截图中的阅读量"\s*\/>/);
|
||||||
assert.doesNotMatch(page, /recognizeCreatorMetrics/);
|
assert.doesNotMatch(page, /recognizeCreatorMetrics/);
|
||||||
assert.match(page, /note-index \$\{\(isScreenshotTask \? item\.result_submitted_at : item\.publish_url\) \? "done" : ""\}/);
|
assert.match(page, /note-index \$\{\(isScreenshotTask \? item\.result_submitted_at : item\.publish_url\) \? "done" : ""\}/);
|
||||||
assert.match(packageJson, /"fflate":\s*"0\.7\.4"/);
|
assert.match(packageJson, /"fflate":\s*"0\.7\.4"/);
|
||||||
|
|||||||
@@ -200,6 +200,8 @@ test("issues external task links and supports one-to-one note submissions", asyn
|
|||||||
assert.match(imageRoute, /creator-center\//);
|
assert.match(imageRoute, /creator-center\//);
|
||||||
assert.match(imageRoute, /imageKind === "publish"/);
|
assert.match(imageRoute, /imageKind === "publish"/);
|
||||||
assert.match(imageRoute, /imageKind === "creator"/);
|
assert.match(imageRoute, /imageKind === "creator"/);
|
||||||
|
assert.match(imageRoute, /isMutableEvidence/);
|
||||||
|
assert.match(imageRoute, /"private, no-store"/);
|
||||||
assert.match(imageRoute, /Content-Type", "video\/mp4"/);
|
assert.match(imageRoute, /Content-Type", "video\/mp4"/);
|
||||||
assert.match(imageRoute, /video-\$\{imageIndex\}\.mp4/);
|
assert.match(imageRoute, /video-\$\{imageIndex\}\.mp4/);
|
||||||
assert.match(imageRoute, /downloadRequested \? "attachment" : "inline"/);
|
assert.match(imageRoute, /downloadRequested \? "attachment" : "inline"/);
|
||||||
|
|||||||
Reference in New Issue
Block a user