Sync snapshot (2026-08-02)
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# Normalize line endings: everything text is committed with LF and checked
|
||||
# out as LF on every platform, so Windows clones (core.autocrlf=true) don't
|
||||
# fail the incremental prettier --check CI gate on CRLF.
|
||||
* text=auto eol=lf
|
||||
|
||||
# Binary assets — never normalized or diffed as text.
|
||||
*.docx binary
|
||||
*.xlsx binary
|
||||
*.pptx binary
|
||||
*.pdf binary
|
||||
*.png binary
|
||||
*.ico binary
|
||||
*.icns binary
|
||||
*.ttf binary
|
||||
*.otf binary
|
||||
*.woff binary
|
||||
*.woff2 binary
|
||||
@@ -0,0 +1,6 @@
|
||||
# ee/ is the enterprise-license boundary and takes no external contributions
|
||||
# (see ee/LICENSE); license-related files need a maintainer review.
|
||||
/ee/ @merrick-2002
|
||||
/LICENSE @merrick-2002
|
||||
/NOTICE @merrick-2002
|
||||
/.github/CODEOWNERS @merrick-2002
|
||||
@@ -0,0 +1,8 @@
|
||||
# Keep GitHub Actions fresh: workflow actions are SHA-pinned, so tag moves
|
||||
# never reach us without a PR bumping the pinned commit here.
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
@@ -25,12 +25,12 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
@@ -82,5 +82,11 @@ jobs:
|
||||
- name: Regenerate test fixtures
|
||||
run: npm run fixtures
|
||||
|
||||
# Generation is byte-deterministic (zip entry mtimes are pinned in
|
||||
# tests/helpers/build-docx.ts); a diff here means the generator and the
|
||||
# committed fixtures have drifted apart.
|
||||
- name: Check committed fixtures match the generator
|
||||
run: git diff --exit-code -- fixtures/generated
|
||||
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
||||
+5
-3
@@ -56,9 +56,11 @@ an individual is officially representing the community in public spaces.
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement through the
|
||||
repository's security advisory channel or the contact listed in
|
||||
[SECURITY.md](SECURITY.md). All complaints will be reviewed and investigated
|
||||
reported to the community leaders responsible for enforcement through
|
||||
GitHub's
|
||||
[private vulnerability reporting](https://github.com/genspark-ai/genoffice/security/advisories/new)
|
||||
channel on this repository (used here as the private contact channel for
|
||||
conduct reports as well). All complaints will be reviewed and investigated
|
||||
promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
|
||||
+5
-2
@@ -53,9 +53,12 @@ formatting diff.
|
||||
|
||||
## Building installers
|
||||
|
||||
Run these from the repository root — they regenerate the third-party
|
||||
notices and build all five apps before packaging:
|
||||
|
||||
```bash
|
||||
npm run dist:mac -w @genoffice/shell # dmg + zip
|
||||
npm run dist:win -w @genoffice/shell # nsis installer
|
||||
npm run dist:mac # dmg + zip
|
||||
npm run dist:win # nsis installer
|
||||
```
|
||||
|
||||
Without Apple or Windows signing credentials in the environment these produce
|
||||
|
||||
@@ -32,10 +32,11 @@ calls through the Genspark service side; no model API key is stored locally.
|
||||
|
||||
## Engine packages
|
||||
|
||||
All pure TypeScript, unit-tested, no Electron dependency:
|
||||
All pure TypeScript, no Electron dependency, unit-tested (except the UI kit):
|
||||
|
||||
- `packages/docx-engine` — docx parsing → block tree (with `docxIndex` anchors
|
||||
- passthrough), OOXML fragment generation, byte-level paragraph patching.
|
||||
- `packages/docx-engine` — docx parsing → block tree (with `docxIndex`
|
||||
anchors and passthrough), OOXML fragment generation, byte-level paragraph
|
||||
patching.
|
||||
- `packages/pptx-engine` / `packages/pptx-render` — pptx model and rendering.
|
||||
- `packages/file-parse` — text extraction for AI attachments (office formats,
|
||||
text formats).
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Please report suspected vulnerabilities privately via GitHub's
|
||||
[private vulnerability reporting](../../security/advisories/new) on this
|
||||
repository. Do not open public issues for security reports. We aim to
|
||||
[private vulnerability reporting](https://github.com/genspark-ai/genoffice/security/advisories/new)
|
||||
on this repository. Do not open public issues for security reports. We aim to
|
||||
acknowledge reports within 72 hours.
|
||||
|
||||
## Process Security Posture
|
||||
|
||||
@@ -11,7 +11,11 @@ import {
|
||||
} from 'node:fs'
|
||||
import { basename, join } from 'node:path'
|
||||
import { BrowserWindow, Menu, WebContentsView, app, dialog, ipcMain, shell } from 'electron'
|
||||
import { fetchWithSsrfGuard, safeExternalUrl } from '@genoffice/electron-utils'
|
||||
import {
|
||||
fetchWithSsrfGuard,
|
||||
installNavigationGuard,
|
||||
safeExternalUrl,
|
||||
} from '@genoffice/electron-utils'
|
||||
import { createI18n, getUiLang, normalizeLang, setUiLang } from '@genoffice/i18n'
|
||||
import { ProjectStore } from '@genoffice/project-store'
|
||||
import type {
|
||||
@@ -3399,6 +3403,7 @@ export function hasDocsWindow(): boolean {
|
||||
// ---- standalone lifecycle (apps/docs running on its own) ----
|
||||
|
||||
export function startDocsStandalone(): void {
|
||||
installNavigationGuard(app)
|
||||
// dev runs must not share the packaged app's userData (recent files, AI settings)
|
||||
// or its single-instance lock — otherwise `npm run dev` silently quits whenever
|
||||
// the installed GenOffice Docs is open and forwards its argv there instead.
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data: blob:; worker-src 'self' blob:; connect-src 'self' ws://localhost:*"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>GenOffice Docs</title>
|
||||
</head>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { readFile, rename, writeFile } from 'node:fs/promises'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { BrowserWindow, WebContentsView, app, dialog, ipcMain, shell } from 'electron'
|
||||
import type { WebContents } from 'electron'
|
||||
import { safeExternalUrl } from '@genoffice/electron-utils'
|
||||
import { installNavigationGuard, safeExternalUrl } from '@genoffice/electron-utils'
|
||||
import { createI18n, getUiLang } from '@genoffice/i18n'
|
||||
import { PDF_CHANNELS } from '../shared/ipc'
|
||||
import type {
|
||||
@@ -494,6 +494,7 @@ export function createPdfView(openPath?: string | null): WebContentsView {
|
||||
|
||||
/** Standalone window mode: `npm run dev -w @genoffice/pdf`, pdf path passed via argv */
|
||||
export function startPdfStandalone(): void {
|
||||
installNavigationGuard(app)
|
||||
configurePdfRuntime({
|
||||
preloadPath: join(__dirname, '../preload/index.js'),
|
||||
rendererUrl: process.env.ELECTRON_RENDERER_URL,
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<!-- script-src 'wasm-unsafe-eval': pdf.js image codecs (jbig2/openjpeg/qcms) -->
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data: blob:; worker-src 'self' blob:; connect-src 'self' ws://localhost:*"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>GenOffice PDF</title>
|
||||
</head>
|
||||
|
||||
@@ -31,7 +31,7 @@ import type {
|
||||
WebContents,
|
||||
} from 'electron'
|
||||
import { z } from 'zod'
|
||||
import { safeExternalUrl } from '@genoffice/electron-utils'
|
||||
import { installNavigationGuard, safeExternalUrl } from '@genoffice/electron-utils'
|
||||
import { createI18n, getUiLang, type Lang, normalizeLang, setUiLang } from '@genoffice/i18n'
|
||||
import { ProjectStore } from '@genoffice/project-store'
|
||||
|
||||
@@ -2716,6 +2716,7 @@ async function applyMainProcessProxy(): Promise<void> {
|
||||
}
|
||||
|
||||
export function startSheetsStandalone(): void {
|
||||
installNavigationGuard(app)
|
||||
// GENOFFICE_USER_DATA: test drivers point this at a scratch dir so automated
|
||||
// instances get their own userData AND single-instance lock (the lock is scoped
|
||||
// to userData), allowing parallel instances alongside a normal dev run.
|
||||
|
||||
@@ -14,8 +14,27 @@
|
||||
* app-update.yml into the app and in-app auto-update stays disabled.
|
||||
*/
|
||||
|
||||
const { existsSync } = require('node:fs')
|
||||
const { join } = require('node:path')
|
||||
|
||||
const updateUrl = process.env.GENOFFICE_UPDATE_URL
|
||||
|
||||
// The gsk CLI tree below is copied verbatim from node_modules, and the
|
||||
// nested commander path depends on npm's current hoisting layout — fail the
|
||||
// build with a clear message if an install ever changes it, instead of
|
||||
// shipping an installer with a broken gsk runtime.
|
||||
for (const rel of [
|
||||
'../../node_modules/@genspark/cli',
|
||||
'../../node_modules/@genspark/cli/node_modules/commander',
|
||||
'../../node_modules/ws',
|
||||
]) {
|
||||
if (!existsSync(join(__dirname, rel))) {
|
||||
throw new Error(
|
||||
`electron-builder extraResources source missing: ${rel} (npm hoisting changed?)`,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** @type {import('electron-builder').Configuration} */
|
||||
const config = {
|
||||
appId: 'com.genoffice.app',
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
"@genoffice/ai-search": "*",
|
||||
"@genoffice/docs": "*",
|
||||
"@genoffice/docx-engine": "*",
|
||||
"@genoffice/electron-utils": "*",
|
||||
"@genoffice/i18n": "*",
|
||||
"@genoffice/pptx-engine": "*",
|
||||
"@genoffice/pptx-render": "*",
|
||||
|
||||
@@ -28,6 +28,7 @@ import menuXlsxIcon2x from './assets/menu-xlsx@2x.png?asset'
|
||||
import menuPptxIcon1x from './assets/menu-pptx.png?asset'
|
||||
import menuPptxIcon2x from './assets/menu-pptx@2x.png?asset'
|
||||
import { createI18n, isLang, normalizeLang, setUiLang, type Lang } from '@genoffice/i18n'
|
||||
import { installNavigationGuard } from '@genoffice/electron-utils'
|
||||
import { readAppSettings, writeAppSetting } from './app-settings'
|
||||
import { isOnboardingLive } from './onboarding-gate'
|
||||
import { ProjectStore } from '@genoffice/project-store'
|
||||
@@ -1650,6 +1651,7 @@ app.on('second-instance', (_event, argv, _cwd, additionalData) => {
|
||||
if (!file || !openDocumentPath(file)) tabManager?.openHomeTab()
|
||||
})
|
||||
|
||||
installNavigationGuard(app)
|
||||
registerAiIpc()
|
||||
registerProjectIpc()
|
||||
registerDocsIpc()
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data: blob:; worker-src 'self' blob:; connect-src 'self' ws://localhost:*"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>GenOffice</title>
|
||||
</head>
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' ws://localhost:*"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>GenOffice Update</title>
|
||||
<style>
|
||||
@@ -21,8 +25,7 @@
|
||||
body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
font-family:
|
||||
-apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
|
||||
font-family: -apple-system, 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
|
||||
color: var(--text);
|
||||
background: transparent;
|
||||
user-select: none;
|
||||
|
||||
@@ -24,7 +24,7 @@ import { existsSync, mkdirSync } from 'node:fs'
|
||||
import { userInfo } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { gskApiKey, gskSlideGenerate } from '@genoffice/ai-search'
|
||||
import { safeExternalUrl } from '@genoffice/electron-utils'
|
||||
import { installNavigationGuard, safeExternalUrl } from '@genoffice/electron-utils'
|
||||
import { getUiLang, normalizeLang, setUiLang } from '@genoffice/i18n'
|
||||
import { ProjectStore } from '@genoffice/project-store'
|
||||
import {
|
||||
@@ -3859,6 +3859,7 @@ async function applyMainProcessProxy(): Promise<void> {
|
||||
}
|
||||
|
||||
export function startSlidesStandalone(): void {
|
||||
installNavigationGuard(app)
|
||||
// Optional debug switch: enable CDP only in dev with SLIDES_CDP_PORT explicitly set (for
|
||||
// automated testing/troubleshooting); packaged builds (isPackaged) are unaffected.
|
||||
if (!app.isPackaged && process.env.SLIDES_CDP_PORT) {
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<!-- script-src 'wasm-unsafe-eval': harfbuzzjs text shaping; media-src data:/blob:: pptx-embedded audio and video -->
|
||||
<meta
|
||||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data: blob:; media-src 'self' data: blob:; worker-src 'self' blob:; connect-src 'self' ws://localhost:*"
|
||||
/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>GenOffice Slides</title>
|
||||
</head>
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
# GenOffice Enterprise (`ee/`)
|
||||
|
||||
This directory is reserved for future enterprise modules (private
|
||||
deployment, offline license verification — see the M4 roadmap). It is
|
||||
intentionally empty today except for this notice and the license.
|
||||
This directory is reserved for future enterprise modules (for example
|
||||
private deployment and offline license verification). It is intentionally
|
||||
empty today except for this notice and the license.
|
||||
|
||||
## License boundary
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Generated
+3
@@ -12,6 +12,9 @@
|
||||
"apps/*",
|
||||
"packages/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"ws": "^8.21.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"concurrently": "^9.2.4",
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
"dist:mac": "npm run notices && npm run build:all && npm run dist:mac -w @genoffice/shell",
|
||||
"dist:win": "npm run notices && npm run build:all && npm run dist:win -w @genoffice/shell"
|
||||
},
|
||||
"dependencies": {
|
||||
"ws": "^8.21.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"concurrently": "^9.2.4",
|
||||
|
||||
@@ -110,6 +110,11 @@ export async function buildDocx(options: BuildDocxOptions): Promise<Uint8Array>
|
||||
`${XML_DECL}<w:document ${DOC_NS}><w:body>${options.bodyXml}${sectPr}</w:body></w:document>`,
|
||||
)
|
||||
|
||||
// Pin zip entry mtimes (JSZip defaults them to "now") so regenerating the
|
||||
// committed fixtures is byte-deterministic and CI can diff for drift.
|
||||
zip.forEach((_path, entry) => {
|
||||
entry.date = new Date(Date.UTC(2026, 0, 1))
|
||||
})
|
||||
return zip.generateAsync({ type: 'uint8array', compression: 'DEFLATE' })
|
||||
}
|
||||
|
||||
@@ -119,8 +124,7 @@ export const IMAGE_PARAGRAPH_XML =
|
||||
'<pic:pic><pic:blipFill><a:blip r:embed="rId10"/></pic:blipFill></pic:pic>' +
|
||||
'</a:graphicData></a:graphic></wp:inline></w:drawing></w:r></w:p>'
|
||||
|
||||
export const MATH_PARAGRAPH_XML =
|
||||
'<w:p><m:oMath><m:r><m:t>E=mc^2</m:t></m:r></m:oMath></w:p>'
|
||||
export const MATH_PARAGRAPH_XML = '<w:p><m:oMath><m:r><m:t>E=mc^2</m:t></m:r></m:oMath></w:p>'
|
||||
|
||||
export const CHART_PARAGRAPH_XML =
|
||||
'<w:p><w:r><w:drawing><wp:inline><wp:extent cx="5486400" cy="3200400"/>' +
|
||||
@@ -137,9 +141,7 @@ const chartStrCache = (values: string[], f: string) =>
|
||||
const chartNumCache = (values: (number | null)[], f: string) =>
|
||||
`<c:numRef><c:f>${f}</c:f><c:numCache><c:formatCode>General</c:formatCode>` +
|
||||
`<c:ptCount val="${values.length}"/>` +
|
||||
values
|
||||
.map((v, i) => (v === null ? '' : `<c:pt idx="${i}"><c:v>${v}</c:v></c:pt>`))
|
||||
.join('') +
|
||||
values.map((v, i) => (v === null ? '' : `<c:pt idx="${i}"><c:v>${v}</c:v></c:pt>`)).join('') +
|
||||
'</c:numCache></c:numRef>'
|
||||
|
||||
/** bar chart part: title, 2 series over 3 categories, with a gap in series 2 */
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export { installNavigationGuard } from './navigation-guard'
|
||||
export { safeExternalUrl, type SafeExternalUrlOptions } from './safe-external-url'
|
||||
export {
|
||||
fetchWithSsrfGuard,
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/// App-wide navigation lockdown for every webContents in the suite.
|
||||
///
|
||||
/// Every renderer is a local single-page app loaded exactly once via
|
||||
/// loadFile/loadURL (which do not emit will-navigate), so a full-page
|
||||
/// navigation is never part of normal operation — it can only come from
|
||||
/// hostile document content or AI-generated markup. The guard blocks all of
|
||||
/// them except same-URL reloads (used by dev tooling), and installs a
|
||||
/// default-deny window.open handler.
|
||||
///
|
||||
/// Apps that intentionally route window.open links to the system browser
|
||||
/// (docs/slides/pdf via safeExternalUrl) install their own handler on
|
||||
/// specific webContents after creation; that replaces the default-deny
|
||||
/// handler for those contents only.
|
||||
import type { App } from 'electron'
|
||||
|
||||
// Symbol.for: the flag survives multiple bundled copies of this module
|
||||
// (each app bundle ships its own electron-utils, and the shell hosts all of
|
||||
// them in one process).
|
||||
const INSTALLED = Symbol.for('genoffice.navigation-guard-installed')
|
||||
|
||||
export function installNavigationGuard(app: App): void {
|
||||
const holder = app as unknown as Record<symbol, boolean | undefined>
|
||||
if (holder[INSTALLED]) return
|
||||
holder[INSTALLED] = true
|
||||
app.on('web-contents-created', (_event, contents) => {
|
||||
contents.on('will-navigate', (event) => {
|
||||
if (event.url !== contents.getURL()) event.preventDefault()
|
||||
})
|
||||
contents.setWindowOpenHandler(() => ({ action: 'deny' }))
|
||||
})
|
||||
}
|
||||
@@ -6,7 +6,9 @@
|
||||
* Archives a screenshot per document and emits Markdown + JSON reports.
|
||||
*
|
||||
* Usage: node scripts/docs-open-smoke.mjs [--filter substring] [--dir directory] [--timeout ms]
|
||||
* Prereq: npm run build (electron-vite output must match the current code)
|
||||
* Prereq: npm run build (electron-vite output must match the current code).
|
||||
* The default --dir (example/docx) is gitignored and not shipped — supply
|
||||
* your own corpus of .docx files there or point --dir at one.
|
||||
* Output: .task/docs-open-report/report.md / report.json / *.png
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user