eCourt-note/public/wordaddin/manifest.template.xml

117 lines
7.3 KiB
XML
Raw Permalink Normal View History

2026-10-16 12:07:25 +07:00
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
manifest ของ Word add-in "e-Court Documents Versioning" (พอร์ตจาก D:\word-addin-poc\addin\manifest.xml)
feat(wordaddin): serve manifest with automatic origin rewrite manifest ของ add-in เดิมเป็น static ใน public/ ฝัง URL dev (localhost:3000) ทั้งไฟล์ — deploy จริงต้อง rewrite มือเองทุกครั้ง ก่อนนำไป sideload ใน Word ตอนนี้ serve ผ่าน route แทน: app/wordaddin/manifest.xml/route.ts อ่าน template (public/wordaddin/manifest.template.xml — ย้ายจาก manifest.xml ด้วย git mv) แล้วเขียนทับ origin ให้ตรงโฮสต์ที่ขอ ไฟล์ — dev/UAT/production ดาวน์โหลด manifest.xml ขอ environment ตัวเองแล้ว sideload ได้ทันที - ถอด requestOrigin จาก N10 route เป็น utils/request-origin.ts ใช้ร่วม + เพิ่ม heuristic: โฮสต์ไม่ใช่ localhost + proto http = บังคับ https (Office รับ https เท่านั้น และ hop ภายในหลัง IIS เป็น http เสมอ — Next server ก็ฉีด x-forwarded-proto เอง จึง ชี้ขาดจากโฮสต์ปลายทาง ไม่เดาว่า header มาจาก proxy หรือถูกฉีด) deep link ของ N10 ได้พฤติกรรมเดียวกันเป็นผลพวง - ตรวจ nft trace แล้ว template ถูกดึงเข้า standalone ด้วย (คู่ กับ COPY public จาก commit ก่อน = ชัวร์สองชั้น) ยืนยัน: tsc + vitest 215 tests ผ่าน · ทดสอบบน dev server ด้วย curl 3 โหมด — direct ได้ http://localhost:3000 (Word ยกเว้น localhost), ผ่าน proxy ส่ง header ครบได้ https://<โฮสต์>, ผ่าน proxy ไม่ส่ง proto (กรณี IIS) ได้ https://<โฮสต์> จากการ bump · next build compile route ผ่าน (ขั้น standalone symlink พังเฉพาะเครื่อง local Windows สิทธิ์ symlink — ไม่เกี่ยวกับโค้ด Docker build ผ่าน) Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-16 13:54:25 +07:00
ไฟล์นี้เป็น **template** — URL ทุกตัวเป็น absolute https ตามข้อบังคับของ Office
โดยค่า default คือ dev (https://localhost:3000/docedit/wordaddin) และถูก serve
ผ่าน route `app/wordaddin/manifest.xml/route.ts` ที่ rewrite origin ให้ตรงกับ
โฮสต์ที่ขอไฟล์อัตโนมัติ (dev/UAT/production ใช้ template เดียวกัน — เข้าถึงที่
/docedit/wordaddin/manifest.xml ของ environment นั้น ๆ ได้เลย)
(รายละเอียดวิธีรัน dev + sideload: docs/WORDADDIN-DEV.md)
2026-10-16 12:07:25 +07:00
ผลต่างจากต้นฉบับ:
- taskpane ชี้ที่หน้า Next.js (/docedit/wordaddin) แทน taskpane.html ของ webpack
- ตัด DialogAPI (login ช่วงนี้เป็น mock ไม่มี Keycloak dialog) — เหลือ WordApi 1.5 + OpenBrowserWindowApi
- ตัด AppDomain ของ Keycloak (https://localhost:8443)
- Commands.Url ชี้ taskpane URL เดียวกัน (ไม่มี commands.html — ปุ่มเดียวคือ ShowTaskpane)
- คง Id GUID เดิม — เครื่องที่เคย sideload ตัว poc จะถือว่าเป็น add-in ตัวเดิม
-->
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
<Id>4a1e184a-ab31-4fa4-b3c7-9a2283051c3f</Id>
fix(wordaddin): lower WordApi requirement for Office 2019 add-in โหลดไม่ขึ้นเลยบนเครื่องศาลที่ใช้ Office 2019 — manifest ตั้ง WordApi 1.5 ซึ่งเป็น Microsoft 365 เท่านั้น (Office 2019 perpetual รองรับสูงสุด 1.3) host ที่ไม่ถึง requirement จะปฏิเสธ โหลด add-in ตั้งแต่ต้นตามกลไกของ Office แก้: รองลงเป็น WordApi 1.3 (customXmlParts คือ API สูงสุดที่ใช้ ประจำ — customProperties/save/contentControls เป็น 1.1) + bump Version 1.0.0.1 → 1.0.0.2 ให้ Word ทุกเครื่องเห็นว่าเป็น เวอร์ชันใหม่แล้วดึง manifest ใหม่ (กันแค manifest เดิมของตัว poc ที่เคย sideload — GUID เดิม) ผลข้างเคียงบน Office 2019: ปุ่ม "บันทึกและปิดเอกสาร" / "บันทึกเวอร์ชันและปิดเอกสาร" ถูกซ่อนอัตโนมัติ — document.close() ต้องการ WordApi 1.4/1.5 โดย canCloseDocument() เช็ค isSetSupported("WordApi","1.5") ตอน runtime อยู่แล้ว (กลไกเดิม ที่ทำไว้สำหรับ Word on the web) ฟีเจอร์อื่นใช้ได้ครบ ยืนยัน: parse XML ผ่าน (@xmldom) — WordApi=1.3, OpenBrowserWindowApi=1.1 (Office 2019 รองรับ), Version=1.0.0.2 · สำรวจ API ที่ใช้จริงทั้ง wordaddin/services แล้วทุกตัว ≤1.3 ยกเว้น close() ที่มี runtime guard Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-16 14:20:24 +07:00
<Version>1.0.0.2</Version>
2026-10-16 12:07:25 +07:00
<ProviderName>e-Court Documents Versioning</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="e-Court Documents Versioning"/>
<Description DefaultValue="Opens the e-Court Documents Versioning task pane."/>
<IconUrl DefaultValue="https://localhost:3000/docedit/wordaddin/icons/icon-32.png"/>
<HighResolutionIconUrl DefaultValue="https://localhost:3000/docedit/wordaddin/icons/icon-64.png"/>
<SupportUrl DefaultValue="https://localhost:3000/docedit/wordaddin"/>
<AppDomains>
<AppDomain>https://localhost:3000</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Document"/>
</Hosts>
<!-- Requirement sets ที่ services layer ใช้จริง — host ที่ไม่รองรับจะไม่โหลด add-in เลย (fail fast ดีกว่าพังกลางทาง)
fix(wordaddin): lower WordApi requirement for Office 2019 add-in โหลดไม่ขึ้นเลยบนเครื่องศาลที่ใช้ Office 2019 — manifest ตั้ง WordApi 1.5 ซึ่งเป็น Microsoft 365 เท่านั้น (Office 2019 perpetual รองรับสูงสุด 1.3) host ที่ไม่ถึง requirement จะปฏิเสธ โหลด add-in ตั้งแต่ต้นตามกลไกของ Office แก้: รองลงเป็น WordApi 1.3 (customXmlParts คือ API สูงสุดที่ใช้ ประจำ — customProperties/save/contentControls เป็น 1.1) + bump Version 1.0.0.1 → 1.0.0.2 ให้ Word ทุกเครื่องเห็นว่าเป็น เวอร์ชันใหม่แล้วดึง manifest ใหม่ (กันแค manifest เดิมของตัว poc ที่เคย sideload — GUID เดิม) ผลข้างเคียงบน Office 2019: ปุ่ม "บันทึกและปิดเอกสาร" / "บันทึกเวอร์ชันและปิดเอกสาร" ถูกซ่อนอัตโนมัติ — document.close() ต้องการ WordApi 1.4/1.5 โดย canCloseDocument() เช็ค isSetSupported("WordApi","1.5") ตอน runtime อยู่แล้ว (กลไกเดิม ที่ทำไว้สำหรับ Word on the web) ฟีเจอร์อื่นใช้ได้ครบ ยืนยัน: parse XML ผ่าน (@xmldom) — WordApi=1.3, OpenBrowserWindowApi=1.1 (Office 2019 รองรับ), Version=1.0.0.2 · สำรวจ API ที่ใช้จริงทั้ง wordaddin/services แล้วทุกตัว ≤1.3 ยกเว้น close() ที่มี runtime guard Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-16 14:20:24 +07:00
WordApi 1.3: API สูงสุดที่ใช้นอกเหนือจาก close() — customXmlParts (1.3), customProperties /
document.save() / contentControls (1.1) — และเป็นระดับสูงสุดที่ Office 2019 perpetual
รองรับ (WordApi 1.4/1.5 = Microsoft 365 เท่านั้น — เดิมตั้ง 1.5 ทำให้เครื่องศาลที่ใช้
Office 2019 โหลด add-in ไม่ขึ้นเลย 2026-10-16); document.close() (FR-18) ตรวจ runtime
แยกที่ canCloseDocument() → isSetSupported("WordApi","1.5") — เครื่องที่ไม่ถึงซ่อนปุ่ม
ปิดเอกสารทุกแบบ (พฤติกรรมเดียวกับ Word on the web)
2026-10-16 12:07:25 +07:00
OpenBrowserWindowApi 1.1: เปิด presigned download URL ในเบราว์เซอร์ของเครื่อง (webview ของ Word ทิ้ง blob download) -->
<Requirements>
<Sets DefaultMinVersion="1.1">
fix(wordaddin): lower WordApi requirement for Office 2019 add-in โหลดไม่ขึ้นเลยบนเครื่องศาลที่ใช้ Office 2019 — manifest ตั้ง WordApi 1.5 ซึ่งเป็น Microsoft 365 เท่านั้น (Office 2019 perpetual รองรับสูงสุด 1.3) host ที่ไม่ถึง requirement จะปฏิเสธ โหลด add-in ตั้งแต่ต้นตามกลไกของ Office แก้: รองลงเป็น WordApi 1.3 (customXmlParts คือ API สูงสุดที่ใช้ ประจำ — customProperties/save/contentControls เป็น 1.1) + bump Version 1.0.0.1 → 1.0.0.2 ให้ Word ทุกเครื่องเห็นว่าเป็น เวอร์ชันใหม่แล้วดึง manifest ใหม่ (กันแค manifest เดิมของตัว poc ที่เคย sideload — GUID เดิม) ผลข้างเคียงบน Office 2019: ปุ่ม "บันทึกและปิดเอกสาร" / "บันทึกเวอร์ชันและปิดเอกสาร" ถูกซ่อนอัตโนมัติ — document.close() ต้องการ WordApi 1.4/1.5 โดย canCloseDocument() เช็ค isSetSupported("WordApi","1.5") ตอน runtime อยู่แล้ว (กลไกเดิม ที่ทำไว้สำหรับ Word on the web) ฟีเจอร์อื่นใช้ได้ครบ ยืนยัน: parse XML ผ่าน (@xmldom) — WordApi=1.3, OpenBrowserWindowApi=1.1 (Office 2019 รองรับ), Version=1.0.0.2 · สำรวจ API ที่ใช้จริงทั้ง wordaddin/services แล้วทุกตัว ≤1.3 ยกเว้น close() ที่มี runtime guard Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-16 14:20:24 +07:00
<Set Name="WordApi" MinVersion="1.3"/>
2026-10-16 12:07:25 +07:00
<Set Name="OpenBrowserWindowApi" MinVersion="1.1"/>
</Sets>
</Requirements>
<DefaultSettings>
<SourceLocation DefaultValue="https://localhost:3000/docedit/wordaddin"/>
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Document">
<DesktopFormFactor>
<GetStarted>
<Title resid="GetStarted.Title"/>
<Description resid="GetStarted.Description"/>
<LearnMoreUrl resid="GetStarted.LearnMoreUrl"/>
</GetStarted>
<FunctionFile resid="Commands.Url"/>
<ExtensionPoint xsi:type="PrimaryCommandSurface">
<OfficeTab id="TabHome">
<Group id="CommandsGroup">
<Label resid="CommandsGroup.Label"/>
<Icon>
<bt:Image size="16" resid="Icon.16x16"/>
<bt:Image size="32" resid="Icon.32x32"/>
<bt:Image size="80" resid="Icon.80x80"/>
</Icon>
<Control xsi:type="Button" id="TaskpaneButton">
<Label resid="TaskpaneButton.Label"/>
<Supertip>
<Title resid="TaskpaneButton.Label"/>
<Description resid="TaskpaneButton.Tooltip"/>
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16"/>
<bt:Image size="32" resid="Icon.32x32"/>
<bt:Image size="80" resid="Icon.80x80"/>
</Icon>
<Action xsi:type="ShowTaskpane">
<TaskpaneId>ButtonId1</TaskpaneId>
<SourceLocation resid="Taskpane.Url"/>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/docedit/wordaddin/icons/icon-16.png"/>
<bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/docedit/wordaddin/icons/icon-32.png"/>
<bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/docedit/wordaddin/icons/icon-80.png"/>
</bt:Images>
<bt:Urls>
<bt:Url id="GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812"/>
<bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/docedit/wordaddin"/>
<bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/docedit/wordaddin"/>
</bt:Urls>
<bt:ShortStrings>
<bt:String id="GetStarted.Title" DefaultValue="Get started with your add-in!"/>
<bt:String id="CommandsGroup.Label" DefaultValue="e-Court Add-in"/>
<bt:String id="TaskpaneButton.Label" DefaultValue="e-Court Documents Versioning"/>
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="GetStarted.Description" DefaultValue="Your add-in loaded successfully. Go to the HOME tab and click the 'Show Task Pane' button to get started."/>
<bt:String id="TaskpaneButton.Tooltip" DefaultValue="Opens the e-Court Documents Versioning task pane."/>
</bt:LongStrings>
</Resources>
</VersionOverrides>
</OfficeApp>