feat(papers): 论文内置阅读——arXiv iframe 零再分发合规方案
Agensh(arXiv 2609.26781)在线研读页:/papers/agensh/ 双轨薄壳
_PaperView 共享视图+六词条;信息条含标题/作者/abs 链接/授权声明
(arXiv nonexclusive-distrib 1.0,非本站托管)/下载钮。
合规红线:许可证禁第三方再分发→仓内零 PDF 副本,iframe 直嵌
arxiv(实测无 X-Frame-Options);微信 webview 前置 UA 检测加
is-wechat 类、iframe 不挂 src 零无用请求、兜底卡指引右上角浏览
器打开;非微信 data-src 懒挂载+9s 弱兜底+noscript 兜底。正文
入口卡双轨已渲染。
车道:op-gitea(专项四断言+E2E 34/34);收编复验六断言全过
(iframe/授权/微信降级/en/入口卡/零 PDF)
验证: E2E 34/34;微信 UA 模拟 is-wechat=true src 空 提示在;
git status 零 .pdf
Spec: none (论文阅读页,车道级交付)
Co-authored-by: GLM-5.3
This commit is contained in:
1 parent
bbb52b9e24
commit
a761cf8129
6 files changed
+219
No files matched your search
@@ -0,0 +1,4 @@
|
||||
---
|
||||
import PaperView from '../../papers/_PaperView.astro';
|
||||
---
|
||||
<PaperView locale="en" paper="agensh" />
|
||||
@@ -0,0 +1,200 @@
|
||||
---
|
||||
// 论文内置阅读视图(非路由共享件,_ 前缀不成页):双语薄壳 papers/agensh.astro 与
|
||||
// en/papers/agensh.astro 共用。许可证红线:arXiv nonexclusive-dist 1.0 禁止第三方
|
||||
// 再分发——PDF 只经 iframe 指向 arXiv 原站,仓内不存任何 PDF 副本。
|
||||
// 微信内置浏览器内嵌 PDF 基本不可用:UA 检测在 head 前置(无闪烁),微信下不发起
|
||||
// iframe 请求,直接呈现兜底卡(含"右上角用浏览器打开"指引)。
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import { t } from '../../i18n/ui';
|
||||
import type { Locale } from '../../lib/locale';
|
||||
|
||||
interface Props {
|
||||
locale: Locale;
|
||||
paper: keyof typeof PAPERS;
|
||||
}
|
||||
|
||||
// 新增论文只需在此加一条 + 双语薄壳;刻意不做数据驱动渲染层(当前单篇,抽象无收益)
|
||||
const PAPERS = {
|
||||
agensh: {
|
||||
abs: 'https://arxiv.org/abs/2609.26781',
|
||||
pdf: 'https://arxiv.org/pdf/2609.26781',
|
||||
license: 'arXiv nonexclusive-distrib 1.0',
|
||||
title: {
|
||||
zh: 'Agensh:把组织智能扩展到 1,024 个智能体',
|
||||
en: 'Agensh: Scaling Organizational Intelligence to 1,024 Agents',
|
||||
},
|
||||
authors: { zh: '微软研究院(Microsoft Research)', en: 'Microsoft Research' },
|
||||
alt: {
|
||||
zh: 'Agensh 论文全文 PDF(arXiv 2609.26781)',
|
||||
en: 'Full text PDF of the Agensh paper (arXiv 2609.26781)',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
const { locale, paper } = Astro.props;
|
||||
const p = PAPERS[paper];
|
||||
---
|
||||
|
||||
<BaseLayout
|
||||
title={`${p.title[locale]} · PDF`}
|
||||
description={`${p.title[locale]} — ${t('paper_read_online', locale)}`}
|
||||
track="tech"
|
||||
>
|
||||
<article class="paper-wrap">
|
||||
<header class="paper-bar">
|
||||
<div class="paper-meta">
|
||||
<h1>{p.title[locale]}</h1>
|
||||
<p class="paper-sub">
|
||||
<span>{p.authors[locale]}</span>
|
||||
<span class="paper-sep" aria-hidden="true">·</span>
|
||||
<a href={p.abs} target="_blank" rel="noopener noreferrer">arXiv:2609.26781</a>
|
||||
<span class="paper-sep" aria-hidden="true">·</span>
|
||||
<span class="paper-license">{t('paper_license', locale)}:{p.license}</span>
|
||||
</p>
|
||||
</div>
|
||||
<a class="paper-download tap" href={p.pdf} target="_blank" rel="noopener noreferrer">
|
||||
{t('paper_download', locale)}
|
||||
</a>
|
||||
</header>
|
||||
|
||||
<!-- iframe 无初始 src:脚本确认非微信后才挂载,微信内不产生无用请求 -->
|
||||
<div class="paper-stage">
|
||||
<iframe
|
||||
id="paper-frame"
|
||||
class="paper-frame"
|
||||
data-src={p.pdf}
|
||||
title={p.alt[locale]}
|
||||
allow="fullscreen"
|
||||
></iframe>
|
||||
|
||||
<!-- 兜底卡:微信 UA(JS 加 is-wechat)或 iframe 加载超时后显形 -->
|
||||
<div class="paper-fallback" id="paper-fallback" hidden>
|
||||
<p class="paper-fallback-title">{t('paper_fallback_title', locale)}</p>
|
||||
<p class="paper-fallback-hint" data-wechat-only hidden>{t('paper_wechat_hint', locale)}</p>
|
||||
<p>
|
||||
<a class="paper-fallback-link" href={p.pdf} target="_blank" rel="noopener noreferrer">
|
||||
{t('paper_open_browser', locale)}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<noscript>
|
||||
<div class="paper-fallback paper-fallback-ns">
|
||||
<p class="paper-fallback-title">{t('paper_fallback_title', locale)}</p>
|
||||
<p><a class="paper-fallback-link" href={p.pdf}>{t('paper_open_browser', locale)}</a></p>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</article>
|
||||
</BaseLayout>
|
||||
|
||||
<script is:inline data-astro-rerun>
|
||||
// data-astro-rerun:ClientRouter 软导航后内联脚本默认不重跑,不加则从别的页面切进
|
||||
// 本页时 iframe 永不挂载(ThemeScript 同款坑,2026-10-25 已记录)
|
||||
(function () {
|
||||
var frame = document.getElementById('paper-frame');
|
||||
if (!frame) return;
|
||||
var fallback = document.getElementById('paper-fallback');
|
||||
var wechat = /MicroMessenger/i.test(navigator.userAgent);
|
||||
document.documentElement.classList.toggle('is-wechat', wechat);
|
||||
|
||||
function showFallback(withWechatHint) {
|
||||
if (!fallback) return;
|
||||
fallback.hidden = false;
|
||||
var hint = fallback.querySelector('[data-wechat-only]');
|
||||
if (hint) hint.hidden = !withWechatHint;
|
||||
}
|
||||
|
||||
if (wechat) {
|
||||
// 微信 webview 内嵌 PDF 基本不可用:不挂载 iframe,直接兜底 + 浏览器指引
|
||||
showFallback(true);
|
||||
return;
|
||||
}
|
||||
var settled = false;
|
||||
frame.addEventListener('load', function () { settled = true; });
|
||||
frame.src = frame.dataset.src;
|
||||
// arXiv 现无 X-Frame-Options(实测 2026-11-01),超时兜底只作弱网/拦截保险
|
||||
setTimeout(function () { if (!settled) showFallback(false); }, 9000);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.paper-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100dvh - 4rem);
|
||||
min-height: 30rem;
|
||||
}
|
||||
.paper-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-2) 0;
|
||||
border-bottom: 1px solid var(--line);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.paper-bar h1 {
|
||||
font-size: clamp(0.95rem, 2.2vw, 1.15rem);
|
||||
margin: 0;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
}
|
||||
.paper-sub {
|
||||
margin: 0.2rem 0 0;
|
||||
font-size: 0.8rem;
|
||||
color: var(--ink-2);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
align-items: baseline;
|
||||
}
|
||||
.paper-license { font-family: var(--font-mono); font-size: 0.72rem; }
|
||||
.paper-download {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.78rem;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
padding: 0.3rem 0.8rem;
|
||||
color: var(--ink-1);
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.paper-download:hover { border-color: var(--accent); color: var(--accent); }
|
||||
.paper-stage {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
.paper-frame {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0;
|
||||
background: var(--surface-2, #f4f4f2);
|
||||
}
|
||||
/* 微信内不挂 iframe,避免空白框占位 */
|
||||
:global(html.is-wechat) .paper-frame { display: none; }
|
||||
.paper-fallback {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-2);
|
||||
text-align: center;
|
||||
padding: var(--space-3);
|
||||
background: var(--surface-2, #f4f4f2);
|
||||
border: 1px dashed var(--line);
|
||||
border-radius: var(--radius, 8px);
|
||||
}
|
||||
.paper-fallback[hidden] { display: none; }
|
||||
.paper-fallback-title { font-weight: 600; margin: 0; }
|
||||
.paper-fallback-hint { color: var(--ink-2); font-size: 0.85rem; margin: 0; }
|
||||
.paper-fallback-link {
|
||||
font-family: var(--font-mono);
|
||||
color: var(--accent);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
import PaperView from './_PaperView.astro';
|
||||
---
|
||||
<PaperView locale="zh" paper="agensh" />
|
||||
Reference in new issue
Block a user