mirror of
https://github.com/wekan/wekan.git
synced 2026-12-06 14:59:55 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cf3465b4e | ||
|
|
a691d7bdd5 | ||
|
|
0aea400b27 | ||
|
|
e6edeadc57 | ||
|
|
d8c299d48e | ||
|
|
2428d28338 | ||
|
|
e774aff816 | ||
|
|
0f17b7b00b | ||
|
|
335d0c90b7 | ||
|
|
b4ab00409b | ||
|
|
a371e59995 | ||
|
|
999c178b3e | ||
|
|
a592656118 | ||
|
|
14fd0a6f63 | ||
|
|
91df1c8a6b | ||
|
|
79ecea1e1a | ||
|
|
9165a9f8e2 | ||
|
|
bef927891a | ||
|
|
69cbd5a846 | ||
|
|
fea1134b26 | ||
|
|
3ec1a9f7ea | ||
|
|
fd746df6ce | ||
|
|
a9ce2a628c | ||
|
|
3b6660ea4d | ||
|
|
e26c948455 | ||
|
|
28768b0079 | ||
|
|
9bf4f1ad48 | ||
|
|
1e7fc04784 | ||
|
|
4edacc0199 | ||
|
|
736989b185 | ||
|
|
a9215115f0 | ||
|
|
7425f4ddd7 | ||
|
|
fb85b50a51 | ||
|
|
3c836d16c1 | ||
|
|
f0309a8036 | ||
|
|
f560b3de05 | ||
|
|
5b959ad520 | ||
|
|
2621f7da94 | ||
|
|
b76d5cbbfe | ||
|
|
6b3fa3099d | ||
|
|
27a5174d58 | ||
|
|
bc4603c670 | ||
|
|
3b087c6a48 | ||
|
|
db2797b5b8 | ||
|
|
09092da161 | ||
|
|
8fadcdb711 | ||
|
|
63d6e23acc | ||
|
|
34d5ef5b98 | ||
|
|
7ba10de7ca | ||
|
|
529b56070c | ||
|
|
b901eabbe8 | ||
|
|
2c3c341a24 | ||
|
|
a7b9cb757d | ||
|
|
b85a1b4c3f | ||
|
|
669c999108 | ||
|
|
d4781f7109 | ||
|
|
ede3a6a465 | ||
|
|
2757420911 | ||
|
|
1ad00a9bf4 | ||
|
|
1650585dba | ||
|
|
eaabe86b91 | ||
|
|
e9b5d3b7bd | ||
|
|
d86f2be606 | ||
|
|
ec4b501fc1 | ||
|
|
b02cd66e94 | ||
|
|
8b72c4ad3e | ||
|
|
ffcb88bda2 | ||
|
|
410c90f2e1 | ||
|
|
f7d3e8b76f | ||
|
|
5ac5ebcab2 | ||
|
|
6a2e20d533 | ||
|
|
c557f3f4a7 | ||
|
|
a06ac78eed | ||
|
|
790e908c60 | ||
|
|
3d99f32903 | ||
|
|
48af3c2a6f | ||
|
|
69b84e5bf4 | ||
|
|
a6e34b542f | ||
|
|
07a252412d | ||
|
|
6103a408c1 | ||
|
|
bfa76c0336 | ||
|
|
f903383297 | ||
|
|
8811a8e859 | ||
|
|
53d10dc427 | ||
|
|
7269c2767f | ||
|
|
fb36e4af5f | ||
|
|
a2923a6591 | ||
|
|
3ca49dcbb2 | ||
|
|
0e844410a2 | ||
|
|
a854ce91dc | ||
|
|
ff42e16e37 | ||
|
|
a4cde50edc | ||
|
|
b5415e4d7d | ||
|
|
f0a11a9574 | ||
|
|
3ae484014c | ||
|
|
2a3ebcb9ff | ||
|
|
af7082e359 | ||
|
|
3f36b49079 | ||
|
|
b6ce696029 | ||
|
|
6eca89ae2f | ||
|
|
36179889f9 | ||
|
|
ea8836080d | ||
|
|
1fcdeeb60f | ||
|
|
e7a2a4a583 | ||
|
|
79d1706893 | ||
|
|
802493d76c | ||
|
|
9a09e792a9 | ||
|
|
96d8b7cf3f | ||
|
|
56ad2221a9 | ||
|
|
4c6bb7d36b | ||
|
|
e6db086827 | ||
|
|
9ce539e498 | ||
|
|
5a92400d37 | ||
|
|
fce538085b | ||
|
|
de92f4006f | ||
|
|
a918c65288 | ||
|
|
150f26e6af | ||
|
|
e2329da283 | ||
|
|
ddcd0339c5 | ||
|
|
38ad008f1d | ||
|
|
7b1a65c40a | ||
|
|
c1368dcdd3 | ||
|
|
90c0ec8736 | ||
|
|
8b6d287f66 | ||
|
|
caffa08a55 | ||
|
|
e241d30604 | ||
|
|
b80e496631 | ||
|
|
5561658ac2 | ||
|
|
92b0291bda | ||
|
|
240a87e9cf | ||
|
|
e7545fedda | ||
|
|
744b7fed03 | ||
|
|
ac3f424028 | ||
|
|
4b88117c6b | ||
|
|
06e17c935b | ||
|
|
3522c10d2b |
No files matched your search
+508
-317
@@ -97,6 +97,514 @@ Which databases WeKan supports
|
||||
|
||||
</details>
|
||||
|
||||
# v13.45 2026-12-05 WeKan ® release
|
||||
|
||||
**In short:** Card attachment tiles show previews for **DXF drawings** and
|
||||
**legacy Word, Excel and PowerPoint files**. Previews follow the board's
|
||||
attachment settings and the original file's access rules. The release also
|
||||
updates **DOMPurify** to address a template sanitization advisory.
|
||||
|
||||
This release adds the following new features:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/0f17b7b00bccd237ebaf3598358e427182ba83e0">Show DXF and legacy Office thumbnails on cards</a>. Thanks to SylcoDev and xet7.</summary>
|
||||
|
||||
ASCII DXF tiles show outlines of supported 2D model-space geometry. Legacy
|
||||
Office tiles show the opening Word text, the first rows and columns of the
|
||||
Excel worksheet, or text from the first PowerPoint slide. WeKan caches the
|
||||
WebP previews and shows an extension tile when conversion is unavailable.
|
||||
|
||||
[Issue #6997](https://github.com/wekan/wekan/issues/6997) and
|
||||
[Issue #6996](https://github.com/wekan/wekan/issues/6996).
|
||||
|
||||
</details>
|
||||
|
||||
and fixes the following bugs:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/e6edeadc5759bd4ad1c6ea856efc8f27f7bfd2d6">Separate personal API token lookup and audit digests</a>. Thanks to xet7.</summary>
|
||||
|
||||
The personal API audit groups requests by metadata such as IP address and
|
||||
country. Its grouping key is computed separately from the lookup digest for
|
||||
random bearer tokens, addressing CodeQL alert 621. Existing tokens and stored
|
||||
audit groups retain their keys.
|
||||
|
||||
</details>
|
||||
|
||||
and updates the following dependencies:
|
||||
|
||||
- [Update DOMPurify to 3.5.1](https://github.com/wekan/wekan/commit/2428d2833894ec4b7dd93763e2504632c7419b3d). Fixes [CVE-2026-144292](https://github.com/advisories/GHSA-hrxw-jjj6-2g2j). Thanks to dependabot and xet7.
|
||||
|
||||
# v13.44 2026-12-04 WeKan ® release
|
||||
|
||||
**In short:** Opened cards show thumbnails for PDFs, Word documents, Excel
|
||||
sheets, PowerPoint slides and OpenDocument attachments. IFC building models
|
||||
keep their original extensions when WeKan detects their STEP file format.
|
||||
|
||||
This release adds the following new features:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/14fd0a6f639ed31ebb3c7a55f05431d03b31c1ff">Show document thumbnails on cards</a>. Thanks to SylcoDev and xet7.</summary>
|
||||
|
||||
Card attachment tiles use cached WebP previews for the first PDF or Word page,
|
||||
the first PowerPoint slide and the first Excel worksheet. OpenDocument tiles
|
||||
use the embedded preview when present or render the initial text or cell
|
||||
values. Thumbnails retain attachment permissions and follow the board's
|
||||
attachment preview setting. Unavailable previews show the file extension.
|
||||
|
||||
[Issue #6992](https://github.com/wekan/wekan/issues/6992).
|
||||
|
||||
</details>
|
||||
|
||||
and fixes the following bugs:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/79ecea1e1a34008b7837c796a3a0eb20a6b680a8">Preserve IFC attachment extensions</a>. Thanks to SylcoDev and xet7.</summary>
|
||||
|
||||
WeKan recognizes `.ifc` as a valid extension for STEP-formatted IFC models
|
||||
and preserves the original case. A different detected format can still
|
||||
correct a mislabeled attachment.
|
||||
|
||||
[Issue #6991](https://github.com/wekan/wekan/issues/6991).
|
||||
|
||||
</details>
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
|
||||
# v13.43 2026-12-04 WeKan ® release
|
||||
|
||||
**In short:** CAD and CNC attachments keep their original extensions when file
|
||||
detection identifies only plain text, XML or ZIP. Files such as `flange.nc` and
|
||||
`flange.tap` keep distinct names.
|
||||
|
||||
This release fixes the following bugs:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/4edacc01998b55b8f62ba05a0773f49a187214a7">Preserve custom attachment extensions</a>. Thanks to SylcoDev and xet7.</summary>
|
||||
|
||||
Generic file detection preserves custom extensions such as `.stl`, `.SPF`,
|
||||
`.sym` and `.zzx`. WeKan still corrects misleading executable or script
|
||||
extensions and mismatches with specifically identified formats, such as a PDF
|
||||
named with a `.png` suffix.
|
||||
|
||||
[Issue #6990](https://github.com/wekan/wekan/issues/6990).
|
||||
|
||||
</details>
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
|
||||
# v13.42 2026-12-03 WeKan ® release
|
||||
|
||||
**In short:** The bulk card API now skips cards with invalid parent IDs and
|
||||
continues processing valid cards in the same request. **DOMPurify** has been
|
||||
updated to 3.4.18.
|
||||
|
||||
This release updates the following dependencies:
|
||||
|
||||
- [DOMPurify 3.4.17 → 3.4.18](https://github.com/wekan/wekan/commit/f560b3de0525c3b240b783634b601485f17ceaec) — HTML sanitizer.
|
||||
|
||||
Thanks to dependabot.
|
||||
|
||||
and fixes the following bugs:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/f0309a80366d811d1a841b6bf5db01f7b1dc6ff4">Validate parent IDs in bulk card creation</a>. Thanks to AhmedLukman and xet7.</summary>
|
||||
|
||||
The bulk card endpoint returns an error for each card whose parent ID is a
|
||||
number, boolean, object or array and continues processing the batch. The API
|
||||
regression test checks that invalid cards are skipped and that a valid child
|
||||
is saved with the requested parent.
|
||||
|
||||
[PR #6989](https://github.com/wekan/wekan/pull/6989).
|
||||
|
||||
</details>
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
|
||||
# v13.41 2026-12-03 WeKan ® release
|
||||
|
||||
**In short:** IGES attachments keep their .igs or .iges extension when uploaded.
|
||||
This also applies when file detection reports them as plain text. Board admins
|
||||
can turn due dates red before the deadline. REST list moves between boards
|
||||
honor the requested position and keep moved cards on visible lists.
|
||||
|
||||
This release fixes the following bugs:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/34d5ef5b98d40cb1918e0c08e1936c4fa784dde8">Preserve IGES attachment extensions</a>. Thanks to SylcoDev and xet7.</summary>
|
||||
|
||||
IGES files keep their original names when detected as plain text or model/iges.
|
||||
A specific MIME type can still correct a mislabeled attachment.
|
||||
|
||||
[Issue #6986](https://github.com/wekan/wekan/issues/6986).
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/09092da1612e7b561f169dd8400df9b40f246c4e">Allow due dates to turn red before the deadline</a>. Thanks to MaxWeissenborn and xet7.</summary>
|
||||
|
||||
In Board Settings / Date, set Overdue to a negative number of hours to turn
|
||||
due dates red before they are due. For example, 48 for Due soon and -24 for
|
||||
Overdue show amber during the earlier warning period and red in the final day.
|
||||
|
||||
[Issue #6985](https://github.com/wekan/wekan/issues/6985).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/3b087c6a4813ef138d7c1000ef30f61bd3fc8ecf">Honor the requested list position in cross-board REST moves</a>. Thanks to AhmedLukman.</summary>
|
||||
|
||||
The REST API applies the requested position to both new and existing destination
|
||||
lists. [PR #6987](https://github.com/wekan/wekan/pull/6987).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/6b3fa3099d9a5b3f8e60602f199e8b17d1baaf7b">Skip soft-deleted destinations when moving lists</a>. Thanks to xet7.</summary>
|
||||
|
||||
Moving a list to another board creates a visible destination list when the only
|
||||
matching title is on a soft-deleted list.
|
||||
|
||||
</details>
|
||||
|
||||
# v13.40 2026-12-02 WeKan ® release
|
||||
|
||||
**In short:** Native **WeKan board imports** preserve required list fields
|
||||
and handle **Notion** and **Planka** synchronization metadata. Multiline
|
||||
board labels save correctly. **OpenProject** transfers preserve assignees and
|
||||
milestone dates and budgets. List Sync can write back compatible type
|
||||
changes and budget choices.
|
||||
**Jira** transfers retain description panels and API exports preserve inline
|
||||
formatting. List Sync can also read and update Jira start dates. The
|
||||
**Univention App Center** package starts with the shell-free WeKan image.
|
||||
|
||||
This release fixes the following issues:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/06e17c935b677a055a886ac62b0d5f50788571ef">Preserve required list fields in native WeKan imports</a>. Thanks to xet7.</summary>
|
||||
|
||||
Required dates carry over directly. Custom-field requirements follow the
|
||||
new field IDs on the imported board.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/3522c10d2b0f25e2e2780757f67dfc27528f669b">Check which Notion and Planka Sync data stays out of native imports</a>. Thanks to xet7.</summary>
|
||||
|
||||
Native board imports keep user data and leave behind the synchronization
|
||||
metadata that tracks ownership and write-back on the source board.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/744b7fed03e3693ed47b793207d8c0fa10402569">Save new board labels with the server-side duplicate check</a>. Thanks to xet7.</summary>
|
||||
|
||||
Creating a label from the card popup preserves line breaks in the name.
|
||||
The board label update checks for duplicates on the server.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/240a87e9cf1abf1cfaccdb7ce1adab6f8c3c44cc">Keep Board View help beside its menu when the header wraps</a>. Thanks to xet7.</summary>
|
||||
|
||||
The help button wraps with the Board View menu and follows the language's
|
||||
reading direction.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/90c0ec8736345af9488582f99f12aeffe720a917">Improve Apple Glass Pastel card control contrast</a>. Thanks to xet7.</summary>
|
||||
|
||||
Primary buttons use a darker blue and a softer highlight. The add-reminder
|
||||
icon uses dark blue on a light background.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/7b1a65c40aa44d9d6ea9e388d9e0d7acc9cc5aa0">Export OpenProject work package scheduling fields</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card and list exports send the mapped scheduling duration and non-working
|
||||
day setting when the destination allows them. When both calendar dates are
|
||||
present, OpenProject calculates the duration.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/ddcd0339c5897024f61d90bcc47885567918bc0a">Restore OpenProject automatic scheduling after exporting relationships</a>. Thanks to xet7.</summary>
|
||||
|
||||
WeKan restores automatic scheduling after creating the work packages and
|
||||
their relationships, when the destination accepts the scheduling change.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/150f26e6afc1fd4d07bf676a5e14fc642fe980d4">Export OpenProject status and priority by destination name</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card and list exports match imported status and priority names against the
|
||||
destination's inline allowed values. Unknown or ambiguous values are skipped.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/de92f4006f517843dc14e6e525ba72eeb2f2c668">Preserve the OpenProject work package type in API exports</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card and list exports match the imported work package type by name and
|
||||
check the remaining mapped fields against that type's creation schema.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/5a92400d379163d961d6a96bf5724729fb7fddcc">Preserve three-level Jira Cloud export hierarchies when supported</a>. Thanks to xet7.</summary>
|
||||
|
||||
Jira Cloud exports preserve an epic, its issues and their subtasks when
|
||||
project metadata identifies a single eligible epic type and allows setting
|
||||
the parent on the selected issue type.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/e6db086827b6ae2fb192ae34125b4157029f6230">Preserve deeper Jira Cloud issue hierarchies in exports</a>. Thanks to xet7.</summary>
|
||||
|
||||
Exports include parent levels above epics when project metadata provides a
|
||||
unique creatable type at every level and allows the required parent links.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/56ad2221a9c3cbe93243807781719c51490ba6b5">Resume larger Notion bulk imports without creating partial boards</a>. Thanks to xet7.</summary>
|
||||
|
||||
Notion bulk imports can resume with up to 256 MiB of decoded checkpoint
|
||||
data and 64 MiB after compression and storage encoding. An incomplete
|
||||
import that cannot save a checkpoint reports the size limit.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/9a09e792a932dbae1deefb172786335c8e85a468">Import larger assembled Notion Markdown pages</a>. Thanks to xet7.</summary>
|
||||
|
||||
One-time Notion API imports can assemble and store pages with up to 7 MiB
|
||||
of Markdown. List Sync uses a 5 MiB limit because it also stores the
|
||||
source value for conflict detection.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/79d170689326688128fc6294d2b40334454a1936">Allow up to six MiB of Markdown per Notion List Sync page</a>. Thanks to xet7.</summary>
|
||||
|
||||
Notion List Sync can assemble up to 6 MiB of Markdown per page across
|
||||
runs, with room in the card document for the conflict-detection baseline.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/1fcdeeb60fb17b914be62280f2137ce032fb7577">Resume Notion external rollup verification across List Sync runs</a>. Thanks to xet7.</summary>
|
||||
|
||||
Notion List Sync checkpoints external rollup lookups so a later run can
|
||||
finish verifying dependencies that exceed the 25-page lookup budget.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/36179889f9ea1b790c9ed5ca987dbecf8610fc2b">Preserve Jira Cloud disclosure media during description write-back</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card descriptions display references to Jira media in expandable sections.
|
||||
Text edits can be written back while preserving the original media blocks.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/b6ce696029a95fc3a21fde5aa8c54f2ce6db5c2e">Preserve Jira Data Center code macro options in write-back</a>. Thanks to xet7.</summary>
|
||||
|
||||
Description write-back preserves titles and supported border styles in
|
||||
code and noformat blocks, including blocks inside quotes.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/af7082e359abd80f5172b36118e991e3c5957900">Keep Jira macro language, colors and border width in write-back</a>. Thanks to xet7.</summary>
|
||||
|
||||
Jira Data Center code and noformat blocks retain their language, supported
|
||||
colors and border width when descriptions are written back.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/3ae484014c196858f4fc571abfde1373375b42b6">Export OpenProject story points from mapped card fields</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card and list exports send the mapped story point estimate, including zero,
|
||||
when the destination work package type allows it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/b5415e4d7d4b78fd97480822e9b56ff80b1d6699">Export OpenProject target and observed versions from card labels</a>. Thanks to xet7.</summary>
|
||||
|
||||
With Labels selected, card and list exports match imported version labels
|
||||
against the destination's allowed values. The target version also works
|
||||
with servers that expose only the older single-version field.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/ff42e16e37049a13dcacb92b24fbddd044015f48">Export OpenProject categories and project phases from card labels</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card and list exports match imported category and project phase labels
|
||||
against the destination's allowed values.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/0e844410a27fc1edcd0bba1a6ffd50ccbd76475b">Export OpenProject work package labels from the destination workspace catalog</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card and list exports match imported work package labels by name, including
|
||||
when the destination supplies its allowed labels as a paginated collection.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/a2923a65915dffcb9c7f2f336cdcf254c9a8a7cc">Export multiple OpenProject target versions when the form confirms them</a>. Thanks to xet7.</summary>
|
||||
|
||||
The export saves multiple mapped target versions when the destination's
|
||||
creation form confirms the full selection.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/7269c2767f95e40364c137d6abf0d5afe7f2b26e">Export card assignees to OpenProject</a>. Thanks to xet7.</summary>
|
||||
|
||||
With People selected, a card with one assignee can keep that assignment
|
||||
when exactly one eligible OpenProject user has the matching name.
|
||||
Export anonymization suppresses assignments.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/8811a8e8598f685fdf313fc414af10ef7b772947">Preserve mapped assignees when importing OpenProject work packages</a>. Thanks to xet7.</summary>
|
||||
|
||||
With People selected, mapped OpenProject assignees appear in the WeKan
|
||||
card's assignee field and can be exported back through the API.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/bfa76c03361615c839e7ae26ac0ea63a8620b4c2">Honor the People selection in OpenProject board imports</a>. Thanks to xet7.</summary>
|
||||
|
||||
With People unchecked, imported work packages omit their assignee,
|
||||
responsible person, author and watchers.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/07a252412d7447f7b3133b9442ad86f8c820e6eb">Export OpenProject milestone dates</a>. Thanks to xet7.</summary>
|
||||
|
||||
With Dates and Custom Fields selected, a milestone card's due date becomes
|
||||
the milestone date when the destination type exposes a writable date field.
|
||||
The export reports unsupported milestone fields as skipped.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/69b84e5bf4029d70f704a265a5929dda92ed71eb">Clear synchronized start dates when OpenProject changes to a milestone</a>. Thanks to xet7.</summary>
|
||||
|
||||
With Start Date selected, List Sync clears the old start date when the
|
||||
source work package becomes a milestone. The milestone date syncs as the
|
||||
card's due date when Due Date is selected.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/3d99f32903149a26835426e6b8ba63e74706af58">Write back OpenProject work package type changes from List Sync</a>. Thanks to xet7.</summary>
|
||||
|
||||
With Type and Write Back selected on an unfiltered list, a change to the
|
||||
mapped text field updates the work package type when OpenProject's
|
||||
versioned form confirms the change. The type must keep its milestone
|
||||
or regular work package date fields.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/a06ac78eedb650bc8906ed5673a769570605e38e">Preserve inline formatting in Jira API description exports</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card descriptions retain underlines, subscripts and superscripts when
|
||||
exported to Jira Cloud and Data Center. Data Center exports also preserve
|
||||
citations.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/6a2e20d533563fb9825df951ad08a859b09eb043">Preserve Jira Data Center panels during description write-back</a>. Thanks to xet7.</summary>
|
||||
|
||||
List Sync can write back edits inside a panel while preserving its
|
||||
validated options and nested code or noformat blocks.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/f7d3e8b76fcfde9bea06cb69e0e0089b4dbcf065">Preserve Jira Data Center panels in direct API export</a>. Thanks to xet7.</summary>
|
||||
|
||||
Card descriptions retain their panels and the supported formatting inside
|
||||
them when exported directly to Jira Data Center.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/ffcb88bda267c0661701310e16aa6fd798e25208">Preserve Jira Cloud panels in card descriptions</a>. Thanks to xet7.</summary>
|
||||
|
||||
Imported panels are visible on the card. API export and List Sync can
|
||||
reconstruct their type and supported formatted content.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/b02cd66e94e41b08a5854af4d2b79fa3fb96ad1b">Check checklist refusal audit counts in Playwright</a>. Thanks to xet7.</summary>
|
||||
|
||||
The test waits for the affected user's audit counts for checklist and
|
||||
checklist item refusals.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/d86f2be606345c87d69dcd86d76fdff2e0ae3650">Match OpenProject budgets during API export</a>. Thanks to xet7.</summary>
|
||||
|
||||
With Custom Fields selected, the export matches the card's budget name
|
||||
against the destination project's writable budget choices. Ambiguous or
|
||||
unavailable choices are reported as skipped.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/eaabe86b916c269e9735219270af0f529fadf3d2">Write back OpenProject budget changes in List Sync</a>. Thanks to xet7.</summary>
|
||||
|
||||
With Budget and Write Back selected on an unfiltered list, a change to the
|
||||
mapped field updates or clears the work package budget if its current edit
|
||||
form allows the operation.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/1ad00a9bf45df3e53246e881fc34309d273aac26">Read Jira start dates in List Sync</a>. Thanks to xet7.</summary>
|
||||
|
||||
With Start Date selected, Jira Cloud and Data Center lists can read a
|
||||
uniquely named Start date field. A cleared field removes the card date,
|
||||
while a missing field leaves it in place.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/ede3a6a4653ba620c2e65036ad33dc88387c35c7">Write back Jira start dates in List Sync</a>. Thanks to xet7.</summary>
|
||||
|
||||
With Start Date and Write Back selected, edits or clears can be sent to
|
||||
the mapped Jira date field after checking the field's edit metadata and
|
||||
the most recent source value.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/669c999108058054535fb3d78b2280a0a03c9e2a">Keep Jira List Sync edits when Start date is unavailable</a>. Thanks to xet7.</summary>
|
||||
|
||||
Other fields can still sync when Jira does not allow an edit to the Start
|
||||
date. List Sync reports the skipped date in its write-back warning.
|
||||
|
||||
</details>
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/a7b9cb757d150331270bc5fb5ced483b0dc3beba">Prepare Univention App Center releases for the shell-free WeKan image</a>. Thanks to the Univention App Center team and xet7.</summary>
|
||||
|
||||
Compose starts WeKan with Node after checking the UCS migration marker.
|
||||
The installation hook uses the migration helper bundled in the WeKan
|
||||
image. See the [Compose and installation hook changes](https://github.com/wekan/univention/commit/aa1636b3682c2fbb82b8b332957dc066d5a36a14)
|
||||
in the Univention repository.
|
||||
|
||||
</details>
|
||||
|
||||
# v13.39 2026-12-02 WeKan ® release
|
||||
|
||||
**In short:** The export menu sends selected WeKan cards to a chosen **Jira**
|
||||
@@ -8516,320 +9024,3 @@ published on their own and excluded; the cards themselves are not changed.
|
||||
</details>
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
|
||||
# v13.16 2026-11-19 WeKan ® release
|
||||
|
||||
**In short:** **ListLockBulkBleed** is fixed, and a list that refuses a role
|
||||
now also refuses that role's bulk writes, dependency lines, rule actions and
|
||||
changes to the list or swimlane itself. Administrators can give chosen users,
|
||||
teams and organizations a smaller WeKan with opt-in **feature profiles**. A
|
||||
server no longer runs out of memory in the hourly **History integrity audit**,
|
||||
**scheduled rules** can create cards again, and **Card Excel export** and
|
||||
clearing a card's text work again.
|
||||
|
||||
This release fixes the following CRITICAL SECURITY ISSUE of [ListLockBulkBleed](https://wekan.fi/hall-of-fame/listlockbulkbleed/):
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/ba3d94390ba724344a2d5cfe50e9dee3cc6f8d89">Bulk REST card writes and server-side card writes ask the list's role exception</a>. Thanks to immanuwell and xet7.</summary>
|
||||
|
||||
[GHSA-83w9-74mx-7v83](https://github.com/wekan/wekan/security/advisories/GHSA-83w9-74mx-7v83),
|
||||
CWE-863. A board admin can refuse a role write access in one list (#4527).
|
||||
`DELETE /api/boards/:boardId/cards/bulk` and
|
||||
`POST /api/boards/:boardId/cards/labels` take their cards from the body, so no
|
||||
URL names a list, and asked only for board write access; the methods
|
||||
`archiveSelectedCards`, `copyCard` and `createLinkedCard` write from server
|
||||
code, past the Cards allow/deny rules. A normal member the list refused could
|
||||
permanently delete its cards in one request, relabel and archive them, and copy
|
||||
or link new cards into it.
|
||||
|
||||
The bulk routes now read every card and ask each list before the first write:
|
||||
any refusal is a 403 and nothing changes, and each removal and relabel is keyed
|
||||
on the list that was checked. The refusal shows in Admin Panel / Problems as
|
||||
ListLockBulkBleed (`authz.list-locked-bulk`, medium, never disables). The
|
||||
methods answer `not-authorized` and are not recorded, because Copy Card and
|
||||
Multi-Selection reach them in ordinary use. The same shape was fixed in twelve
|
||||
more paths: converting a card to a board, adding a subtask,
|
||||
`createCardWithDueDate`, the iCalendar import, sending and receiving board
|
||||
email, creating a version-control issue, moving board objects, History and
|
||||
position-history undo and redo, renaming an attachment, the scoped import and a
|
||||
card's rule button. Dependency lines keep their own board-wide rule.
|
||||
`tests/listLockBulkBleed.test.cjs` runs the gate on the reporter's board and
|
||||
pins every path; `tests/playwright/specs/list-lock-bulk.e2e.js` replays the
|
||||
proof of concept.
|
||||
|
||||
</details>
|
||||
|
||||
and adds the following new feature:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/fc21b0b177dc8f8902efa39d0f89c8b041c7cf2d">Feature profiles hide features from the users, teams and organizations an administrator chooses</a>. Thanks to mimZD and xet7.</summary>
|
||||
|
||||
[#6837](https://github.com/wekan/wekan/issues/6837): Admin Panel / Settings /
|
||||
Visibility / Features gains feature profiles - a name, the optional features it
|
||||
hides, and the users, teams and organizations it applies to. It is strictly
|
||||
opt-in: a user with no profile sees everything, a profile only hides and changes
|
||||
no data or permission, and the member menu tells the user which profile hides
|
||||
how many features, so nothing looks missing. Every place that hides a disabled
|
||||
feature follows it. The new strings are in every language.
|
||||
`tests/featureProfiles.test.cjs` and `feature-profiles.e2e.js` cover it.
|
||||
|
||||
</details>
|
||||
|
||||
and fixes the following bugs:
|
||||
|
||||
**Per-list role exceptions** - what else a list that refuses a role refuses,
|
||||
as decided after ListLockBulkBleed.
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/da6d9d39b8bd209006fc02fe735f1c277a2be693">Dependency lines follow the card's list</a>. Thanks to xet7.</summary>
|
||||
|
||||
A dependency line is stored on its source card, but it followed only the
|
||||
board-wide dependency rule, so a role a list refused could still add, change and
|
||||
remove lines on that list's cards. Now the methods answer `not-authorized`, the
|
||||
REST dependency routes answer 403 recorded as ListLockBleed, and the import
|
||||
skips such lines; board and site admins are not restricted.
|
||||
`tests/listLockDependencies.test.cjs` and `tests/listPermissions.test.cjs` pin
|
||||
it, and `list-lock-bulk.e2e.js` replays it over REST.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/3202a1d7ac1027b41af5a5dfbe03893ccbc89c36">Deleting, archiving or moving a list or swimlane follows the list</a>. Thanks to xet7.</summary>
|
||||
|
||||
These do the same to the cards in them, yet were gated by board write access
|
||||
alone. A list that refuses a role now also refuses that role deleting,
|
||||
restoring, archiving or moving it, and deleting, archiving or moving a swimlane
|
||||
holding its cards - on DDP, REST (403, recorded as ListLockBleed) and client
|
||||
writes alike. The list menu no longer offers its archive actions there.
|
||||
Renaming and reordering stay allowed, and board admins are never restricted.
|
||||
`tests/listLockStructure.test.cjs` pins it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/ee24453dcb5d9ed8af5c07b848cbd5bd8979ae28">A rule action into a refusing list is skipped, and the rest of the rule runs</a>. Thanks to xet7.</summary>
|
||||
|
||||
A rule's move, archive, create-card, copy, link and list actions checked only
|
||||
board write access. Each now asks the lists it writes in as the user who
|
||||
triggered the rule; a refusing list skips that action and shows in Admin Panel /
|
||||
Problems as ListLockRule (detected, low), since a rule meeting a locked list is
|
||||
not an attack. `tests/listLockRules.test.cjs` pins it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/a0f36819610e6d0aa9c170340f8421c1b7fc2bbe">List Sync's rule replay skips such an action too</a>. Thanks to xet7.</summary>
|
||||
|
||||
The journaled List Sync replay still wrote with board write access only. Each of
|
||||
its list-writing runners now decides before saving its command, records a
|
||||
durable skip and lets the rest of the plan run; a replay reads the saved skip,
|
||||
so it never re-decides and never skips a half-finished action.
|
||||
`tests/listSyncRuleListSkip.test.cjs` pins it.
|
||||
|
||||
</details>
|
||||
|
||||
**Server memory and timed jobs** - what runs on its own, every hour.
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/cfd9a62466a64b58d514d46c3c6560f003704523">Swap alone is not high RAM usage, and resource monitors are not named like vulnerabilities</a>. Thanks to xet7.</summary>
|
||||
|
||||
A laptop with many programs open showed "RamBleed, high: high RAM usage started
|
||||
(>= 90%)" at RAM 52% and swap 60%: swap at 25% started a period by itself. Swap
|
||||
now counts only while RAM is also tight, the row says what started it, and only
|
||||
RAM near full is high severity. The RAM, CPU, disk and speed rows are named for
|
||||
what happened (HighRamUsage, HighCpuUsage, HighDiskUsage, SlowRequest) without a
|
||||
CWE, and old rows are renamed at startup. `tests/ramHighTracker.test.cjs` and
|
||||
`tests/resourceStreamNames.test.cjs` cover it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/7459c5bde66ea22966526a7179eede62b5233f0e">The History integrity audit streams each board instead of loading it whole</a>. Thanks to xet7.</summary>
|
||||
|
||||
A production server died twice with "JavaScript heap out of memory", 42 and 74
|
||||
seconds after the hourly History integrity audit started, both times in its
|
||||
first run after a restart. The audit fetched each board's whole History - every
|
||||
row with its full previous and new content - into memory. It now streams each
|
||||
board through a cursor and keeps only hashes and small summaries; the findings
|
||||
are the same, in the same order. `tests/historyIntegrityStreaming.test.cjs`
|
||||
compares both on forked, tampered and orphaned chains and fails if a board is
|
||||
fetched whole.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/f23695cc1bf6447fb38693ea8fe2e1ce4ab51f8f">Scheduled rules act as the board's admin, so a created card has an author</a>. Thanks to xet7.</summary>
|
||||
|
||||
Every run of a scheduled rule with a "create card" action failed with "User ID
|
||||
is required in cards insertAsync". Scheduled rules, auto-archive and attachment
|
||||
retention acted as `board.createdBy`, but boards have no such field, so they ran
|
||||
as nobody. They now act as the board's first active admin
|
||||
(`models/lib/boardActor.js`), and the rule's new card names its author.
|
||||
`tests/boardActor.test.cjs` scans the tree so nothing reads `board.createdBy`
|
||||
again.
|
||||
|
||||
</details>
|
||||
|
||||
**Cards** - exporting a card, and clearing its text.
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/997c6d88ad4c67850831aa99de1f874765c90a41">Card Excel export works with only Description or only Labels selected</a>. Thanks to AhmedLukman and xet7.</summary>
|
||||
|
||||
The card Excel exporter loads the board, list and swimlane only when the
|
||||
selected fields need them, and passes `null` for the rest. The shared card
|
||||
document builder defaulted them with `board = {}`, which applies only to
|
||||
`undefined`, so it read `.title` of `null` and the download ended in "Export
|
||||
failed". The titles are optional now (`board?.title || ''`), which also covers
|
||||
a PDF card export of a card with no swimlane.
|
||||
`tests/cardExportDocument.test.cjs`
|
||||
fails on the old code with that TypeError, and
|
||||
`tests/playwright/specs/card-excel-field-selection.e2e.js` downloads both
|
||||
workbooks from the real route and checks that each holds only its own field.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/c59c751547aa36fabda088eed4cfd7b8ce6b37e4">REST card update can clear a card title</a>. Thanks to AhmedLukman and xet7.</summary>
|
||||
|
||||
`PUT` with `{"title":""}` answered 404 and kept the old title, because the
|
||||
handler read the title by truthiness. An empty title is a value now, a title
|
||||
that is not a string is a 400 before anything is written, and
|
||||
[an update that matches no card](https://github.com/wekan/wekan/commit/79a98822cbe6f1aaa0da0ad2646c7b2cb4fb2726)
|
||||
is a 404 again. `tests/restCardSort.test.cjs` and
|
||||
`tests/playwright/specs/rest-card-title.e2e.js` cover it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/aacb2fd4d68c4873bd01685dceee172c24e48379">A cleared card title or description can be undone and redone</a>. Thanks to AhmedLukman and xet7.</summary>
|
||||
|
||||
Clearing a value is an edit kept in History, not a deletion, so it is
|
||||
restorable whatever Admin Panel / Problems / Delete says. Undo already put the
|
||||
old text back, but redo and Restore of the clearing threw: collection2 removes
|
||||
`''` from `$set` and then refuses the empty modifier. History, the card details,
|
||||
the board description and the REST card update now write `''` as it is, and a
|
||||
REST title of only spaces no longer fails with a 500.
|
||||
`tests/emptyStringClearWrites.test.cjs` and
|
||||
`tests/playwright/specs/card-clear-undo-redo.e2e.js` cover it.
|
||||
|
||||
</details>
|
||||
|
||||
and has the following developer-facing changes:
|
||||
|
||||
**Card Excel export** - the browser test for the fix above.
|
||||
|
||||
- [A Playwright spec drives the card Excel export with one field selected](https://github.com/wekan/wekan/commit/320a3ca8672b6a70867baa0c3f657d3a5eb53536).
|
||||
Thanks to AhmedLukman and xet7.
|
||||
|
||||
**Node test suites** - a sandbox that resolves its helpers.
|
||||
|
||||
- [The attachment cleanup test resolves the Playwright helpers' own requires](https://github.com/wekan/wekan/commit/74dd0b705e21ecb4723dcb8a6055c7edc5aae9aa).
|
||||
Thanks to xet7.
|
||||
|
||||
**WeLite REST API** - the upstream REST specs, run against the native WeLite
|
||||
target as well.
|
||||
|
||||
- [Ownership selection](https://github.com/wekan/wekan/commit/049b628a0310a33026de423a590a6c33489d5b41). Thanks to xet7.
|
||||
- [Card title edits](https://github.com/wekan/wekan/commit/22dae19a64325695a17dd90ea7f4675ffeecfbed). Thanks to xet7.
|
||||
- [Board card sorting](https://github.com/wekan/wekan/commit/5f06b28aef680d2682e7fa4e965a0e797b502214). Thanks to xet7.
|
||||
- [Archive and restore](https://github.com/wekan/wekan/commit/11fc468ff77f9126b97d1eca72de9c2d90314022). Thanks to xet7.
|
||||
- [Subtasks](https://github.com/wekan/wekan/commit/db3f489ab27f672c9d1ab4db5feaf3a116eba928). Thanks to xet7.
|
||||
- [Overtime](https://github.com/wekan/wekan/commit/2033c177ce452f59bc6cb9d3d07a6566169ed015). Thanks to xet7.
|
||||
- [People features](https://github.com/wekan/wekan/commit/72ee1c8b231896586086ac7067ea6dd96135506c). Thanks to xet7.
|
||||
- [User update](https://github.com/wekan/wekan/commit/e4115e68905f4b9a2d521a749a9fe77dde322aa9). Thanks to xet7.
|
||||
- [Checklists](https://github.com/wekan/wekan/commit/ede46c7a9873f20864a77eeda7cb5007762824ff). Thanks to xet7.
|
||||
- [Write-route scope](https://github.com/wekan/wekan/commit/399a8defec10165e1cf7fa18faa5113d5bb7176f). Thanks to xet7.
|
||||
- [Assignment removal](https://github.com/wekan/wekan/commit/8abb9504bb1f714873419f7b481650d758294ef7). Thanks to xet7.
|
||||
- [Dropdown item rename](https://github.com/wekan/wekan/commit/b8fd94a7e70bf65e85b8d06b491e4d3d13e3a9ec). Thanks to xet7.
|
||||
- [Dropdown item deletion](https://github.com/wekan/wekan/commit/f1adc7982eca4aebf8831403f6b4bd219cec51b9). Thanks to xet7.
|
||||
- [Custom-field lifecycle](https://github.com/wekan/wekan/commit/6bf2d53d756e59f494ea50587f62bc467afb7b77). Thanks to xet7.
|
||||
- [Webhook settings](https://github.com/wekan/wekan/commit/f34fee658206ab4d90583f58746067793f10d12a). Thanks to xet7.
|
||||
- [Native Playwright credentials are seeded before an API token is used](https://github.com/wekan/wekan/commit/a9059b7b155aaea4bf9ccb1647a492bab251bb10).
|
||||
Thanks to xet7.
|
||||
|
||||
**WeLite attachments** - the attachment workflows in the native browser.
|
||||
|
||||
- [The upstream card attachment cascade spec](https://github.com/wekan/wekan/commit/26e27f62c4b6b9e2bcd1e10623de7dd3e0b31b5e). Thanks to xet7.
|
||||
- [Attachment rename, and a missing form token is refused](https://github.com/wekan/wekan/commit/7c3b798a1d0ff6e26b6afa8f49c3359a73ba526a). Thanks to xet7.
|
||||
- [Direct attachment removal in Chromium](https://github.com/wekan/wekan/commit/c060c6d2db51b2fc22fab72dadecd90ab173bd8f). Thanks to xet7.
|
||||
- [The Version Control Attachments workflow](https://github.com/wekan/wekan/commit/b6bc2b200ce7545ca43b2f6b3a3ac39874227812). Thanks to xet7.
|
||||
- [The Finnish attachment preview](https://github.com/wekan/wekan/commit/c5344761d856cf5234e5a12ccc61f336c6a9a0e8). Thanks to xet7.
|
||||
- [The cascade spec reuses its browser session](https://github.com/wekan/wekan/commit/bd6b00c5f437237a3cab8bf7d51172d948e45462). Thanks to xet7.
|
||||
- [The attachment browser workflow gets the time it needs](https://github.com/wekan/wekan/commit/333928f123f9dd061042c8b18b0e44663dc76d04). Thanks to xet7.
|
||||
|
||||
**WeLite boards and sessions** - export links and session revocation.
|
||||
|
||||
- [Both export links on the board](https://github.com/wekan/wekan/commit/075e6dbe730291543c8a384ce58429167976741c). Thanks to xet7.
|
||||
- [Revoking one browser session](https://github.com/wekan/wekan/commit/e30c439fa7f4e82bb2f4f949513aa1fcc4287953). Thanks to xet7.
|
||||
|
||||
**WeLite right-to-left captions** - Arabic table captions read in their own
|
||||
direction.
|
||||
|
||||
- [People table captions](https://github.com/wekan/wekan/commit/f1fe22ac16254fa3d7f14df6c09dd3f250c7d61a). Thanks to xet7.
|
||||
- [Regional Arabic People table captions](https://github.com/wekan/wekan/commit/8c1152f23468e76d07c964b5f1358900372c8248). Thanks to xet7.
|
||||
- [Arabic webhook field captions](https://github.com/wekan/wekan/commit/6f7292cffdfb42a7accf4955735bbd8a43d4472a). Thanks to xet7.
|
||||
- [Regional Arabic attachment captions](https://github.com/wekan/wekan/commit/ba9504d6db8dbd2adf8e72b98cb10c991a379cda). Thanks to xet7.
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
|
||||
# v13.15 2026-11-18 WeKan ® release
|
||||
|
||||
**In short:** **RaceBleed** is fixed: deleting a card while somebody moves it
|
||||
to another board no longer destroys its checklists, comments and attachments
|
||||
while the card itself survives there, and a member deleting a card that was
|
||||
just moved keeps their account. REST handlers now answer **404, not 500**, for
|
||||
a swimlane, user or board that is not there.
|
||||
|
||||
This release fixes the following CRITICAL SECURITY ISSUE of [RaceBleed](https://wekan.fi/hall-of-fame/racebleed/):
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/c7a496c9cfd8f30e5bda16515eedeaa2ec80dc65">A card's children are destroyed only for a card whose own removal happened</a>. Thanks to xingmuse and xet7.</summary>
|
||||
|
||||
[GHSA-3vjg-3p4q-8fwh](https://github.com/wekan/wekan/security/advisories/GHSA-3vjg-3p4q-8fwh),
|
||||
CWE-367. The REST card delete looked the card up on the board the caller was
|
||||
authorised for, destroyed its checklists, checklist items, comments,
|
||||
attachments and subcards by card id, and removed the card itself last, keyed
|
||||
on that board and list. A move to another board landing in between left the
|
||||
card alive on a board the deleter cannot read, stripped of every child, with
|
||||
both requests answering 200. Every hooked removal had the same shape:
|
||||
collection-hooks runs `Cards.before.remove`, where the cascade was, and then
|
||||
removes by the caller's original selector - a swimlane, a delete batch, a
|
||||
parent - which a moved card no longer matches. The custom-field link clean-up
|
||||
did the same to the cards linked to it.
|
||||
|
||||
The card document is now the claim (`models/lib/claimedCardRemoval.js`): the
|
||||
single and bulk REST deletes remove the card first and destroy its children
|
||||
only when that removal matched, and the hooked removals cascade from
|
||||
`Cards.after.remove`, only for a card that is really gone. A list deletion
|
||||
removes a card only while it is still in that list, and the REST board move
|
||||
that loses to a delete is a 404 instead of a 500.
|
||||
|
||||
A delete that lost the race, or arrived after the card was moved away from
|
||||
the named board, is refused and shows in Admin Panel / Problems as RaceBleed
|
||||
(`authz.card-delete-race`, medium). It never disables the account: a stale
|
||||
view is not an attack, and PurgeBleed's critical record used to disable a
|
||||
member who deleted a card somebody had just moved.
|
||||
`tests/claimedCardRemoval.test.cjs` replays the reported race and scans
|
||||
`server/` for any cascade before or without the card's removal;
|
||||
`tests/playwright/specs/race-bleed.e2e.js` races twelve moves against
|
||||
deletes and checks that a surviving card always keeps its checklist.
|
||||
|
||||
</details>
|
||||
|
||||
and fixes the following bug:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/baaeea27e3dc6083b5d6a39d5b44a4e6d26ca088">REST API: a handler's not-found error is a 404, not a 500</a>. Thanks to xet7.</summary>
|
||||
|
||||
`httpStatusForError` knew only `NotFound`, while about two hundred throw sites
|
||||
spell it Meteor's way - `not-found`, `board-not-found`, `user-not-found` and
|
||||
the rest. So deleting a missing swimlane, or adding a board member nobody is
|
||||
called, answered 500 "Internal server error" on a real server, though the
|
||||
unit test, which stubs the helper, saw the 404. Any name that is or ends in
|
||||
`not-found` is now a 404 with its message; anything unknown is still a 500
|
||||
carrying no detail. `tests/restNotFoundStatus.test.cjs` runs the real helper
|
||||
and fails on a spelling it would not map.
|
||||
|
||||
</details>
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
+27
-39
@@ -5,56 +5,44 @@ each one changed and the project status are in
|
||||
Written by `node releases/changelog-short.mjs` from CHANGELOG-big.md:
|
||||
make changes there.
|
||||
|
||||
# v13.39 2026-12-02 WeKan ® release
|
||||
# v13.45 2026-12-05 WeKan ® release
|
||||
|
||||
The export menu sends selected WeKan cards to a chosen **Jira**
|
||||
project and issue type, including start and due dates, labels, dependencies and
|
||||
subtasks
|
||||
where Jira supports them. Direct **OpenProject** exports can preserve parent
|
||||
relationships and supported dependencies between exported cards. **Checkboxes**
|
||||
use the same style in Legal Pages, board settings, and other forms. **Planka**
|
||||
List Sync sends new checklists and tasks to Planka and synchronizes edits and
|
||||
deletions in both directions. The **REST API** can update several cards in one
|
||||
request while checking each card’s revision. Administrators can set a default
|
||||
board template per feature profile.
|
||||
Card attachment tiles show previews for **DXF drawings** and
|
||||
**legacy Word, Excel and PowerPoint files**. Previews follow the board's
|
||||
attachment settings and the original file's access rules. The release also
|
||||
updates **DOMPurify** to address a template sanitization advisory.
|
||||
|
||||
[All changes in v13.39](CHANGELOG-big.md#v1339-2026-12-02-wekan--release)
|
||||
[All changes in v13.45](CHANGELOG-big.md#v1345-2026-12-05-wekan--release)
|
||||
|
||||
# v13.38 2026-12-02 WeKan ® release
|
||||
# v13.44 2026-12-04 WeKan ® release
|
||||
|
||||
**Jira**, **OpenProject**, **Redmine**, **Asana**, **ClickUp**
|
||||
and **Linear** imports and List Sync carry more planning details, comments,
|
||||
files and dependencies. **REST** supports board-wide card sync and threaded
|
||||
comments, and hides deleted lists and cards. **History** shows archive and
|
||||
restore statuses, **Docker** checks application and database readiness, and
|
||||
**LDAP** supports ordered fallback servers. **Workload** uses each
|
||||
assignee’s remaining effort. **Auto-archive** keeps recently active subtasks.
|
||||
Opened cards show thumbnails for PDFs, Word documents, Excel
|
||||
sheets, PowerPoint slides and OpenDocument attachments. IFC building models
|
||||
keep their original extensions when WeKan detects their STEP file format.
|
||||
|
||||
[All changes in v13.38](CHANGELOG-big.md#v1338-2026-12-02-wekan--release)
|
||||
[All changes in v13.44](CHANGELOG-big.md#v1344-2026-12-04-wekan--release)
|
||||
|
||||
# v13.37 2026-11-30 WeKan ® release
|
||||
# v13.43 2026-12-04 WeKan ® release
|
||||
|
||||
Jira imports from **Jira Server and Data Center** as formatted
|
||||
text, with its people, watchers, worklogs and attachments, checked against
|
||||
**OpenProject's Jira Migrator**. A list can be synced with **OpenProject**,
|
||||
**Microsoft To Do**, **Google Tasks**, **KanbanFlow**, **Planka** and **Trello**
|
||||
too. The Problems panel shows the latest History integrity check and opens
|
||||
Data health findings for review. Todoist projects can be imported, and
|
||||
their active tasks can sync into a WeKan list.
|
||||
CAD and CNC attachments keep their original extensions when file
|
||||
detection identifies only plain text, XML or ZIP. Files such as `flange.nc` and
|
||||
`flange.tap` keep distinct names.
|
||||
|
||||
[All changes in v13.37](CHANGELOG-big.md#v1337-2026-11-30-wekan--release)
|
||||
[All changes in v13.43](CHANGELOG-big.md#v1343-2026-12-04-wekan--release)
|
||||
|
||||
# v13.36 2026-11-27 WeKan ® release
|
||||
# v13.42 2026-12-03 WeKan ® release
|
||||
|
||||
Filtering a board by **yourself as assignee** now survives a page
|
||||
refresh, as filtering by anybody else already did.
|
||||
The bulk card API now skips cards with invalid parent IDs and
|
||||
continues processing valid cards in the same request. **DOMPurify** has been
|
||||
updated to 3.4.18.
|
||||
|
||||
[All changes in v13.36](CHANGELOG-big.md#v1336-2026-11-27-wekan--release)
|
||||
[All changes in v13.42](CHANGELOG-big.md#v1342-2026-12-03-wekan--release)
|
||||
|
||||
# v13.35 2026-11-27 WeKan ® release
|
||||
# v13.41 2026-12-03 WeKan ® release
|
||||
|
||||
A **due date that is not due soon is grey** again, on the card
|
||||
and the minicard, instead of a yellow that looked almost like the amber of
|
||||
"due soon".
|
||||
IGES attachments keep their .igs or .iges extension when uploaded.
|
||||
This also applies when file detection reports them as plain text. Board admins
|
||||
can turn due dates red before the deadline. REST list moves between boards
|
||||
honor the requested position and keep moved cards on visible lists.
|
||||
|
||||
[All changes in v13.35](CHANGELOG-big.md#v1335-2026-11-27-wekan--release)
|
||||
[All changes in v13.41](CHANGELOG-big.md#v1341-2026-12-03-wekan--release)
|
||||
+1
-1
@@ -62,7 +62,7 @@ FROM --platform=$BUILDPLATFORM debian:trixie AS bundle
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
ARG VERSION=13.39
|
||||
ARG VERSION=13.45
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
COPY --chmod=755 releases/check-telemetry.py /tmp/check-telemetry.py
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928
|
||||
appVersion: "v13.39.0"
|
||||
appVersion: "v13.45.0"
|
||||
files:
|
||||
userUploads:
|
||||
- README.md
|
||||
|
||||
@@ -86,9 +86,11 @@ details; WeKan's are below.
|
||||
WeKan's Card Settings specs toggle them in desktop Chromium and pass; it
|
||||
needs the reporter's details to reproduce - which popup, whether as a board
|
||||
admin, and the browser console's error. The comment's spacing is fixed.)
|
||||
- Run the full Firefox and WebKit Playwright stages with the Docker backend
|
||||
on the host. Native Firefox and WebKit need their own browser sandboxes,
|
||||
which cannot start inside Flatpak.
|
||||
- Finish the full Firefox and WebKit Playwright verification with the Docker
|
||||
backend on the host. The Firefox run on 2026-12-02 reported 4,000 passed,
|
||||
15 failed and 224 skipped. The 15 failures passed targeted reruns after
|
||||
the relevant fixes. A full Firefox run on the updated checkout and the
|
||||
full WebKit results are still pending.
|
||||
|
||||
## Feature requests: Import, Export and Sync with other programs
|
||||
|
||||
@@ -110,28 +112,29 @@ Completed import, export and sync changes are recorded in the
|
||||
- **Other file-only providers** still need API import and Sync using
|
||||
stable external task IDs. See
|
||||
[the API package review](docs/Features/Board-Sidebar/Board-Settings/Import-Export/Sync.md#api-packages-on-npm-checked-2026-11-28).
|
||||
- **Notion** still needs durable resumption for bulk imports above the 64 MiB server
|
||||
checkpoint budget, and support for assembled Markdown above the
|
||||
5 MiB single-page limit, and verification of relation rollups beyond
|
||||
the 25 external page lookups available in one List Sync run when
|
||||
the targets have no verified direct relations anywhere in the source.
|
||||
- **Notion** still needs durable resumption for bulk imports above the 256 MiB decoded
|
||||
or 64 MiB encoded server checkpoint budget, support for List Sync Markdown
|
||||
above 6 MiB per page and one-time imports above 7 MiB.
|
||||
- **Jira Cloud and Data Center** still need additional rich formatting
|
||||
in write-back, including Jira Cloud media inside expandable sections,
|
||||
additional marks, and Data Center macro combinations. More writable
|
||||
in write-back, including other Jira Cloud document structures and Data Center
|
||||
macro combinations. More writable
|
||||
fields in List Sync also remain open.
|
||||
- **More Jira project records**: recover historical commitments that cannot be reconstructed from imported issues,
|
||||
and preserve other project-wide records.
|
||||
- **Export to the service**: the OpenProject export menu creates work
|
||||
packages with their title, optional description, start and due dates,
|
||||
writable work estimates and progress, parent relationships, and supported
|
||||
dependencies between selected cards.
|
||||
dependencies between selected cards. The export can also match one card
|
||||
assignee to an eligible destination user. Responsible and other person
|
||||
fields remain open.
|
||||
The Jira export menu creates issues with a title, optional description,
|
||||
due dates, supported start dates, labels, matching priorities and versions, Jira component assignments,
|
||||
and mapped time estimates in the
|
||||
selected project and issue type.
|
||||
It creates supported dependency links and exports first-level children
|
||||
using the selected Jira subtask type. Support more fields in both services
|
||||
and deeper Jira hierarchies where the target project supports them.
|
||||
using the selected Jira subtask type. Support more fields in both services.
|
||||
Verify the Jira Cloud hierarchy export against a live project with levels
|
||||
above Epic.
|
||||
- **Sync more than a list**: add swimlane and single-card Sync targets,
|
||||
each with Sync Settings and History in its own menu. Support additional
|
||||
custom fields and people mappings.
|
||||
|
||||
@@ -1201,9 +1201,12 @@ function start_spec_test_server(){
|
||||
local writable="$WEKAN_DIR/.tools/test-writable"
|
||||
mkdir -p "$writable/files"
|
||||
export WEKAN_FILES_PATH="$writable/files" WEKAN_FILES_PATH_HOST="$writable/files"
|
||||
# The email specs own a local SMTP listener on this port.
|
||||
export WEKAN_TEST_SMTP_PORT="${WEKAN_TEST_SMTP_PORT:-2525}"
|
||||
echo "==> Starting the WeKan test server on http://localhost:3000 (log: $logdir/wekan-test-server.log)."
|
||||
MONGO_URL="$WEKAN_MONGO_URL" ROOT_URL="http://localhost:3000" PORT=3000 \
|
||||
WRITABLE_PATH="$writable" WITH_API=true \
|
||||
WRITABLE_PATH="$writable" WITH_API=true BROWSER_POLICY_ENABLED=true \
|
||||
MAIL_URL="smtp://127.0.0.1:$WEKAN_TEST_SMTP_PORT" EMAIL_NOTIFICATION_TIMEOUT=100 \
|
||||
LIST_SYNC_ALLOWED_PRIVATE_HOSTS="${LIST_SYNC_ALLOWED_PRIVATE_HOSTS:-127.0.0.1}" \
|
||||
API_IMPORT_ALLOWED_PRIVATE_HOSTS="${API_IMPORT_ALLOWED_PRIVATE_HOSTS:-127.0.0.1}" \
|
||||
DEFAULT_METEOR_REACTIVITY_ORDER="changeStreams,oplog,polling" \
|
||||
@@ -1262,6 +1265,7 @@ function run_playwright_spec(){
|
||||
fi
|
||||
local args=("$spec")
|
||||
[ -n "$grep" ] && args+=(--grep "$grep")
|
||||
local WEKAN_TEST_SMTP_PORT="${WEKAN_TEST_SMTP_PORT:-}"
|
||||
local logdir
|
||||
logdir="$(log_directory test-playwright-spec)" || return $?
|
||||
mkdir -p "$logdir"; logdir="$(cd "$logdir" && pwd)"
|
||||
@@ -3408,7 +3412,7 @@ for _once in 1; do
|
||||
#---------------------------------------------------------------------
|
||||
# Logging of terminal output to console and to .tools/log/wekan-log.log at end of this line: 2>&1 | tee "$(one_log dev-server)"
|
||||
#WARN_WHEN_USING_OLD_API=true NODE_OPTIONS="--trace-warnings"
|
||||
DEFAULT_METEOR_REACTIVITY_ORDER="changeStreams,oplog,polling" DDP_TRANSPORT=sockjs DEBUG="${DEBUG:-false}" WRITABLE_PATH=.. WITH_API=true ROOT_URL=http://localhost:3000 "${DEV_COMMAND[@]}" --port 3000 2>&1 | tee "$(one_log dev-server)"
|
||||
DEFAULT_METEOR_REACTIVITY_ORDER="changeStreams,oplog,polling" DDP_TRANSPORT=sockjs DEBUG="${DEBUG:-false}" WRITABLE_PATH=.. WITH_API=true BROWSER_POLICY_ENABLED="${BROWSER_POLICY_ENABLED:-true}" ROOT_URL=http://localhost:3000 "${DEV_COMMAND[@]}" --port 3000 2>&1 | tee "$(one_log dev-server)"
|
||||
#---------------------------------------------------------------------
|
||||
break
|
||||
;;
|
||||
|
||||
@@ -1424,10 +1424,10 @@ THEME - Apple Glass Pastel
|
||||
.board-color-appleglasspastel input.primary,
|
||||
.board-color-appleglasspastel .sidebar .sidebar-content .sidebar-btn,
|
||||
.board-color-appleglasspastel .selected-calendar-picker button.primary {
|
||||
/* Tinted glass: the blue with a highlight across its upper half. */
|
||||
/* Keep white text readable across the glass highlight. */
|
||||
background:
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 55%),
|
||||
#2563eb;
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.20) 0%, rgba(255, 255, 255, 0) 55%),
|
||||
#1e40af;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
box-shadow:
|
||||
@@ -1442,10 +1442,20 @@ THEME - Apple Glass Pastel
|
||||
.board-color-appleglasspastel button.primary:hover,
|
||||
.board-color-appleglasspastel input.primary:hover,
|
||||
.board-color-appleglasspastel .selected-calendar-picker button.primary:hover {
|
||||
background: #1d4ed8;
|
||||
background: #1e3a8a;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.board-color-appleglasspastel .card-details button.js-reminder-date.add-label {
|
||||
background: #dbeafe;
|
||||
}
|
||||
.board-color-appleglasspastel .card-details button.js-reminder-date.add-label:hover {
|
||||
background: #bfdbfe;
|
||||
}
|
||||
.board-color-appleglasspastel .card-details button.js-reminder-date.add-label .fa {
|
||||
color: #1e3a8a;
|
||||
}
|
||||
|
||||
.board-color-appleglasspastel input[type="email"],
|
||||
.board-color-appleglasspastel input[type="password"],
|
||||
.board-color-appleglasspastel input[type="text"],
|
||||
|
||||
@@ -347,22 +347,23 @@ template(name="boardViewMenu")
|
||||
cannot be read without hovering - so the button says which view is on.
|
||||
The bar wraps to a second row when it runs out of width, which is what
|
||||
makes a word beside the icon affordable. docs/Features/Header-Bar/Header.md
|
||||
a.board-header-btn.js-toggle-board-view(title="{{boardViewName}}")
|
||||
i.fa.fa-caret-down
|
||||
if $eq boardView 'board-view-swimlanes'
|
||||
i.fa.fa-th-large
|
||||
if $eq boardView 'board-view-lists'
|
||||
i.fa.fa-trello
|
||||
if $eq boardView 'board-view-cal'
|
||||
i.fa.fa-calendar
|
||||
if $eq boardView 'board-view-calendar-mode'
|
||||
i.fa.fa-calendar-check-o
|
||||
if $eq boardView 'board-view-gantt'
|
||||
i.fa.fa-bar-chart
|
||||
if $eq boardView 'board-view-table'
|
||||
i.fa.fa-table
|
||||
if $eq boardView 'board-view-stats'
|
||||
i.fa.fa-pie-chart
|
||||
span.board-header-btn-label= boardViewName
|
||||
//- The open view's ? (featureHelp.jade), after the menu that names it.
|
||||
+featureHelp(id=boardViewHelp)
|
||||
.board-view-controls
|
||||
a.board-header-btn.js-toggle-board-view(title="{{boardViewName}}")
|
||||
i.fa.fa-caret-down
|
||||
if $eq boardView 'board-view-swimlanes'
|
||||
i.fa.fa-th-large
|
||||
if $eq boardView 'board-view-lists'
|
||||
i.fa.fa-trello
|
||||
if $eq boardView 'board-view-cal'
|
||||
i.fa.fa-calendar
|
||||
if $eq boardView 'board-view-calendar-mode'
|
||||
i.fa.fa-calendar-check-o
|
||||
if $eq boardView 'board-view-gantt'
|
||||
i.fa.fa-bar-chart
|
||||
if $eq boardView 'board-view-table'
|
||||
i.fa.fa-table
|
||||
if $eq boardView 'board-view-stats'
|
||||
i.fa.fa-pie-chart
|
||||
span.board-header-btn-label= boardViewName
|
||||
//- The open view's ? (featureHelp.jade), after the menu that names it.
|
||||
+featureHelp(id=boardViewHelp)
|
||||
@@ -66,6 +66,10 @@ video.attachment-thumbnail {
|
||||
object-position: center;
|
||||
background: transparent;
|
||||
}
|
||||
.attachment-document-thumbnail[hidden],
|
||||
.attachment-document-fallback[hidden] {
|
||||
display: none;
|
||||
}
|
||||
/* My Attachments (client/components/main/myAttachments.jade) uses the same
|
||||
classes on a plain div; it keeps its previous sizing. */
|
||||
div.attachment-thumbnail-container {
|
||||
|
||||
@@ -108,7 +108,10 @@ template(name="attachmentGallery")
|
||||
i.fa.fa-file-o(aria-hidden="true")
|
||||
span.attachment-thumbnail-ext= extension
|
||||
else if link
|
||||
if(isImage)
|
||||
if documentThumbnailUrl this
|
||||
img.attachment-thumbnail.attachment-document-thumbnail(src="{{documentThumbnailUrl this}}" title="{{cleanFilename name}}" alt="" loading="lazy")
|
||||
span.attachment-thumbnail-text.attachment-document-fallback(hidden)= extension
|
||||
else if isImage
|
||||
img.attachment-thumbnail(src="{{attachmentPreviewUrl this}}" title="{{cleanFilename name}}" alt="{{cleanFilename name}}" loading="lazy")
|
||||
else if($eq extension 'svg')
|
||||
img.attachment-thumbnail(src="{{link}}" title="{{cleanFilename name}}" alt="{{cleanFilename name}}" type="image/svg+xml")
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import '/client/components/cards/attachments.jade';
|
||||
import { attachmentKind, attachmentRichKind, attachmentCodeLanguage, attachmentCanPreview } from '/models/lib/attachmentKind';
|
||||
import { generateUniversalAttachmentUrl } from '/models/lib/universalUrlGenerator';
|
||||
import { canThumbnail, thumbnailUrl } from '/models/lib/attachmentThumbnail';
|
||||
import { canThumbnail, documentThumbnailKind, thumbnailUrl } from '/models/lib/attachmentThumbnail';
|
||||
import { liveAttachments } from '/models/lib/attachmentSoftDelete';
|
||||
import DOMPurify from 'dompurify';
|
||||
import { sanitizeHTML } from '/imports/lib/secureDOMPurify';
|
||||
@@ -488,6 +488,12 @@ Template.registerHelper('attachmentPreviewUrl', attachmentPreviewUrl);
|
||||
// cover and the open-card cover (error events do not bubble).
|
||||
export function previewFallback(img) {
|
||||
if (!img || img.dataset.previewFellBack === '1') return;
|
||||
if (img.classList?.contains('attachment-document-thumbnail')) {
|
||||
img.hidden = true;
|
||||
const fallback = img.nextElementSibling;
|
||||
if (fallback) fallback.hidden = false;
|
||||
return;
|
||||
}
|
||||
const src = img.getAttribute('src') || '';
|
||||
const original = src.replace(/\/thumbnail(?=\?|$)/, '');
|
||||
if (!original || original === src) return;
|
||||
@@ -519,6 +525,10 @@ Template.attachmentGallery.onCreated(function () {
|
||||
});
|
||||
|
||||
Template.attachmentGallery.helpers({
|
||||
documentThumbnailUrl(file) {
|
||||
return file?._id && documentThumbnailKind(file)
|
||||
? thumbnailUrl(generateUniversalAttachmentUrl(file._id)) : '';
|
||||
},
|
||||
// #6870: the "+" button - a card the user may edit, unless uploads are blocked site-wide
|
||||
canAddAttachment() {
|
||||
return Utils.canModifyCard() && !attachmentUploadsBlocked();
|
||||
@@ -530,7 +540,8 @@ Template.attachmentGallery.helpers({
|
||||
const board = ReactiveCache.getBoard(file.meta?.boardId) || Utils.getCurrentBoard();
|
||||
const link = typeof file.link === 'function' ? file.link() : file.link;
|
||||
return attachmentTileCompact({
|
||||
isImage: file.isImage, extension: file.extension, hasLink: !!link,
|
||||
isImage: file.isImage, documentThumbnail: !!documentThumbnailKind(file),
|
||||
extension: file.extension, hasLink: !!link,
|
||||
}, board?.allowsAttachmentPreviewsOnCard);
|
||||
},
|
||||
attachedCards() {
|
||||
|
||||
@@ -1532,6 +1532,12 @@ body.desktop-mode .card-details.card-details-position-pending:not(.card-details-
|
||||
}
|
||||
|
||||
/* Jira Cloud status labels show their text even without a color match. */
|
||||
.card-details div[data-jira-panel] {
|
||||
border-inline-start: 3px solid currentColor;
|
||||
margin-block: 0.75em;
|
||||
padding-inline-start: 0.75em;
|
||||
}
|
||||
|
||||
.card-details span[data-jira-status] {
|
||||
border: 1px solid var(--jira-status-color, currentColor);
|
||||
background-color: color-mix(in srgb, var(--jira-status-color, currentColor) 12%, transparent);
|
||||
|
||||
@@ -219,7 +219,7 @@ Template.cardLabelsPopup.events({
|
||||
|
||||
Template.createLabelPopup.events({
|
||||
// Create the new label
|
||||
'submit .create-label'(event, templateInstance) {
|
||||
async 'submit .create-label'(event, templateInstance) {
|
||||
event.preventDefault();
|
||||
const board = getCardLabelBoard(templateInstance.data);
|
||||
if (!board) {
|
||||
@@ -245,7 +245,7 @@ Template.createLabelPopup.events({
|
||||
}
|
||||
color = color || getFallbackLabelColor();
|
||||
const dueAt = readLabelDueAt(templateInstance);
|
||||
board.addLabel(name, color, dueAt);
|
||||
await board.addLabel(name, color, dueAt);
|
||||
Popup.back();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ template(name="boardDateSettingsPopup")
|
||||
label(for="due-soon-hours") {{_ 'due-soon-hours'}}
|
||||
input#due-soon-hours.js-due-soon-hours(type="number" min="0" max="8784" step="any" value=dueSoonHours disabled=notBoardAdmin)
|
||||
label(for="overdue-after-hours") {{_ 'overdue-after-hours'}}
|
||||
input#overdue-after-hours.js-overdue-after-hours(type="number" min="0" max="8784" step="any" value=overdueAfterHours disabled=notBoardAdmin)
|
||||
input#overdue-after-hours.js-overdue-after-hours(type="number" min="-8784" max="8784" step="any" value=overdueAfterHours disabled=notBoardAdmin)
|
||||
if dueThresholdsError
|
||||
p.error.js-due-thresholds-error {{dueThresholdsError}}
|
||||
unless notBoardAdmin
|
||||
|
||||
@@ -65,9 +65,12 @@
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
|
||||
/* The Board View menu in the header bar: beside the view's button. */
|
||||
.board-header-btn + .feature-help-btn {
|
||||
margin-inline-start: 2px;
|
||||
/* Keep the help button with its menu when the header wraps. */
|
||||
.board-view-controls {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
/* A popup's title bar places its maximize and close buttons absolutely at its
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* - otherwise => 'completed'
|
||||
* - Otherwise, compare the due date against "now", with the board's
|
||||
* thresholds (#6947, models/lib/dueDateThresholds.js dueThresholdsOf):
|
||||
* - more than overdueAfterHours past the due date => 'overdue' (red)
|
||||
* - past the red threshold (negative hours are before due) => 'overdue' (red)
|
||||
* - within soonHours of it, or past it by less => 'due-soon' (amber)
|
||||
* - more than soonHours before it => 'not-due' (grey)
|
||||
* Without thresholds: 48 hours before, and overdue at the due time.
|
||||
@@ -40,9 +40,10 @@ export function dueDateClass(dueDate, now, endDate, thresholds) {
|
||||
|
||||
// No imports here (tests load this file on its own): the thresholds come
|
||||
// checked from dueThresholdsOf, and only a number is taken.
|
||||
const hours = v => (typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : null);
|
||||
const soon = hours(thresholds && thresholds.soonHours);
|
||||
const after = hours(thresholds && thresholds.overdueAfterHours);
|
||||
const hours = (value, minimum) =>
|
||||
typeof value === 'number' && Number.isFinite(value) && value >= minimum && value <= 24 * 366 ? value : null;
|
||||
const soon = hours(thresholds && thresholds.soonHours, 0);
|
||||
const after = hours(thresholds && thresholds.overdueAfterHours, -24 * 366);
|
||||
const soonHours = soon === null ? 48 : soon;
|
||||
const overdueAfterHours = after === null ? 0 : after;
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ mapping when **Labels** is selected.
|
||||
The full-board import page fetches page contents in batches. If the fetch
|
||||
leaves page contents pending, click **Fetch** again on the same page to
|
||||
continue before importing the board. The first page in a batch can supply
|
||||
up to 5 MiB of Markdown across its responses.
|
||||
up to 7 MiB of Markdown across its responses. List Sync uses a 6 MiB
|
||||
limit because it also keeps the source value for conflict detection.
|
||||
|
||||
After reloading the same tab, enter the same Notion token and select the
|
||||
same source and fields to continue. WeKan compresses the checkpoint when
|
||||
@@ -54,8 +55,10 @@ To create several boards at once, select multiple data sources and click
|
||||
contents and reports any missing content through its import report. If a
|
||||
fetch pauses, that source stays available to retry. Repeat the import with the
|
||||
same source, token, and selected fields within one hour to continue from its
|
||||
server checkpoint. Each source checkpoint can hold up to 64 MiB before
|
||||
compression.
|
||||
server checkpoint. Each source checkpoint can hold up to 256 MiB of decoded
|
||||
data and 64 MiB after compression and storage encoding. If an incomplete
|
||||
source exceeds either limit, WeKan reports that it is too large to import
|
||||
and leaves it available for a smaller import.
|
||||
|
||||
When importing into an existing board, choose **Notion (API)** in the
|
||||
destination's import menu. WeKan fetches up to eight batches at a time.
|
||||
@@ -103,8 +106,9 @@ Incomplete rollups preserve existing assignments.
|
||||
|
||||
With **Dependencies** selected, a rollup named **Dependencies** or
|
||||
**Related pages** can supply links to pages in the same or another data
|
||||
source. WeKan verifies up to 25 distinct external target pages per run.
|
||||
Targets already verified through a direct relation use no page lookups,
|
||||
source. WeKan verifies up to 25 new external targets per run. A later run
|
||||
can resume the same verification within one hour using the same list and
|
||||
credentials. Targets already verified through a direct relation use no page lookups,
|
||||
even when that relation appears on another page of the source.
|
||||
An empty or incomplete rollup, or a target that cannot be verified,
|
||||
keeps existing links intact.
|
||||
|
||||
@@ -10,7 +10,7 @@ This is without container (without Docker or Snap).
|
||||
|
||||
Right click and download files 1-4:
|
||||
|
||||
1. [wekan-13.39-win64.zip](https://github.com/wekan/wekan/releases/download/v13.39/wekan-13.39-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
|
||||
1. [wekan-13.45-win64.zip](https://github.com/wekan/wekan/releases/download/v13.45/wekan-13.45-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
|
||||
|
||||
2. [node.exe](https://nodejs.org/dist/latest-v26.x/win-x64/node.exe)
|
||||
|
||||
@@ -22,7 +22,7 @@ Right click and download files 1-4:
|
||||
|
||||
6. Double click `mongodb-windows-x86_64-7.0.34-signed.msi` . In installer, uncheck downloading MongoDB compass.
|
||||
|
||||
7. Unzip `wekan-13.39-win64.zip` , inside it is directory `bundle`, to it copy other files:
|
||||
7. Unzip `wekan-13.45-win64.zip` , inside it is directory `bundle`, to it copy other files:
|
||||
|
||||
```
|
||||
bundle (directory)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Deploy WeKan on your own server with [Appdonia](https://appdonia.com):
|
||||
|
||||
[](https://appdonia.com/self-host/wekan)
|
||||
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="202" height="40" viewBox="0 0 202 40" role="img" aria-label="Deploy on Appdonia">
|
||||
<title>Deploy on Appdonia</title>
|
||||
<defs><linearGradient id="g" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#7650D1"/><stop offset="1" stop-color="#5E38B5"/></linearGradient></defs>
|
||||
<rect width="202" height="40" rx="6" fill="url(#g)"/>
|
||||
<rect x="40" y="0" width="1" height="40" fill="#FFFFFF" fill-opacity=".22"/>
|
||||
<rect x="10.00" y="10.00" width="9.2" height="9.2" rx="2.5" fill="#FFFFFF"/><rect x="20.80" y="10.00" width="9.2" height="9.2" rx="2.5" fill="#F0997B"/><rect x="10.00" y="20.80" width="9.2" height="9.2" rx="2.5" fill="#FFFFFF"/><rect x="20.80" y="20.80" width="9.2" height="9.2" rx="2.5" fill="#FFFFFF"/>
|
||||
<path fill="#FFFFFF" d="M54.2 25.07V14.92H57.39Q58.89 14.92 60.04 15.57Q61.2 16.22 61.85 17.36Q62.51 18.51 62.51 20Q62.51 21.48 61.85 22.62Q61.2 23.77 60.04 24.42Q58.89 25.07 57.39 25.07ZM55.88 23.5H57.39Q58.11 23.5 58.73 23.24Q59.35 22.97 59.81 22.49Q60.28 22.01 60.54 21.38Q60.8 20.74 60.8 20Q60.8 19.26 60.54 18.62Q60.28 17.99 59.81 17.51Q59.35 17.03 58.73 16.76Q58.11 16.5 57.39 16.5H55.88ZM67.21 25.25Q66.15 25.25 65.33 24.76Q64.51 24.28 64.04 23.42Q63.57 22.57 63.57 21.45Q63.57 20.33 64.05 19.48Q64.53 18.62 65.36 18.14Q66.19 17.65 67.27 17.65Q68.24 17.65 69.02 18.15Q69.8 18.65 70.26 19.59Q70.71 20.53 70.71 21.84H65.25Q65.32 22.75 65.93 23.27Q66.53 23.8 67.36 23.8Q68.02 23.8 68.46 23.5Q68.9 23.2 69.14 22.72L70.57 23.33Q70.27 23.92 69.8 24.35Q69.33 24.79 68.68 25.02Q68.03 25.25 67.21 25.25ZM65.35 20.6H68.96Q68.92 20.08 68.66 19.74Q68.4 19.39 68.02 19.22Q67.64 19.04 67.22 19.04Q66.82 19.04 66.41 19.21Q65.99 19.38 65.7 19.73Q65.41 20.07 65.35 20.6ZM72.04 27.98V17.82H73.56L73.63 18.93Q74.02 18.32 74.6 17.99Q75.19 17.65 75.95 17.65Q76.94 17.65 77.67 18.12Q78.41 18.59 78.82 19.44Q79.23 20.3 79.23 21.45Q79.23 22.59 78.82 23.45Q78.41 24.31 77.67 24.78Q76.94 25.25 75.95 25.25Q75.2 25.25 74.62 24.92Q74.04 24.59 73.66 24V27.98ZM75.55 23.77Q76.13 23.77 76.58 23.47Q77.03 23.17 77.3 22.65Q77.56 22.13 77.56 21.45Q77.56 20.77 77.3 20.25Q77.05 19.73 76.6 19.43Q76.15 19.14 75.56 19.14Q75.01 19.14 74.58 19.43Q74.14 19.73 73.9 20.25Q73.66 20.77 73.66 21.45Q73.66 22.13 73.9 22.65Q74.14 23.18 74.57 23.47Q75 23.77 75.55 23.77ZM80.62 25.07V14.92H82.24V25.07ZM87.38 25.25Q86.28 25.25 85.44 24.76Q84.6 24.28 84.12 23.42Q83.64 22.57 83.64 21.45Q83.64 20.33 84.11 19.48Q84.58 18.62 85.43 18.14Q86.27 17.65 87.35 17.65Q88.44 17.65 89.28 18.14Q90.13 18.62 90.6 19.48Q91.07 20.33 91.07 21.45Q91.07 22.57 90.6 23.42Q90.13 24.28 89.29 24.76Q88.46 25.25 87.38 25.25ZM87.38 23.76Q87.98 23.76 88.44 23.46Q88.9 23.17 89.16 22.65Q89.42 22.13 89.42 21.45Q89.42 20.77 89.16 20.25Q88.89 19.73 88.42 19.44Q87.95 19.14 87.35 19.14Q86.75 19.14 86.28 19.44Q85.82 19.73 85.55 20.25Q85.29 20.77 85.29 21.45Q85.29 22.13 85.56 22.65Q85.83 23.17 86.3 23.46Q86.77 23.76 87.38 23.76ZM93.33 28.15Q92.98 28.15 92.56 28.02Q92.13 27.88 91.75 27.69L92.35 26.36Q92.63 26.5 92.86 26.58Q93.09 26.65 93.24 26.65Q93.58 26.65 93.82 26.47Q94.07 26.29 94.21 25.94L94.59 25.01L91.39 17.82H93.14L95.36 23.16L97.51 17.82H99.28L95.91 25.85Q95.62 26.54 95.31 27.06Q94.99 27.58 94.53 27.87Q94.07 28.15 93.33 28.15ZM107.08 25.25Q105.99 25.25 105.15 24.76Q104.3 24.28 103.83 23.42Q103.35 22.57 103.35 21.45Q103.35 20.33 103.82 19.48Q104.29 18.62 105.13 18.14Q105.97 17.65 107.05 17.65Q108.15 17.65 108.99 18.14Q109.83 18.62 110.3 19.48Q110.77 20.33 110.77 21.45Q110.77 22.57 110.3 23.42Q109.83 24.28 109 24.76Q108.16 25.25 107.08 25.25ZM107.08 23.76Q107.69 23.76 108.14 23.46Q108.6 23.17 108.86 22.65Q109.13 22.13 109.13 21.45Q109.13 20.77 108.86 20.25Q108.6 19.73 108.13 19.44Q107.66 19.14 107.06 19.14Q106.45 19.14 105.99 19.44Q105.52 19.73 105.26 20.25Q105 20.77 105 21.45Q105 22.13 105.26 22.65Q105.53 23.17 106 23.46Q106.48 23.76 107.08 23.76ZM112.18 25.07V17.82H113.7L113.77 18.85Q114.12 18.27 114.68 17.96Q115.24 17.65 115.96 17.65Q116.82 17.65 117.44 18Q118.06 18.34 118.39 19.08Q118.72 19.81 118.71 20.99V25.07H117.09V21.36Q117.09 20.5 116.89 20.03Q116.69 19.55 116.34 19.36Q115.98 19.17 115.52 19.17Q114.69 19.16 114.24 19.71Q113.79 20.26 113.79 21.29V25.07ZM123.07 25.07 127.13 14.92H128.91L132.96 25.07H131.18L130.19 22.58H125.85L124.86 25.07ZM126.41 21.09H129.62L128.02 17.03ZM134.06 27.98V17.82H135.58L135.65 18.93Q136.03 18.32 136.62 17.99Q137.21 17.65 137.96 17.65Q138.95 17.65 139.69 18.12Q140.43 18.59 140.83 19.44Q141.24 20.3 141.24 21.45Q141.24 22.59 140.83 23.45Q140.43 24.31 139.69 24.78Q138.95 25.25 137.96 25.25Q137.21 25.25 136.64 24.92Q136.06 24.59 135.67 24V27.98ZM137.57 23.77Q138.15 23.77 138.6 23.47Q139.05 23.17 139.31 22.65Q139.57 22.13 139.57 21.45Q139.57 20.77 139.32 20.25Q139.07 19.73 138.62 19.43Q138.17 19.14 137.58 19.14Q137.03 19.14 136.59 19.43Q136.16 19.73 135.92 20.25Q135.67 20.77 135.67 21.45Q135.67 22.13 135.92 22.65Q136.16 23.18 136.59 23.47Q137.01 23.77 137.57 23.77ZM142.71 27.98V17.82H144.24L144.31 18.93Q144.69 18.32 145.28 17.99Q145.86 17.65 146.62 17.65Q147.61 17.65 148.35 18.12Q149.08 18.59 149.49 19.44Q149.9 20.3 149.9 21.45Q149.9 22.59 149.49 23.45Q149.08 24.31 148.35 24.78Q147.61 25.25 146.62 25.25Q145.87 25.25 145.29 24.92Q144.71 24.59 144.33 24V27.98ZM146.22 23.77Q146.81 23.77 147.26 23.47Q147.71 23.17 147.97 22.65Q148.23 22.13 148.23 21.45Q148.23 20.77 147.98 20.25Q147.72 19.73 147.27 19.43Q146.82 19.14 146.24 19.14Q145.68 19.14 145.25 19.43Q144.82 19.73 144.57 20.25Q144.33 20.77 144.33 21.45Q144.33 22.13 144.57 22.65Q144.82 23.18 145.24 23.47Q145.67 23.77 146.22 23.77ZM154.17 25.25Q153.18 25.25 152.45 24.78Q151.71 24.31 151.3 23.45Q150.89 22.59 150.89 21.45Q150.89 20.3 151.3 19.44Q151.71 18.59 152.45 18.12Q153.18 17.65 154.17 17.65Q154.92 17.65 155.5 17.98Q156.09 18.31Line truncated
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.9 KiB |
@@ -0,0 +1,7 @@
|
||||
## Simafri
|
||||
|
||||

|
||||
|
||||
Managed VPS: our step-by-step guide runs WeKan with Docker Compose and MongoDB 7, while Simafri keeps the server updated, monitors it 24/7 and backs it up every night, encrypted.
|
||||
|
||||
https://www.simafri.com/en/guides/self-host-wekan/
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
@@ -12,7 +12,7 @@ export function getSecureDOMPurifyConfig(options = {}) {
|
||||
// Allow common markdown elements including anchor tags
|
||||
ALLOWED_TAGS: ['a', 'p', 'br', 'strong', 'em', 'u', 'cite', 's', 'del', 'strike', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'img', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'hr', 'div', 'span', 'time', 'details', 'summary'],
|
||||
// Allow safe attributes including href for anchor tags
|
||||
ALLOWED_ATTR: ['href', 'title', 'alt', 'src', 'width', 'height', 'target', 'rel', 'datetime', 'data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block'],
|
||||
ALLOWED_ATTR: ['href', 'title', 'alt', 'src', 'width', 'height', 'target', 'rel', 'datetime', 'data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block', 'data-jira-panel'],
|
||||
// Allow safe protocols for links
|
||||
// Plus the custom schemes an administrator listed (#3218, options.urlSchemes
|
||||
// from models/lib/urlSchemeAllowlist.js, which never includes javascript:
|
||||
|
||||
+2
-1
@@ -1676,7 +1676,7 @@ Boards.attachSchema(
|
||||
// #6947: hours before the due date a card is due soon, and after it a
|
||||
// card is overdue (models/lib/dueDateThresholds.js; unset: 48 and 0).
|
||||
dueSoonHours: { type: Number, optional: true, min: 0, max: 24 * 366 },
|
||||
overdueAfterHours: { type: Number, optional: true, min: 0, max: 24 * 366 },
|
||||
overdueAfterHours: { type: Number, optional: true, min: -24 * 366, max: 24 * 366 },
|
||||
dateFormat: { type: String, optional: true, allowedValues: require('/models/lib/dateFormatPolicy').DATE_FORMATS },
|
||||
allowsStartDate: {
|
||||
/**
|
||||
@@ -3022,6 +3022,7 @@ Boards.helpers({
|
||||
},
|
||||
|
||||
async addLabel(name, color, dueAt, { jiraComponent, jiraComponentUserIds } = {}) {
|
||||
if (Meteor.isClient) return Meteor.callAsync('boards.addLabel', this._id, name, color, dueAt);
|
||||
const trimmedName = typeof name === 'string' ? name.trim() : name;
|
||||
if (!this.getLabel(trimmedName, color)) {
|
||||
const _id = Random.id(6);
|
||||
|
||||
@@ -476,6 +476,7 @@ Cards.attachSchema(
|
||||
'syncTodoistOccurrence.date': { type: String },
|
||||
'syncLastSource.reminderDate': { type: String, optional: true },
|
||||
'syncLastSource.startDate': { type: String, optional: true },
|
||||
'syncLastSource.startDateMapping': { type: String, optional: true, max: 28 },
|
||||
'syncLastSource.dueDate': { type: String, optional: true },
|
||||
'syncLastSource.dueComplete': { type: Boolean, optional: true },
|
||||
'syncLastSource.title': { type: String, optional: true },
|
||||
|
||||
@@ -239,7 +239,7 @@ export class KanboardCreator {
|
||||
const sourceListId = this.source === 'deck' && Number.isSafeInteger(task.column_index)
|
||||
? this.listIdsByColumn[task.column_index] : undefined;
|
||||
const swimlaneName = task.swimlane_name || task.swimlane || 'Default';
|
||||
const plan = planImportedTask(task, { members: this.members, allowedColors: CARD_COLORS,
|
||||
const plan = planImportedTask(task, { members: this.members, allowedColors: CARD_COLORS, source: this.source,
|
||||
boardMemberIds: (board.members || []).filter(m => m.isActive !== false).map(m => m.userId) });
|
||||
const cardToCreate = {
|
||||
...plan.card,
|
||||
|
||||
@@ -75,6 +75,28 @@ export async function listCreateIssueTypes(credentials, projectKey, request, inc
|
||||
throw new Error('Jira issue type pagination did not finish');
|
||||
}
|
||||
|
||||
// Create metadata lists the available types, but project metadata supplies
|
||||
// their levels. Intersect the two so an unavailable type cannot be selected.
|
||||
export async function listJiraCloudCreateHierarchy(client, projectKey, createTypes) {
|
||||
if (!client.cloud || !/^[A-Z][A-Z0-9_]{0,99}$/i.test(projectKey)) return [];
|
||||
let project;
|
||||
try {
|
||||
project = await client.get(`/rest/api/3/project/${projectKey}`);
|
||||
} catch (error) {
|
||||
if ([400, 403, 404].includes(error.status)) return [];
|
||||
throw error;
|
||||
}
|
||||
if (typeof project?.key !== 'string' || project.key.toUpperCase() !== projectKey.toUpperCase() || !Array.isArray(project.issueTypes)) return [];
|
||||
const levels = new Map();
|
||||
for (const type of project.issueTypes) {
|
||||
if (typeof type?.id !== 'string' || levels.has(type.id) ||
|
||||
!Number.isSafeInteger(type.hierarchyLevel) || type.hierarchyLevel < -1) return [];
|
||||
levels.set(type.id, type.hierarchyLevel);
|
||||
}
|
||||
return createTypes.filter(type => levels.has(type.id) && Boolean(type.subtask) === (levels.get(type.id) === -1))
|
||||
.map(type => ({ ...type, hierarchyLevel: levels.get(type.id) }));
|
||||
}
|
||||
|
||||
async function issueRecords(get, path, key, options = '') {
|
||||
const rows = [];
|
||||
const seen = new Set();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { isNotionId } from '../notionApiFormat.js';
|
||||
import { isNotionId, MAX_NOTION_IMPORT_MARKDOWN_BYTES } from '../notionApiFormat.js';
|
||||
|
||||
const API = 'https://api.notion.com/v1';
|
||||
const MAX_RESULTS = 10000;
|
||||
@@ -104,7 +104,7 @@ const MAX_BODY_PAGES = 100;
|
||||
const MAX_BODY_BYTES = 4 * 1024 * 1024;
|
||||
// A synced card also stores a source baseline. Keep the assembled value well
|
||||
// below half of MongoDB's document limit even when the baseline repeats it.
|
||||
const MAX_PAGE_BYTES = 5 * 1024 * 1024;
|
||||
const MAX_SYNC_PAGE_BYTES = 6 * 1024 * 1024;
|
||||
|
||||
function unknownBlockReference(url, ids) {
|
||||
// Notion uses hyphenated UUIDs and compact UUIDs in links. Match the
|
||||
@@ -163,7 +163,7 @@ async function recoverPageMarkdown(getMarkdown, id, maxPageBytes, ancestors = []
|
||||
}
|
||||
|
||||
async function readPageBodies(get, pages, after, resume, forSync) {
|
||||
const maxPageBytes = MAX_PAGE_BYTES;
|
||||
const maxPageBytes = forSync ? MAX_SYNC_PAGE_BYTES : MAX_NOTION_IMPORT_MARKDOWN_BYTES;
|
||||
let total = 0;
|
||||
let received = 0;
|
||||
let downloadBudget = MAX_BODY_BYTES;
|
||||
@@ -374,11 +374,11 @@ async function pagePeople(get, page, name, state, isRollup) {
|
||||
return { emails: [...emails], complete };
|
||||
}
|
||||
|
||||
export function fetchForSync(credentials, id, request, fields = ['title', 'description'], after = '', resume) {
|
||||
return fetch(credentials, id, request, fields, { forSync: true, after, resume });
|
||||
export function fetchForSync(credentials, id, request, fields = ['title', 'description'], after = '', resume, rollupResume) {
|
||||
return fetch(credentials, id, request, fields, { forSync: true, after, resume, rollupResume });
|
||||
}
|
||||
|
||||
export async function fetch(credentials, id, request, fields, { forSync = false, after, resume, importBodyAfter } = {}) {
|
||||
export async function fetch(credentials, id, request, fields, { forSync = false, after, resume, rollupResume, importBodyAfter } = {}) {
|
||||
if (!isNotionId(id)) throw new Error('Choose a Notion data source');
|
||||
const get = notionRequest(credentials, request);
|
||||
const source = await get(`data_sources/${id}`);
|
||||
@@ -467,7 +467,10 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
|
||||
}
|
||||
}
|
||||
}
|
||||
const rollupTargets = new Map();
|
||||
const previousRollupTargets = rollupResume?.sourceId === id ? rollupResume.targets : [];
|
||||
const rollupTargets = new Map(previousRollupTargets);
|
||||
let rollupLookups = 0;
|
||||
let rollupDeferred = false;
|
||||
const rollupReads = { rateLimited: false, nextRequestAt: 0 };
|
||||
const statusType = source.properties[status]?.type;
|
||||
const seen = new Set();
|
||||
@@ -492,6 +495,7 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
|
||||
let links = includeRelations && relationsComplete ? await pageRelations(get, row, relations, forSync) : undefined;
|
||||
const checkedRollupSources = new Set();
|
||||
if (links && relationRollups.length) {
|
||||
let complete = true;
|
||||
const ids = new Set(links.relations);
|
||||
const directTargets = new Set(links.crossRelations.map(target => target.pageId));
|
||||
for (const name of relationRollups) {
|
||||
@@ -510,16 +514,22 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
|
||||
continue;
|
||||
}
|
||||
const knownParent = directRollupParents.get(link.id);
|
||||
if (!knownParent && !rollupTargets.has(link.id) && rollupTargets.size < 25) {
|
||||
const target = await getNotionDetail(get, `pages/${link.id}`, rollupReads);
|
||||
const parent = target?.parent?.data_source_id;
|
||||
rollupTargets.set(link.id, target?.object === 'page' && target.id === link.id &&
|
||||
!target.in_trash && !target.archived && isNotionId(parent) ? parent : null);
|
||||
if (!knownParent && !rollupTargets.has(link.id)) {
|
||||
if (rollupLookups < 25 && rollupTargets.size < MAX_RESULTS && !rollupReads.rateLimited) {
|
||||
rollupLookups += 1;
|
||||
const target = await getNotionDetail(get, `pages/${link.id}`, rollupReads);
|
||||
const parent = target?.parent?.data_source_id;
|
||||
if (!rollupReads.rateLimited) {
|
||||
rollupTargets.set(link.id, target?.object === 'page' && target.id === link.id &&
|
||||
!target.in_trash && !target.archived && isNotionId(parent) ? parent : null);
|
||||
}
|
||||
}
|
||||
if (!rollupTargets.has(link.id)) rollupDeferred = true;
|
||||
}
|
||||
const parent = knownParent || rollupTargets.get(link.id);
|
||||
if (!parent || parent === id) {
|
||||
links = undefined;
|
||||
break;
|
||||
complete = false;
|
||||
continue;
|
||||
}
|
||||
checkedRollupSources.add(parent);
|
||||
if (!links.crossRelations.some(target => target.sourceId === parent && target.pageId === link.id)) {
|
||||
@@ -530,7 +540,8 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
|
||||
}
|
||||
if (!links) break;
|
||||
}
|
||||
if (links) links.relations = [...ids];
|
||||
if (links && complete) links.relations = [...ids];
|
||||
else links = undefined;
|
||||
}
|
||||
const formula = props[description]?.formula;
|
||||
const descriptionText = formulaDescription
|
||||
@@ -573,6 +584,10 @@ export async function fetch(credentials, id, request, fields, { forSync = false,
|
||||
const bodyState = fields?.includes('description') || (!forSync && !fields?.length)
|
||||
? await readPageBodies(get, normalized, forSync ? after : importBodyAfter, resume, forSync) : undefined;
|
||||
return {
|
||||
...(rollupDeferred && rollupTargets.size ? { rollupCheckpoint: {
|
||||
sourceId: id, startedAt: rollupResume?.sourceId === id ? rollupResume.startedAt : Date.now(),
|
||||
targets: [...rollupTargets],
|
||||
} } : {}),
|
||||
...(forSync && bodyState ? { nextBodyAfter: bodyState.nextBodyAfter, bodyCheckpoint: bodyState.checkpoint } : {}),
|
||||
...(importBodyAfter !== undefined ? { nextImportBodyAfter: bodyState?.limited ? bodyState.nextBodyAfter : null } : {}),
|
||||
source: {
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
import openProjectDurations from '../openProjectDurations.js';
|
||||
import { openProjectVersionLinks, openProjectEmbeddedVersions, openProjectPlanningLinkId, openProjectChoicePath, openProjectChoiceWeight, openProjectChoiceParent, openProjectChoiceText } from '../openProjectVersions.js';
|
||||
|
||||
const PAGE_SIZE = 100;
|
||||
const MAX_PAGES = 200;
|
||||
|
||||
export function openProjectBudgetLinks(page) {
|
||||
const rows = page?._embedded?.elements;
|
||||
if (page?._type !== 'Collection' || !Array.isArray(rows) || rows.length !== page.total ||
|
||||
rows.length !== page.count || rows.length > 10000) return undefined;
|
||||
const ids = new Set();
|
||||
for (const row of rows) {
|
||||
if (row?._type !== 'Budget' || !Number.isSafeInteger(row.id) || row.id < 1 || ids.has(row.id) ||
|
||||
row._links?.self?.href !== `/api/v3/budgets/${row.id}` ||
|
||||
!openProjectDurations.OPENPROJECT_TEXT_FIELDS.budget.valid(row.subject)) return undefined;
|
||||
ids.add(row.id);
|
||||
}
|
||||
return rows.map(row => ({ title: row.subject, href: row._links.self.href }));
|
||||
}
|
||||
|
||||
export function openProjectApiHeaders(token) {
|
||||
return {
|
||||
Authorization: `Basic ${Buffer.from(`apikey:${token}`).toString('base64')}`,
|
||||
|
||||
@@ -56,7 +56,7 @@ const API_IMPORT_SERVICES = [
|
||||
directExport: {
|
||||
listMethod: 'apiExportListOpenProject',
|
||||
writeMethod: 'apiExportOpenProject',
|
||||
fields: ['description', 'dates', 'custom-fields', 'subtasks', 'dependencies'],
|
||||
fields: ['description', 'dates', 'labels', 'people', 'custom-fields', 'subtasks', 'dependencies'],
|
||||
},
|
||||
fields: [
|
||||
{ name: 'url', label: 'api-import-url', required: true },
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
const { apiImportService } = require('./apiImportServices');
|
||||
|
||||
const SYNC_PROVIDERS = {
|
||||
jira: { writeBack: ['title', 'description', 'due-date', 'scrum-estimate'] },
|
||||
jira: { writeBack: ['title', 'description', 'card-start', 'due-date', 'scrum-estimate'] },
|
||||
github: { name: 'GitHub' },
|
||||
gitlab: { name: 'GitLab', writeBack: [] },
|
||||
gitea: { name: 'Gitea' },
|
||||
forgejo: { name: 'Forgejo' },
|
||||
openproject: { writeBack: ['title', 'description', 'card-start', 'due-date',
|
||||
'sync-original-time', 'sync-remaining-time', 'scrum-estimate'] },
|
||||
'sync-original-time', 'sync-remaining-time', 'scrum-estimate', 'type', 'billing-budget'] },
|
||||
mstodo: { url: 'https://graph.microsoft.com', sign: 'token', writeBack: ['title', 'description', 'due-date', 'card-start'] },
|
||||
googletasks: { url: 'https://tasks.googleapis.com', sign: 'token', writeBack: ['title', 'description', 'due-date'] },
|
||||
todoistapi: { url: 'https://api.todoist.com', sign: 'token', writeBack: ['title', 'description', 'comments'] },
|
||||
@@ -55,7 +55,7 @@ const API_SYNC_SOURCES = Object.fromEntries(SYNC_CAPABLE_SOURCES.filter(type =>
|
||||
|
||||
const ISSUE_CALENDAR_DATE_SOURCES = ['jira', 'openproject', 'redmineapi', 'linearapi'];
|
||||
const CALENDAR_DUE_DATE_SOURCES = [...ISSUE_CALENDAR_DATE_SOURCES, 'googletasks', 'wrikeapi', 'mondayapi'];
|
||||
const CALENDAR_START_DATE_SOURCES = ['openproject', 'redmineapi', 'wrikeapi', 'mondayapi'];
|
||||
const CALENDAR_START_DATE_SOURCES = ['jira', 'openproject', 'redmineapi', 'wrikeapi', 'mondayapi'];
|
||||
const START_DATE_SYNC_SOURCES = [...CALENDAR_START_DATE_SOURCES, 'trellolist', 'clickupapi', 'asana', 'todoistapi', 'mstodo', 'notionapi'];
|
||||
const DUE_DATE_SYNC_SOURCES = [...CALENDAR_DUE_DATE_SOURCES, 'mstodo', 'trellolist', 'planka', 'clickupapi', 'asana', 'todoistapi', 'notionapi'];
|
||||
|
||||
@@ -134,7 +134,7 @@ const { OPENPROJECT_ROLLUP_NAMES, OPENPROJECT_DERIVED_DATES, OPENPROJECT_BOOLEAN
|
||||
function listSyncFields(type) {
|
||||
if (!SYNC_CAPABLE_SOURCES.includes(type)) return [];
|
||||
const planning = SOURCE_PLANNING[type] || [];
|
||||
if (type === 'jira') return ['title', 'description', 'dueDate', 'spentTime', 'estimate',
|
||||
if (type === 'jira') return ['title', 'description', 'dueDate', 'startDate', 'spentTime', 'estimate',
|
||||
'originalEstimate', 'remainingEstimate', 'jiraVotes', 'jiraVoterIdentities', 'jiraHistory', ...planning, 'dependencies', 'subtasks', 'comments', 'labels'];
|
||||
if (type === 'openproject') return ['title', 'description', 'dueDate', 'startDate', 'spentTime', ...planning,
|
||||
'dependencies', 'subtasks', 'comments', 'labels', 'timeEntries', 'openProjectHierarchy', 'originalEstimate', 'remainingEstimate', 'progress',
|
||||
|
||||
@@ -43,10 +43,40 @@ function canThumbnail(attachment) {
|
||||
return name.includes('.') || attachment.extension ? RASTER_EXTENSIONS.has(extension) : false;
|
||||
}
|
||||
|
||||
const DOCUMENT_TYPES = new Map([
|
||||
['doc', 'application/msword'],
|
||||
['xls', 'application/vnd.ms-excel'],
|
||||
['ppt', 'application/vnd.ms-powerpoint'],
|
||||
['dxf', 'application/dxf'],
|
||||
['pdf', 'application/pdf'],
|
||||
['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
||||
['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
||||
['pptx', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
|
||||
['odt', 'application/vnd.oasis.opendocument.text'],
|
||||
['ods', 'application/vnd.oasis.opendocument.spreadsheet'],
|
||||
['odp', 'application/vnd.oasis.opendocument.presentation'],
|
||||
]);
|
||||
|
||||
function documentThumbnailKind(attachment) {
|
||||
if (!attachment) return null;
|
||||
const type = String(attachment.type || attachment.mime || '').toLowerCase().split(';')[0].trim();
|
||||
for (const [kind, mime] of DOCUMENT_TYPES) if (type === mime) return kind;
|
||||
const ext = String(attachment.extension || /\.([^./]+)$/.exec(attachment.name || '')?.[1] || '')
|
||||
.replace(/^\./, '').toLowerCase();
|
||||
if (['image/vnd.dxf', 'image/x-dxf', 'application/x-dxf'].includes(type)) return 'dxf';
|
||||
if (!DOCUMENT_TYPES.has(ext)) return null;
|
||||
if (!type || type === 'application/octet-stream' || type === 'binary/octet-stream'
|
||||
|| (['docx', 'xlsx', 'pptx', 'odt', 'ods', 'odp'].includes(ext) && type === 'application/zip')
|
||||
|| (ext === 'dxf' && type === 'text/plain')
|
||||
|| (['doc', 'xls', 'ppt'].includes(ext)
|
||||
&& ['application/x-ole-storage', 'application/x-cfb', 'application/cdfv2'].includes(type))) return ext;
|
||||
return null;
|
||||
}
|
||||
|
||||
// The thumbnail URL for an attachment URL as built by
|
||||
// models/lib/universalUrlGenerator.js ("<root>/cdn/storage/attachments/<id>").
|
||||
function thumbnailUrl(attachmentUrl) {
|
||||
return attachmentUrl ? `${String(attachmentUrl).replace(/\/+$/, '')}/thumbnail` : '';
|
||||
}
|
||||
|
||||
module.exports = { THUMBNAIL_EDGE, THUMBNAIL_TYPE, isThumbnailPath, canThumbnail, thumbnailUrl };
|
||||
module.exports = { THUMBNAIL_EDGE, THUMBNAIL_TYPE, isThumbnailPath, canThumbnail, documentThumbnailKind, thumbnailUrl };
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
const PREVIEW_EXTENSIONS = new Set(['svg', 'mp3', 'ogg', 'webm', 'mp4']);
|
||||
|
||||
function attachmentHasVisualPreview({ isImage, extension, hasLink } = {}) {
|
||||
function attachmentHasVisualPreview({ isImage, documentThumbnail, extension, hasLink } = {}) {
|
||||
if (!hasLink) return false;
|
||||
if (isImage) return true;
|
||||
if (isImage || documentThumbnail) return true;
|
||||
return PREVIEW_EXTENSIONS.has(String(extension || '').toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
// #6947: when a due date turns "due soon" (amber) and "overdue" (red), per
|
||||
// board - Board Settings / Date. The hours before the due date a card is due
|
||||
// soon (WeKan's 48 until set), and the hours after it a card is overdue (0:
|
||||
// at the due time itself). A value that is not a whole or decimal number of
|
||||
// hours from 0 to a year is no setting, and the default stands.
|
||||
// at the due time itself). Negative overdue hours turn the badge red before
|
||||
// the deadline. Thresholds are bounded to one year.
|
||||
const DEFAULT_DUE_SOON_HOURS = 48;
|
||||
const DEFAULT_OVERDUE_AFTER_HOURS = 0;
|
||||
const MAX_THRESHOLD_HOURS = 24 * 366;
|
||||
|
||||
function validThresholdHours(value) {
|
||||
return typeof value === 'number' && Number.isFinite(value) && value >= 0 && value <= MAX_THRESHOLD_HOURS;
|
||||
function validThresholdHours(value, minimum = 0) {
|
||||
return typeof value === 'number' && Number.isFinite(value) && value >= minimum && value <= MAX_THRESHOLD_HOURS;
|
||||
}
|
||||
|
||||
// The board's thresholds, as dueDateClass takes them.
|
||||
function dueThresholdsOf(board) {
|
||||
return {
|
||||
soonHours: validThresholdHours(board && board.dueSoonHours) ? board.dueSoonHours : DEFAULT_DUE_SOON_HOURS,
|
||||
overdueAfterHours: validThresholdHours(board && board.overdueAfterHours) ? board.overdueAfterHours : DEFAULT_OVERDUE_AFTER_HOURS,
|
||||
overdueAfterHours: validThresholdHours(board && board.overdueAfterHours, -MAX_THRESHOLD_HOURS) ? board.overdueAfterHours : DEFAULT_OVERDUE_AFTER_HOURS,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -53,11 +53,16 @@ function sanitizeTransferValue(input, options = {}) {
|
||||
// Canonical JSON and the Excel transport legitimately carry base64.
|
||||
// Give syntactically-valid base64 a separate cap while retaining a much
|
||||
// smaller limit for attacker-controlled prose/markup.
|
||||
const binaryLimit = value.length > limits.maxString
|
||||
const pathLimit = options.maxStringForPath?.(path);
|
||||
const stringLimit = pathLimit ?? limits.maxString;
|
||||
const binaryLimit = value.length > stringLimit
|
||||
&& /\/(?:file|avatarFile|excelBase64)$/.test(path)
|
||||
&& value.length % 4 === 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value)
|
||||
? limits.maxBinaryString : limits.maxString;
|
||||
if (value.length > binaryLimit) throw boundaryError(`Import/export string limit exceeded at ${path}`, 'limit');
|
||||
? limits.maxBinaryString : stringLimit;
|
||||
if (value.length > binaryLimit ||
|
||||
(pathLimit !== undefined && new TextEncoder().encode(value).byteLength > pathLimit)) {
|
||||
throw boundaryError(`Import/export string limit exceeded at ${path}`, 'limit');
|
||||
}
|
||||
// Avoid running multi-megabyte base64 attachment bodies through DOMPurify,
|
||||
// but do pass every string that can carry active markup, a script URL or
|
||||
// CSS payload through WeKan's established server sanitizer.
|
||||
|
||||
@@ -54,7 +54,12 @@ function pruneOpenProject(doc, wanted) {
|
||||
if (!wanted.has('comments') && details) delete details.activities;
|
||||
if (!wanted.has('attachments') && details) delete details.attachments;
|
||||
if (!wanted.has('dependencies') && details) delete details.relations;
|
||||
if (!wanted.has('people') && details) delete details.watchers;
|
||||
if (!wanted.has('people')) {
|
||||
if (details) delete details.watchers;
|
||||
if (row._links && typeof row._links === 'object') {
|
||||
for (const role of ['assignee', 'responsible', 'author', 'watchers']) delete row._links[role];
|
||||
}
|
||||
}
|
||||
if (!wanted.has('dates')) {
|
||||
for (const key of ['startDate', 'dueDate', 'due_date', 'date', 'createdAt', 'updatedAt', 'spentTime']) delete row[key];
|
||||
if (details) delete details.timeEntries;
|
||||
|
||||
@@ -188,7 +188,7 @@ export function importedChecklists(checklists, members = {}) {
|
||||
// `boardMemberIds` are the new board's members. A source watcher becomes a
|
||||
// card watcher only when mapped to one of them: watching grants no access,
|
||||
// but a watcher outside a private board must not receive its notifications.
|
||||
export function planImportedTask(task, { members = {}, allowedColors = [], boardMemberIds = [], now } = {}) {
|
||||
export function planImportedTask(task, { members = {}, allowedColors = [], boardMemberIds = [], source, now } = {}) {
|
||||
const card = {
|
||||
title: text(task.title) || 'Imported task',
|
||||
description: text(task.description),
|
||||
@@ -236,6 +236,10 @@ export function planImportedTask(task, { members = {}, allowedColors = [], board
|
||||
.filter(key => (typeof key === 'string' && key) || (typeof key === 'number' && Number.isFinite(key)))
|
||||
.map(key => members[key])
|
||||
.filter(Boolean))];
|
||||
if (source === 'openproject' && task.owner_username) {
|
||||
const assigneeId = members[task.owner_username];
|
||||
if (boardMemberIds.includes(assigneeId)) card.assignees = [assigneeId];
|
||||
}
|
||||
const watcherKeys = (Array.isArray(task.watchers) ? task.watchers : [])
|
||||
.filter(key => (typeof key === 'string' && key) || (typeof key === 'number' && Number.isFinite(key)));
|
||||
const watcherIds = [...new Set(watcherKeys.map(key => members[key]).filter(id => id && boardMemberIds.includes(id)))];
|
||||
|
||||
@@ -66,4 +66,61 @@ function gapIsExhausted(sorts) {
|
||||
return false;
|
||||
}
|
||||
|
||||
export { sortsAfter, gapIsExhausted };
|
||||
// Try both sides of the insertion point. Missing ranks sort before all numbers.
|
||||
function listRankWindow(siblings, index, width) {
|
||||
const rightStart = Math.min(index, siblings.length - width);
|
||||
const leftStart = Math.max(0, index - width);
|
||||
for (const start of new Set([rightStart, leftStart])) {
|
||||
const end = start + width;
|
||||
const lower = siblings[start - 1]?.sort;
|
||||
const upper = siblings[end]?.sort;
|
||||
if (end < siblings.length && (!Number.isFinite(upper) || (lower != null && lower >= upper))) continue;
|
||||
const ranks = sortsAfter([upper], lower, width + 1);
|
||||
if (ranks.every(Number.isFinite) && !gapIsExhausted(ranks) &&
|
||||
(lower == null || ranks[0] > lower) && (upper == null || ranks.at(-1) < upper)) {
|
||||
return { start, ranks };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function listPositionUpdates(siblings, position) {
|
||||
const index = Number.isFinite(position)
|
||||
? Math.min(siblings.length, Math.max(0, Math.floor(position)))
|
||||
: siblings.length;
|
||||
let width = 0;
|
||||
let failedWidth = -1;
|
||||
let window = listRankWindow(siblings, index, width);
|
||||
// Grow geometrically so a dense run doesn't require interpolating every width.
|
||||
while (!window) {
|
||||
failedWidth = width;
|
||||
width = Math.min(siblings.length, Math.max(1, width * 2));
|
||||
window = listRankWindow(siblings, index, width);
|
||||
}
|
||||
// Narrow the successful window before issuing any sibling writes.
|
||||
while (width - failedWidth > 1) {
|
||||
const mid = Math.floor((failedWidth + width) / 2);
|
||||
const smaller = listRankWindow(siblings, index, mid);
|
||||
if (smaller) {
|
||||
width = mid;
|
||||
window = smaller;
|
||||
} else {
|
||||
failedWidth = mid;
|
||||
}
|
||||
}
|
||||
|
||||
const { start, ranks } = window;
|
||||
const movingLeft = [];
|
||||
const movingRight = [];
|
||||
for (let i = start; i < start + width; i++) {
|
||||
const list = siblings[i];
|
||||
const sort = ranks[i < index ? i - start : i - start + 1];
|
||||
if (sort === list.sort) continue;
|
||||
const repairs = list.sort != null && sort < list.sort ? movingLeft : movingRight;
|
||||
repairs.push({ list, sort });
|
||||
}
|
||||
// Make room from the outside in so an interrupted repair preserves order.
|
||||
return { sort: ranks[index - start], repairs: movingLeft.concat(movingRight.reverse()) };
|
||||
}
|
||||
|
||||
export { sortsAfter, gapIsExhausted, listPositionUpdates };
|
||||
@@ -1,5 +1,5 @@
|
||||
import { exportDay, planExportDependencies } from './exportFields.js';
|
||||
import { jiraApiClient, listCreateIssueTypes } from './apiImport/jira.js';
|
||||
import { jiraApiClient, listCreateIssueTypes, listJiraCloudCreateHierarchy } from './apiImport/jira.js';
|
||||
import { jiraCloudDescription, jiraDataCenterDescription } from './jiraDescriptionWriteBack.js';
|
||||
import { jiraWikiToMarkdown } from './jiraWikiMarkup.js';
|
||||
import { cardParentIds } from './cardParents.js';
|
||||
@@ -27,7 +27,7 @@ async function availableCreateFields({ cloud, get }, projectKey, issueTypeId, re
|
||||
(Array.isArray(metadata.operations) && metadata.operations.includes('set'));
|
||||
if (optionFields.has(field) && requested.has(field) && canSet && Array.isArray(metadata.allowedValues)) {
|
||||
available.set(field, metadata.allowedValues);
|
||||
} else if (!optionFields.has(field) && field !== 'startDate' && requested.has(field) && (field !== 'timetracking' || canSet)) {
|
||||
} else if (!optionFields.has(field) && field !== 'startDate' && requested.has(field) && (!['timetracking', 'parent'].includes(field) || canSet)) {
|
||||
available.set(field, field);
|
||||
}
|
||||
if (wantsStart && /^customfield_[1-9]\d{0,15}$/.test(field || '') &&
|
||||
@@ -142,23 +142,92 @@ function planJiraSubtasks(cards, subtaskTypeId) {
|
||||
if (parentOf.has(index)) order.add(parentOf.get(index));
|
||||
order.add(index);
|
||||
}
|
||||
return { parentOf, order: [...order],
|
||||
return { parentOf, order: [...order], parents,
|
||||
skippedParents: parentIds.reduce((count, ids) => count + ids.length, 0) - parentOf.size };
|
||||
}
|
||||
|
||||
async function planJiraCloudHierarchy(cards, fallback, levels, issueTypeId, subtaskTypeId, canSetParent) {
|
||||
const typesByLevel = new Map([[-1, [subtaskTypeId]], [0, [issueTypeId]]]);
|
||||
for (const { id, hierarchyLevel } of levels) {
|
||||
if (hierarchyLevel < 1) continue;
|
||||
if (!typesByLevel.has(hierarchyLevel)) typesByLevel.set(hierarchyLevel, []);
|
||||
typesByLevel.get(hierarchyLevel).push(id);
|
||||
}
|
||||
const parentOf = new Map(fallback.parentOf);
|
||||
const sourceParents = new Map(fallback.parents.map(({ index, parent }) => [index, parent]));
|
||||
const roots = new Map();
|
||||
for (const index of sourceParents.keys()) {
|
||||
let root = index;
|
||||
let depth = 0;
|
||||
while (sourceParents.has(root)) {
|
||||
root = sourceParents.get(root);
|
||||
depth += 1;
|
||||
}
|
||||
if (!roots.has(root)) roots.set(root, []);
|
||||
roots.get(root).push({ index, depth });
|
||||
}
|
||||
const types = new Map();
|
||||
for (const [root, descendants] of roots) {
|
||||
const rootLevel = descendants.reduce((max, { depth }) => Math.max(max, depth - 1), 0);
|
||||
if (!rootLevel || rootLevel >= typesByLevel.size) continue;
|
||||
const typeAt = [];
|
||||
for (let level = 0; level <= rootLevel; level += 1) {
|
||||
const candidates = typesByLevel.get(level);
|
||||
if (candidates?.length !== 1 || (level < rootLevel && !await canSetParent(candidates[0]))) break;
|
||||
typeAt.push(candidates[0]);
|
||||
}
|
||||
if (typeAt.length !== rootLevel + 1) continue;
|
||||
types.set(root, typeAt[rootLevel]);
|
||||
for (const { index, depth } of descendants) {
|
||||
parentOf.set(index, sourceParents.get(index));
|
||||
types.set(index, typeAt[rootLevel - depth] || subtaskTypeId);
|
||||
}
|
||||
}
|
||||
if (!types.size) return fallback;
|
||||
const order = new Set();
|
||||
for (const index of cards.keys()) {
|
||||
const ancestors = [];
|
||||
for (let cursor = index; cursor !== undefined && !order.has(cursor); cursor = parentOf.get(cursor)) ancestors.push(cursor);
|
||||
for (const ancestor of ancestors.reverse()) order.add(ancestor);
|
||||
}
|
||||
return { parentOf, types, order: [...order],
|
||||
skippedParents: cards.reduce((count, card) => count + cardParentIds(card).length, 0) - parentOf.size };
|
||||
}
|
||||
|
||||
export async function createJiraIssues(credentials, projectKey, issueTypeId, cards, request, subtaskTypeId) {
|
||||
if (typeof projectKey !== 'string' || !/^[A-Z][A-Z0-9_]{0,99}$/i.test(projectKey)) throw new Error('Choose a Jira project');
|
||||
if (typeof issueTypeId !== 'string' || !/^[1-9]\d{0,15}$/.test(issueTypeId)) throw new Error('Choose a Jira issue type');
|
||||
if (subtaskTypeId && (subtaskTypeId === issueTypeId || !/^[1-9]\d{0,15}$/.test(subtaskTypeId))) {
|
||||
throw new Error('Choose a Jira subtask type');
|
||||
}
|
||||
const { parentOf, order, skippedParents } = planJiraSubtasks(cards, subtaskTypeId);
|
||||
let hierarchy = planJiraSubtasks(cards, subtaskTypeId);
|
||||
const client = jiraApiClient(credentials, request);
|
||||
const { cloud, post } = client;
|
||||
if (hierarchy.parentOf.size) {
|
||||
const createTypes = await listCreateIssueTypes(credentials, projectKey, request, true);
|
||||
if (!createTypes.some(type => type.id === subtaskTypeId && type.subtask)) throw new Error('Choose a Jira subtask type');
|
||||
const children = new Set(hierarchy.parents.map(({ index }) => index));
|
||||
if (cloud && hierarchy.parents.some(({ parent }) => children.has(parent))) {
|
||||
const levels = await listJiraCloudCreateHierarchy(client, projectKey, createTypes);
|
||||
if (levels.some(type => type.id === issueTypeId && type.hierarchyLevel === 0) &&
|
||||
levels.some(type => type.id === subtaskTypeId && type.hierarchyLevel === -1)) {
|
||||
const parentFields = new Map();
|
||||
async function canSetParent(typeId) {
|
||||
if (!parentFields.has(typeId)) {
|
||||
const fields = await availableCreateFields(client, projectKey, typeId, new Set(['parent']));
|
||||
parentFields.set(typeId, fields.has('parent'));
|
||||
}
|
||||
return parentFields.get(typeId);
|
||||
}
|
||||
hierarchy = await planJiraCloudHierarchy(cards, hierarchy, levels, issueTypeId, subtaskTypeId, canSetParent);
|
||||
}
|
||||
}
|
||||
}
|
||||
const { parentOf, order, skippedParents } = hierarchy;
|
||||
const base = `/rest/api/${cloud ? '3' : '2'}`;
|
||||
const requestedByType = new Map();
|
||||
const requests = cards.map(({ cardId, title, description, dueAt, startAt, labelNames, timetracking }, index) => {
|
||||
const typeId = parentOf.has(index) ? subtaskTypeId : issueTypeId;
|
||||
const typeId = hierarchy.types?.get(index) || (parentOf.has(index) ? subtaskTypeId : issueTypeId);
|
||||
if (!requestedByType.has(typeId)) requestedByType.set(typeId, new Set());
|
||||
const requested = requestedByType.get(typeId);
|
||||
const summary = typeof title === 'string' ? title.trim() : '';
|
||||
@@ -201,10 +270,6 @@ export async function createJiraIssues(credentials, projectKey, issueTypeId, car
|
||||
return { cardId, fields, typeId, startDate, selectedOptions, skippedEstimates, names };
|
||||
});
|
||||
|
||||
if (parentOf.size) {
|
||||
const types = await listCreateIssueTypes(credentials, projectKey, request, true);
|
||||
if (!types.some(type => type.id === subtaskTypeId && type.subtask)) throw new Error('Choose a Jira subtask type');
|
||||
}
|
||||
const availableByType = new Map();
|
||||
for (const [typeId, requested] of requestedByType) {
|
||||
availableByType.set(typeId, requested.size
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { jiraAdfDateIso, jiraAdfStatusAttributes, jiraAdfMentionAttributes, jiraAdfMentionFallback, jiraAdfEmojiAttributes, jiraAdfExpandTitle } = require('./jiraWikiMarkup');
|
||||
const { jiraAdfDateIso, jiraAdfStatusAttributes, jiraAdfMentionAttributes, jiraAdfMentionFallback, jiraAdfEmojiAttributes, jiraAdfExpandTitle, jiraAdfExpandMedia, jiraAdfPanelTypes, jiraAdfPanelBlocks, jiraCodeMacroLanguage } = require('./jiraWikiMarkup');
|
||||
const MarkdownItModule = require('markdown-it');
|
||||
const MarkdownIt = MarkdownItModule.default || MarkdownItModule;
|
||||
const parser = new MarkdownIt({ html: true, breaks: true });
|
||||
@@ -32,10 +32,17 @@ function supportedLinkTitle(title) {
|
||||
|
||||
// Replacing a structured description with only its readable text would lose
|
||||
// information from Jira, even when the readable text matches the baseline.
|
||||
function assertEditableAdf(value, inlineCards) {
|
||||
function assertEditableAdf(value, inlineCards, mediaByExpand) {
|
||||
if (value === null) return;
|
||||
if (value?.type !== 'doc' || value.version !== 1 || !Array.isArray(value.content)) unsupported();
|
||||
for (const block of value.content) {
|
||||
if (block?.type === 'panel') {
|
||||
if (!jiraAdfPanelTypes.includes(block.attrs?.panelType) || Object.keys(block.attrs).length !== 1 ||
|
||||
block.marks?.length || !Array.isArray(block.content) || !block.content.length ||
|
||||
block.content.some(child => !jiraAdfPanelBlocks.includes(child?.type))) unsupported();
|
||||
for (const child of block.content) assertEditableBlock(child, inlineCards);
|
||||
continue;
|
||||
}
|
||||
if (block?.type !== 'expand') {
|
||||
assertEditableBlock(block, inlineCards);
|
||||
continue;
|
||||
@@ -44,8 +51,13 @@ function assertEditableAdf(value, inlineCards) {
|
||||
if (!attrs || block.marks?.length || Object.keys(attrs).some(key => key !== 'title') ||
|
||||
(Object.hasOwn(attrs, 'title') && jiraAdfExpandTitle(attrs) === undefined) ||
|
||||
!Array.isArray(block.content) || !block.content.length ||
|
||||
block.content.some(child => !expandBlocks.includes(child?.type))) unsupported();
|
||||
for (const child of block.content) assertEditableBlock(child, inlineCards);
|
||||
block.content.some(child => !expandBlocks.includes(child?.type) && !jiraAdfExpandMedia(child))) unsupported();
|
||||
const media = [];
|
||||
for (const child of block.content) {
|
||||
if (jiraAdfExpandMedia(child)) media.push(child);
|
||||
else assertEditableBlock(child, inlineCards);
|
||||
}
|
||||
mediaByExpand.push(media);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,7 +324,21 @@ function readJiraTableCell(tokens, inlineCards) {
|
||||
return blocks;
|
||||
}
|
||||
|
||||
function markdownToAdf(markdown, { wiki = false, inlineCards } = {}) {
|
||||
function wikiMacroFence(info) {
|
||||
const match = /^([a-z0-9_+.#-]{1,32}) jira-macro:(\S+)$/.exec(info || '');
|
||||
if (!match) return undefined;
|
||||
let options;
|
||||
try {
|
||||
options = decodeURIComponent(match[2]);
|
||||
} catch {
|
||||
unsupported();
|
||||
}
|
||||
const macro = match[1] === 'noformat' ? 'noformat' : 'code';
|
||||
if (jiraCodeMacroLanguage(options, macro) !== match[1] || encodeURIComponent(options) !== match[2]) unsupported();
|
||||
return { language: match[1], wikiMacroOptions: options };
|
||||
}
|
||||
|
||||
function markdownToAdf(markdown, { wiki = false, inlineCards, mediaByExpand = [] } = {}) {
|
||||
if (!markdown.trim()) return null;
|
||||
const tokens = parser.parse(markdown, {});
|
||||
let index = 0;
|
||||
@@ -348,27 +374,67 @@ function markdownToAdf(markdown, { wiki = false, inlineCards } = {}) {
|
||||
return table;
|
||||
}
|
||||
|
||||
function readBlocks(endType, inExpand = false) {
|
||||
let expandIndex = 0;
|
||||
let restoredMedia = 0;
|
||||
function readBlocks(endType, inExpand = false, media = []) {
|
||||
let nextMedia = 0;
|
||||
const content = [];
|
||||
while (index < tokens.length && tokens[index].type !== endType) {
|
||||
const token = tokens[index++];
|
||||
const expand = !wiki && !endType && !inExpand && token.type === 'html_block' &&
|
||||
/^<details data-jira-expand="true">(?:<summary>([^<]*)<\/summary>)?$/.exec(token.content.trim());
|
||||
if (expand) {
|
||||
const panel = wiki && !endType && token.type === 'html_block' &&
|
||||
/^<!-- jira-panel:(\S*) -->$/.exec(token.content.trim());
|
||||
const cloudPanel = !wiki && !endType && !inExpand && token.type === 'html_block' &&
|
||||
/^<div data-jira-panel="([a-z]+)">$/.exec(token.content.trim());
|
||||
if (cloudPanel) {
|
||||
const panelType = cloudPanel[1];
|
||||
if (!jiraAdfPanelTypes.includes(panelType)) unsupported();
|
||||
const body = readBlocks('jira_cloud_panel_close');
|
||||
if (!body.length || body.some(child => !jiraAdfPanelBlocks.includes(child.type))) unsupported();
|
||||
content.push({ type: 'panel', attrs: { panelType }, content: body });
|
||||
} else if (endType === 'jira_cloud_panel_close' && token.type === 'html_block' &&
|
||||
token.content.trim() === '</div>') {
|
||||
return content;
|
||||
} else if (panel) {
|
||||
let options;
|
||||
try {
|
||||
options = decodeURIComponent(panel[1]);
|
||||
} catch {
|
||||
unsupported();
|
||||
}
|
||||
if (encodeURIComponent(options) !== panel[1] ||
|
||||
(options && !jiraCodeMacroLanguage(options, 'noformat'))) unsupported();
|
||||
const body = readBlocks('jira_panel_close');
|
||||
if (!body.length) unsupported();
|
||||
content.push({ type: 'wikiPanel', attrs: { options }, content: body });
|
||||
} else if (endType === 'jira_panel_close' && token.type === 'html_block' &&
|
||||
token.content.trim() === '<!-- /jira-panel -->') {
|
||||
return content;
|
||||
} else if (expand) {
|
||||
const attrs = {};
|
||||
if (expand[1] !== undefined) {
|
||||
attrs.title = expand[1].replace(/&(?:amp|lt|gt);/g, entity => parser.utils.unescapeAll(entity));
|
||||
if (jiraAdfExpandTitle(attrs) === undefined) unsupported();
|
||||
}
|
||||
const body = readBlocks(undefined, true);
|
||||
if (body.some(child => !expandBlocks.includes(child.type))) unsupported();
|
||||
const body = readBlocks(undefined, true, mediaByExpand[expandIndex++] || []);
|
||||
if (body.some(child => !expandBlocks.includes(child.type) && !jiraAdfExpandMedia(child))) unsupported();
|
||||
content.push({ type: 'expand', attrs, content: body.length ? body : [{ type: 'paragraph' }] });
|
||||
} else if (inExpand && token.type === 'html_block' && token.content.trim() === '</details>') {
|
||||
if (nextMedia !== media.length) unsupported();
|
||||
return content;
|
||||
} else if (token.type === 'paragraph_open' || token.type === 'heading_open') {
|
||||
const type = token.type === 'heading_open' ? 'heading' : 'paragraph';
|
||||
const inline = tokens[index++];
|
||||
if (inline?.type !== 'inline' || tokens[index++]?.type !== type + '_close') unsupported();
|
||||
const marker = !wiki && type === 'paragraph' && inline.children?.length === 1 &&
|
||||
inline.children[0].type === 'code_inline' && /^\[Jira media ([1-9]\d*)\]$/.exec(inline.children[0].content);
|
||||
if (marker) {
|
||||
if (!inExpand || Number(marker[1]) !== nextMedia + 1 || !media[nextMedia]) unsupported();
|
||||
content.push(structuredClone(media[nextMedia++]));
|
||||
restoredMedia += 1;
|
||||
continue;
|
||||
}
|
||||
content.push({
|
||||
type,
|
||||
...(type === 'heading' ? { attrs: { level: Number(token.tag.slice(1)) } } : {}),
|
||||
@@ -378,10 +444,11 @@ function markdownToAdf(markdown, { wiki = false, inlineCards } = {}) {
|
||||
content.push({ type: 'paragraph', content: [{ type: 'hardBreak' }] });
|
||||
} else if (token.type === 'fence' || token.type === 'code_block') {
|
||||
const language = token.info?.trim();
|
||||
if (language && !safeLanguage.test(language)) unsupported();
|
||||
const attrs = wiki && wikiMacroFence(language);
|
||||
if (!attrs && language && !safeLanguage.test(language)) unsupported();
|
||||
content.push({
|
||||
type: 'codeBlock',
|
||||
...(language ? { attrs: { language } } : {}),
|
||||
...(language ? { attrs: attrs || { language } } : {}),
|
||||
...(token.content ? { content: [{ type: 'text', text: token.content }] } : {}),
|
||||
});
|
||||
} else if (token.type === 'table_open') {
|
||||
@@ -417,13 +484,16 @@ function markdownToAdf(markdown, { wiki = false, inlineCards } = {}) {
|
||||
if (endType && tokens[index++]?.type !== endType) unsupported();
|
||||
return content;
|
||||
}
|
||||
return { type: 'doc', version: 1, content: readBlocks() };
|
||||
const content = readBlocks();
|
||||
if (restoredMedia !== mediaByExpand.reduce((count, media) => count + media.length, 0)) unsupported();
|
||||
return { type: 'doc', version: 1, content };
|
||||
}
|
||||
|
||||
function jiraCloudDescription(markdown, previous) {
|
||||
const inlineCards = new Map();
|
||||
assertEditableAdf(previous, inlineCards);
|
||||
return markdownToAdf(markdown, { inlineCards });
|
||||
const mediaByExpand = [];
|
||||
assertEditableAdf(previous, inlineCards, mediaByExpand);
|
||||
return markdownToAdf(markdown, { inlineCards, mediaByExpand });
|
||||
}
|
||||
|
||||
function wikiInline(nodes, { table = false } = {}) {
|
||||
@@ -511,6 +581,10 @@ function markdownToWiki(markdown) {
|
||||
}
|
||||
|
||||
function wikiBlock(block) {
|
||||
if (block.type === 'wikiPanel') {
|
||||
const { options } = block.attrs;
|
||||
return `{panel${options ? ':' + options : ''}}\n${block.content.map(wikiBlock).join('\n\n')}\n{panel}`;
|
||||
}
|
||||
if (block.type === 'bulletList' || block.type === 'orderedList') return wikiList(block);
|
||||
if (block.type === 'rule') return '----';
|
||||
if (block.type === 'table') return wikiTable(block);
|
||||
@@ -523,6 +597,12 @@ function wikiBlock(block) {
|
||||
if (block.type === 'codeBlock') {
|
||||
const text = block.content?.[0]?.text || '';
|
||||
const language = block.attrs?.language;
|
||||
const options = block.attrs?.wikiMacroOptions;
|
||||
if (options) {
|
||||
const macro = language === 'noformat' ? 'noformat' : 'code';
|
||||
if (text.includes(`{${macro}}`)) unsupported();
|
||||
return `{${macro}:${options}}\n${text}{${macro}}`;
|
||||
}
|
||||
if (language === 'noformat') {
|
||||
if (/\{noformat(?::[^}]*)?\}/.test(text)) unsupported();
|
||||
return `{noformat}\n${text}{noformat}`;
|
||||
@@ -537,8 +617,17 @@ function wikiBlock(block) {
|
||||
function jiraDataCenterDescription(markdown, previous, readWiki) {
|
||||
// A wiki field may contain macros and effects that have no Markdown
|
||||
// equivalent. Require the existing representation to survive the round trip.
|
||||
if (previous !== null && (typeof previous !== 'string' ||
|
||||
(markdownToWiki(readWiki(previous)) || '') !== previous.replace(/\r\n?/g, '\n'))) unsupported();
|
||||
if (previous !== null) {
|
||||
if (typeof previous !== 'string') unsupported();
|
||||
const previousMarkdown = readWiki(previous);
|
||||
if ((markdownToWiki(previousMarkdown) || '') !== previous.replace(/\r\n?/g, '\n')) unsupported();
|
||||
const macroInfos = value => parser.parse(value, {}).flatMap(token => {
|
||||
if (token.type === 'fence' && wikiMacroFence(token.info.trim())) return [token.info.trim()];
|
||||
if (token.type === 'html_block' && /^<!-- jira-panel:\S* -->$/.test(token.content.trim())) return [token.content.trim()];
|
||||
return [];
|
||||
});
|
||||
if (JSON.stringify(macroInfos(previousMarkdown)) !== JSON.stringify(macroInfos(markdown))) unsupported();
|
||||
}
|
||||
return markdownToWiki(markdown);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,28 @@ function tableRow(line, keep) {
|
||||
return { header, cells };
|
||||
}
|
||||
|
||||
// Keep only documented plain-text options. They are encoded in fence
|
||||
// metadata, never emitted as HTML or interpreted as styling by WeKan.
|
||||
export function jiraCodeMacroLanguage(options, macro) {
|
||||
if (typeof options !== 'string' || options.length > 512 || !options.includes('=') || !options.isWellFormed()) return false;
|
||||
const seen = new Set();
|
||||
const parts = options.split('|');
|
||||
let language = macro === 'noformat' ? 'noformat' : 'text';
|
||||
if (macro === 'code' && /^[a-z0-9_+.#-]{1,32}$/i.test(parts[0]) && parts[0].toLowerCase() !== 'noformat') {
|
||||
language = parts.shift().toLowerCase();
|
||||
}
|
||||
for (const part of parts) {
|
||||
const match = /^(title|borderStyle|borderWidth|borderColor|bgColor|titleBGColor)=([^{}<>\x00-\x1f\x7f]+)$/.exec(part);
|
||||
if (!match || seen.has(match[1])) return false;
|
||||
const [, name, value] = match;
|
||||
if (name === 'borderStyle' && !/^(?:solid|dashed|dotted|double|none)$/.test(value)) return false;
|
||||
if (name === 'borderWidth' && !/^\d{1,2}(?:px)?$/.test(value)) return false;
|
||||
if (name.endsWith('Color') && !/^#(?:[a-f0-9]{3}|[a-f0-9]{6})$/i.test(value)) return false;
|
||||
seen.add(name);
|
||||
}
|
||||
return language;
|
||||
}
|
||||
|
||||
export function jiraWikiToMarkdown(value) {
|
||||
if (typeof value !== 'string' || !value) return '';
|
||||
const kept = [];
|
||||
@@ -108,6 +130,11 @@ export function jiraWikiToMarkdown(value) {
|
||||
let text = value.replace(/\r\n?/g, '\n');
|
||||
// Blocks whose content is literal, first.
|
||||
text = text.replace(/\{(code|noformat)(?::([^}]*))?\}([\s\S]*?)\{\1\}/g, (all, macro, options, body) => {
|
||||
const language = jiraCodeMacroLanguage(options, macro);
|
||||
if (language) {
|
||||
const info = language + ' jira-macro:' + encodeURIComponent(options);
|
||||
return `\n${keep(fence(body.replace(/^\n/, ''), info, { preserveBlankLines: true }))}\n`;
|
||||
}
|
||||
if (macro === 'noformat') {
|
||||
const block = options === undefined
|
||||
? fence(body.replace(/^\n/, ''), 'noformat', { preserveBlankLines: true })
|
||||
@@ -128,6 +155,12 @@ export function jiraWikiToMarkdown(value) {
|
||||
.split('\n').map(line => line ? `> ${line}` : '>').join('\n');
|
||||
return `\n${keep(quote)}\n`;
|
||||
});
|
||||
text = text.replace(/\{panel(?::([^}]*))?\}\n([\s\S]*?)\n\{panel\}/g, (all, options, body) => {
|
||||
if (options !== undefined && !jiraCodeMacroLanguage(options, 'noformat')) return all;
|
||||
const content = restore(wikiBlocks(body, keep)).trim();
|
||||
if (!content) return all;
|
||||
return `\n${keep(`<!-- jira-panel:${encodeURIComponent(options || '')} -->\n\n${content}\n\n<!-- /jira-panel -->`)}\n`;
|
||||
});
|
||||
return restore(wikiBlocks(text, keep)).replace(/\n{3,}/g, '\n\n').replace(/^\n+|\n+$/g, '');
|
||||
}
|
||||
|
||||
@@ -393,9 +426,21 @@ export function jiraAdfExpandTitle(attrs) {
|
||||
return typeof attrs?.title === 'string' && !/[\x00-\x1f\x7f]/.test(attrs.title) ? attrs.title : undefined;
|
||||
}
|
||||
|
||||
export function jiraAdfExpandMedia(node) {
|
||||
return ['mediaSingle', 'mediaGroup'].includes(node?.type) && Array.isArray(node.content) &&
|
||||
node.content.length > 0 && (node.type !== 'mediaSingle' || node.content.length === 1) &&
|
||||
node.content.every(child => child?.type === 'media' && typeof child.attrs?.id === 'string');
|
||||
}
|
||||
|
||||
export const jiraAdfPanelTypes = Object.freeze(['info', 'note', 'warning', 'success', 'error']);
|
||||
export const jiraAdfPanelBlocks = Object.freeze(['paragraph', 'heading', 'bulletList', 'orderedList']);
|
||||
|
||||
const expandMediaMarker = Symbol();
|
||||
|
||||
// Convert Markdown-capable nodes before the plain reader joins the document.
|
||||
function adfWithMarkdown(node, readText, alternateListMarker = false) {
|
||||
if (!node || typeof node !== 'object') return node;
|
||||
if (node[expandMediaMarker]) return { type: 'text', text: node[expandMediaMarker] };
|
||||
if (node.type === 'mention' || node.type === 'emoji') {
|
||||
const isMention = node.type === 'mention';
|
||||
const attrs = isMention ? jiraAdfMentionAttributes(node.attrs) : jiraAdfEmojiAttributes(node.attrs);
|
||||
@@ -448,7 +493,14 @@ function adfWithMarkdown(node, readText, alternateListMarker = false) {
|
||||
const list = adfListToMarkdown(node, readText, alternateListMarker);
|
||||
return { type: 'text', text: `\n${list}\n\n` };
|
||||
}
|
||||
const content = adfMarkdownContent(node.content, readText);
|
||||
let mediaIndex = 0;
|
||||
const children = node.type === 'expand' ? node.content.map(child => jiraAdfExpandMedia(child)
|
||||
? { [expandMediaMarker]: '\x60[Jira media ' + (++mediaIndex) + ']\x60' } : child) : node.content;
|
||||
const content = adfMarkdownContent(children, readText);
|
||||
if (node.type === 'panel' && jiraAdfPanelTypes.includes(node.attrs?.panelType)) {
|
||||
const body = content.map(child => readText(child).replace(/^\n+|\n+$/g, '')).join('\n\n');
|
||||
return { type: 'text', text: `\n<div data-jira-panel="${node.attrs.panelType}">\n\n${body}\n\n</div>\n\n` };
|
||||
}
|
||||
if (node.type === 'expand') {
|
||||
const title = jiraAdfExpandTitle(node.attrs);
|
||||
const html = { '&': '&', '<': '<', '>': '>' };
|
||||
|
||||
@@ -16,6 +16,16 @@ function listEntryOptions(fields) {
|
||||
];
|
||||
}
|
||||
|
||||
function remapListEntryRequirements(requirements, customFields) {
|
||||
if (!Array.isArray(requirements)) return [];
|
||||
return [...new Set(requirements.flatMap(id => {
|
||||
if (typeof id !== 'string') return [];
|
||||
if (Object.hasOwn(DATES, id)) return [id];
|
||||
const sourceId = id.startsWith('custom:') && id.slice(7);
|
||||
return sourceId && Object.hasOwn(customFields, sourceId) ? [customKey(customFields[sourceId])] : [];
|
||||
}))].slice(0, 100);
|
||||
}
|
||||
|
||||
function hasValue(value) {
|
||||
if (typeof value === 'string') return value.trim() !== '';
|
||||
if (Array.isArray(value)) return value.some(hasValue);
|
||||
@@ -36,4 +46,4 @@ function missingListEntryFields(list, card, definitions) {
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = { listEntryOptions, missingListEntryFields };
|
||||
module.exports = { listEntryOptions, missingListEntryFields, remapListEntryRequirements };
|
||||
@@ -13,10 +13,16 @@ function addIssueDueDates(type, raw, tasks, syncField = 'dueDate') {
|
||||
// OpenProject milestones expose "date" instead of "dueDate", including null.
|
||||
const fields = jira ? issue.fields : issue;
|
||||
let field = syncField;
|
||||
if (jira) field = 'duedate';
|
||||
if (jira) {
|
||||
field = syncField === 'startDate' ? raw.jiraStartDateFieldId : 'duedate';
|
||||
if (syncField === 'startDate' && !/^customfield_[1-9]\d{0,15}$/.test(field || '')) continue;
|
||||
}
|
||||
else if (redmine) field = syncField === 'startDate' ? 'start_date' : 'due_date';
|
||||
else if (type === 'openproject' && Object.hasOwn(issue, 'date')) {
|
||||
if (syncField === 'startDate') continue;
|
||||
if (syncField === 'startDate') {
|
||||
dates.set(String(issue.id), '');
|
||||
continue;
|
||||
}
|
||||
field = 'date';
|
||||
}
|
||||
const date = fields?.[field];
|
||||
@@ -27,7 +33,8 @@ function addIssueDueDates(type, raw, tasks, syncField = 'dueDate') {
|
||||
dates.set(String(jira ? issue.key : issue.id), date ?? '');
|
||||
}
|
||||
return tasks.map(task => dates.has(String(task.externalId))
|
||||
? { ...task, [syncField]: dates.get(String(task.externalId)) } : task);
|
||||
? { ...task, [syncField]: dates.get(String(task.externalId)),
|
||||
...(jira && syncField === 'startDate' ? { startDateMapping: raw.jiraStartDateFieldId } : {}) } : task);
|
||||
}
|
||||
|
||||
function asanaDate(task, field) {
|
||||
|
||||
@@ -22,6 +22,10 @@ function planSyncTextMerge(tasks, cards, estimateMapping = null, timeMappings =
|
||||
const card = byId.get(String(task.externalId));
|
||||
if (!card) return task;
|
||||
const result = { ...task }, baseline = { ...(card.syncLastSource || {}) };
|
||||
if (task.startDateMapping && baseline.startDateMapping !== task.startDateMapping) {
|
||||
delete baseline.startDate;
|
||||
baseline.startDateMapping = task.startDateMapping;
|
||||
}
|
||||
if (estimateMapping && baseline.estimateMapping !== estimateMapping.identity) {
|
||||
delete baseline.estimate;
|
||||
baseline.estimateMapping = estimateMapping.identity;
|
||||
|
||||
@@ -64,7 +64,7 @@ function syncTimeMappings(source, definitions = [], estimateMapping = null) {
|
||||
const identityUnit = field === 'duration' ? 'duration' : openProject?.unit || 'hours';
|
||||
mappings[field] = openProject
|
||||
? { ...openProject, localFieldId, identity: JSON.stringify([localFieldId, openProject.remote, identityUnit]),
|
||||
...(['status', 'priority'].includes(field) && matches[0].readOnly ? { openProjectReadOnly: true } : {}) }
|
||||
...(['status', 'priority', 'type', 'budget'].includes(field) && matches[0].readOnly ? { openProjectReadOnly: true } : {}) }
|
||||
: { ...spec, localFieldId, ...(matches[0].adminOnly || matches[0].readOnly ? { jiraReadOnly: true } : {}), identity: JSON.stringify([localFieldId, spec.key, 'hours']) };
|
||||
}
|
||||
return mappings;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export const MAX_NOTION_IMPORT_MARKDOWN_BYTES = 7 * 1024 * 1024;
|
||||
|
||||
const NOTION_ID = /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i;
|
||||
|
||||
export function isNotionId(value) {
|
||||
|
||||
@@ -1,18 +1,35 @@
|
||||
import { openProjectApiHeaders } from './apiImport/openproject.js';
|
||||
import { openProjectApiHeaders, openProjectBudgetLinks } from './apiImport/openproject.js';
|
||||
import { planImportedLinks } from './importedTaskPlan.js';
|
||||
import { cardParentIds } from './cardParents.js';
|
||||
import { STORY_POINTS_FIELD } from './externalScrumPlanning.js';
|
||||
|
||||
import { exportDay, planExportDependencies } from './exportFields.js';
|
||||
import openProjectDurations from './openProjectDurations.js';
|
||||
import openProjectVersions from './openProjectVersions.js';
|
||||
|
||||
const { OPENPROJECT_TIME_FIELDS, OPENPROJECT_PROGRESS_FIELD } = openProjectDurations;
|
||||
const { OPENPROJECT_TIME_FIELDS, OPENPROJECT_PROGRESS_FIELD, OPENPROJECT_BOOLEAN_FIELDS, OPENPROJECT_TEXT_FIELDS, OPENPROJECT_MILESTONE_FIELD } = openProjectDurations;
|
||||
|
||||
const workFields = [...Object.values(OPENPROJECT_TIME_FIELDS), OPENPROJECT_PROGRESS_FIELD];
|
||||
const linkedFields = {
|
||||
budget: /^\/api\/v3\/budgets\/[1-9]\d*$/,
|
||||
type: /^\/api\/v3\/types\/[1-9]\d*$/,
|
||||
status: /^\/api\/v3\/statuses\/[1-9]\d*$/,
|
||||
priority: /^\/api\/v3\/priorities\/[1-9]\d*$/,
|
||||
};
|
||||
const workFields = [
|
||||
...Object.values(OPENPROJECT_TIME_FIELDS).map(field => ({ ...field, type: 'number' })),
|
||||
{ ...OPENPROJECT_PROGRESS_FIELD, type: 'number' },
|
||||
{ remote: 'storyPoints', name: STORY_POINTS_FIELD, type: 'number' },
|
||||
{ remote: 'milestone', name: OPENPROJECT_MILESTONE_FIELD, type: 'checkbox' },
|
||||
{ remote: 'duration', name: OPENPROJECT_TEXT_FIELDS.duration.name, type: 'text' },
|
||||
{ remote: 'ignoreNonWorkingDays', name: OPENPROJECT_BOOLEAN_FIELDS.ignoreNonWorkingDays, type: 'checkbox' },
|
||||
{ remote: 'scheduleManually', name: OPENPROJECT_BOOLEAN_FIELDS.scheduleManually, type: 'checkbox' },
|
||||
...Object.keys(linkedFields).map(remote => ({ remote, name: OPENPROJECT_TEXT_FIELDS[remote].name, type: 'text' })),
|
||||
];
|
||||
|
||||
export function openProjectExportWorkFields(definitions) {
|
||||
const mappings = new Map();
|
||||
for (const { name, remote } of workFields) {
|
||||
const matches = definitions.filter(field => field.type === 'number' && field.name === name);
|
||||
for (const { name, remote, type } of workFields) {
|
||||
const matches = definitions.filter(field => field.type === type && field.name === name);
|
||||
if (matches.length === 1 && !matches[0].adminOnly) mappings.set(remote, matches[0]._id);
|
||||
}
|
||||
return mappings;
|
||||
@@ -22,30 +39,148 @@ export function openProjectExportWorkValues(card, mappings) {
|
||||
const values = {};
|
||||
for (const [remote, id] of mappings) {
|
||||
const entries = (card.customFields || []).filter(entry => entry._id === id);
|
||||
if (entries.length === 1 && typeof entries[0].value === 'number') values[remote] = entries[0].value;
|
||||
if (entries.length === 1) values[remote] = entries[0].value;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
function exportWorkPayload(values = {}) {
|
||||
const labelCollections = {
|
||||
targetVersions: { prefix: 'version:', legacy: 'version', path: /^\/api\/v3\/versions\/[1-9]\d*$/ },
|
||||
observedInVersions: { prefix: openProjectVersions.OPENPROJECT_OBSERVED_VERSION_PREFIX, path: /^\/api\/v3\/versions\/[1-9]\d*$/ },
|
||||
categories: { prefix: 'OpenProject category: ', legacy: 'category', path: /^\/api\/v3\/categories\/[1-9]\d*$/ },
|
||||
labels: { prefix: openProjectVersions.OPENPROJECT_LABEL_PREFIX, path: /^\/api\/v3\/labels\/[1-9]\d*$/ },
|
||||
projectPhase: { prefix: 'OpenProject phase: ', single: true, path: /^\/api\/v3\/project_phases\/[1-9]\d*$/ },
|
||||
};
|
||||
|
||||
export function openProjectExportLabelValues(labelNames) {
|
||||
const values = {};
|
||||
for (const [field, { prefix }] of Object.entries(labelCollections)) {
|
||||
const names = [...new Set((labelNames || []).filter(name => typeof name === 'string' && name.startsWith(prefix))
|
||||
.map(name => name.slice(prefix.length).trim()).filter(Boolean))];
|
||||
if (names.length) values[field] = names;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
function exportWorkPayload(values = {}, { startDate, dueDate }) {
|
||||
const payload = {};
|
||||
let skipped = 0;
|
||||
for (const field of Object.keys(labelCollections)) {
|
||||
if (!Array.isArray(values[field]) || !values[field].length) continue;
|
||||
if (values[field].every(OPENPROJECT_TEXT_FIELDS.priority.valid)) payload[field] = values[field];
|
||||
else skipped += 1;
|
||||
}
|
||||
let automatic = false;
|
||||
for (const { remote } of workFields) {
|
||||
if (!Object.hasOwn(values, remote)) continue;
|
||||
const value = values[remote];
|
||||
if (remote === OPENPROJECT_PROGRESS_FIELD.remote) {
|
||||
if (Object.hasOwn(linkedFields, remote)) {
|
||||
if (OPENPROJECT_TEXT_FIELDS[remote].valid(value)) payload[remote] = value;
|
||||
else skipped += 1;
|
||||
} else if (remote === 'duration') {
|
||||
// Let the destination derive duration when both calendar dates are supplied.
|
||||
if (!(startDate && dueDate) && OPENPROJECT_TEXT_FIELDS.duration.valid(value)) payload[remote] = value;
|
||||
else skipped += 1;
|
||||
} else if (remote === 'milestone') {
|
||||
if (value === true) payload.milestone = true;
|
||||
else if (value !== false) skipped += 1;
|
||||
} else if (remote === 'scheduleManually' && value === false) {
|
||||
automatic = true;
|
||||
} else if (remote === 'ignoreNonWorkingDays' || remote === 'scheduleManually') {
|
||||
if (typeof value === 'boolean') payload[remote] = value;
|
||||
else skipped += 1;
|
||||
} else if (remote === 'storyPoints') {
|
||||
if (Number.isSafeInteger(value) && value >= 0 && value <= 1e12) payload[remote] = value;
|
||||
else skipped += 1;
|
||||
} else if (remote === OPENPROJECT_PROGRESS_FIELD.remote) {
|
||||
if (Number.isInteger(value) && value >= 0 && value <= 100) payload[remote] = value;
|
||||
else skipped += 1;
|
||||
} else {
|
||||
} else if (typeof value === 'number' && value >= 0 && value <= 1e12) {
|
||||
const seconds = Math.round(value * 3600);
|
||||
if (typeof value === 'number' && value >= 0 && value <= 1e12 && Number.isSafeInteger(seconds) &&
|
||||
Math.abs(seconds / 3600 - value) <= Number.EPSILON * Math.max(1, value)) payload[remote] = `PT${seconds}S`;
|
||||
else skipped += 1;
|
||||
}
|
||||
if (Number.isSafeInteger(seconds) && Math.abs(seconds / 3600 - value) <= Number.EPSILON * Math.max(1, value)) {
|
||||
payload[remote] = `PT${seconds}S`;
|
||||
} else skipped += 1;
|
||||
} else skipped += 1;
|
||||
}
|
||||
return { payload, skipped };
|
||||
return { payload, skipped, automatic };
|
||||
}
|
||||
|
||||
function allowedWorkLink(value, property, path, titleField = 'name') {
|
||||
if (property?.writable !== true) return undefined;
|
||||
const links = property._links?.allowedValues;
|
||||
const embedded = property._embedded?.allowedValues;
|
||||
const candidates = [
|
||||
...(Array.isArray(links) ? links : []),
|
||||
...(Array.isArray(embedded) ? embedded.map(item => ({ title: item?.[titleField], href: item?._links?.self?.href })) : []),
|
||||
];
|
||||
const matched = new Set(candidates.filter(link => link?.title === value &&
|
||||
typeof link.href === 'string' && path.test(link.href)).map(link => link.href));
|
||||
return matched.size === 1 ? { href: matched.values().next().value } : undefined;
|
||||
}
|
||||
|
||||
function applyWorkField(body, field, value, schema) {
|
||||
const collection = labelCollections[field];
|
||||
if (collection) {
|
||||
const target = collection.legacy && schema?.[field]?.writable !== true ? collection.legacy : field;
|
||||
const single = collection.single || target !== field;
|
||||
if (single && value.length !== 1) return false;
|
||||
const links = value.map(name => allowedWorkLink(name, schema?.[target], collection.path));
|
||||
if (links.some(link => !link)) return false;
|
||||
(body._links ||= {})[target] = single ? links[0] : links;
|
||||
return true;
|
||||
}
|
||||
if (schema?.[field]?.writable !== true) return false;
|
||||
const path = linkedFields[field];
|
||||
if (!path) {
|
||||
body[field] = value;
|
||||
return true;
|
||||
}
|
||||
const link = allowedWorkLink(value, schema[field], path, field === 'budget' ? 'subject' : 'name');
|
||||
if (!link) return false;
|
||||
(body._links ||= {})[field] = link;
|
||||
return true;
|
||||
}
|
||||
|
||||
async function readWorkspaceChoices(request, base, path, headers, identify) {
|
||||
const elements = [];
|
||||
const pageSize = 100;
|
||||
const ids = new Set();
|
||||
let total;
|
||||
for (let offset = 1; offset <= 100; offset += 1) {
|
||||
const query = new URLSearchParams({ offset, pageSize });
|
||||
const page = await request(`${base}${path}?${query}`, { method: 'GET', headers });
|
||||
const rows = page?._embedded?.elements;
|
||||
if (page?._type !== 'Collection' || page.offset !== offset || !Array.isArray(rows) ||
|
||||
rows.length > pageSize || !Number.isSafeInteger(page.total) || page.total < elements.length + rows.length ||
|
||||
(total !== undefined && total !== page.total)) return undefined;
|
||||
total = page.total;
|
||||
for (const row of rows) {
|
||||
const key = identify(row);
|
||||
if (!key || ids.has(key)) return undefined;
|
||||
ids.add(key);
|
||||
}
|
||||
elements.push(...rows);
|
||||
if (elements.length === page.total) return elements;
|
||||
if (rows.length === 0) return undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async function confirmsMultipleVersions(request, formUrl, headers, body) {
|
||||
try {
|
||||
const form = await request(formUrl, { method: 'POST', headers, body });
|
||||
if (form?._type !== 'Form') return false;
|
||||
const { validationErrors, payload } = form._embedded || {};
|
||||
const confirmed = payload?._links?.targetVersions;
|
||||
const submitted = body._links.targetVersions;
|
||||
if (Object.keys(validationErrors || {}).length || !Array.isArray(confirmed) ||
|
||||
confirmed.length !== submitted.length) return false;
|
||||
const hrefs = new Set(confirmed.map(link => link?.href));
|
||||
return submitted.every(({ href }) => hrefs.has(href));
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function requestFailure(error) {
|
||||
const status = Number.isSafeInteger(error?.status) ? error.status : 0;
|
||||
@@ -77,6 +212,26 @@ async function createRelations(credentials, headers, cards, createdIds, request)
|
||||
return { createdDependencies, skippedDependencies };
|
||||
}
|
||||
|
||||
async function applyAutomaticScheduling(base, headers, id, request) {
|
||||
const url = `${base}/api/v3/work_packages/${id}`;
|
||||
try {
|
||||
const current = await request(url, { method: 'GET', headers });
|
||||
if (current?._type !== 'WorkPackage' || current.id !== id) return false;
|
||||
if (current.scheduleManually === false) return true;
|
||||
if (!Number.isSafeInteger(current.lockVersion) || current.lockVersion < 0) return false;
|
||||
const body = { lockVersion: current.lockVersion, scheduleManually: false };
|
||||
const form = await request(`${url}/form`, { method: 'POST', headers, body });
|
||||
if (form?._type !== 'Form' || form._embedded?.schema?.scheduleManually?.writable !== true ||
|
||||
Object.keys(form._embedded?.validationErrors || {}).length) return false;
|
||||
const updated = await request(url, { method: 'PATCH', headers, body });
|
||||
return updated?._type === 'WorkPackage' && updated.id === id && updated.scheduleManually === false;
|
||||
} catch {
|
||||
// The exported package is already confirmed. Keep it and report the
|
||||
// unconfirmed scheduling field without retrying a potentially applied write.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// The selected project comes from the API import client's project listing.
|
||||
export async function createOpenProjectWorkPackages(credentials, projectId, cards, request) {
|
||||
if (typeof projectId !== 'string' || !/^[1-9]\d{0,15}$/.test(projectId)) {
|
||||
@@ -91,7 +246,8 @@ export async function createOpenProjectWorkPackages(credentials, projectId, card
|
||||
const dueDate = exportDay(card.dueAt);
|
||||
return {
|
||||
cardId: card.cardId,
|
||||
work: exportWorkPayload(card.workFields),
|
||||
assigneeName: card.assigneeName,
|
||||
work: exportWorkPayload(card.workFields, { startDate, dueDate }),
|
||||
body: {
|
||||
subject,
|
||||
...(startDate ? { startDate } : {}),
|
||||
@@ -122,27 +278,94 @@ export async function createOpenProjectWorkPackages(credentials, projectId, card
|
||||
});
|
||||
const created = [];
|
||||
const createdIds = new Map();
|
||||
const workspaceLabelsPath = `/api/v3/workspaces/${projectId}/labels`;
|
||||
const assigneePaths = [`/api/v3/projects/${projectId}/available_assignees`,
|
||||
`/api/v3/workspaces/${projectId}/available_assignees`];
|
||||
const assigneeChoices = new Map();
|
||||
const budgetPath = `/api/v3/projects/${projectId}/budgets`;
|
||||
let budgetChoices;
|
||||
let workspaceLabels;
|
||||
for (const [position, index] of [...order].entries()) {
|
||||
const { cardId, body, work } = requests[index];
|
||||
const { cardId, body, work, assigneeName } = requests[index];
|
||||
const parentId = createdIds.get(parentOf.get(index));
|
||||
if (parentId !== undefined) body._links = { parent: { href: `/api/v3/work_packages/${parentId}` } };
|
||||
let skipped = work.skipped;
|
||||
const workKeys = Object.keys(work.payload);
|
||||
if (workKeys.length) {
|
||||
if (assigneeName === '') skipped += 1;
|
||||
const { type, milestone, ...otherWork } = work.payload;
|
||||
const workKeys = Object.keys(otherWork);
|
||||
if (assigneeName) workKeys.push('assignee');
|
||||
if (type !== undefined || milestone || workKeys.length) {
|
||||
let form;
|
||||
const { startDate, dueDate, ...undated } = body;
|
||||
const formBody = () => milestone ? { ...undated, ...(body._links ? { _links: body._links } : {}) } : body;
|
||||
try {
|
||||
form = await request(`${target}/form`, { method: 'POST', headers, body });
|
||||
form = await request(`${target}/form`, { method: 'POST', headers, body: formBody() });
|
||||
if (type !== undefined) {
|
||||
const typeProperty = form?._type === 'Form' ? form._embedded?.schema?.type : null;
|
||||
if (!applyWorkField(body, 'type', type, { type: typeProperty })) skipped += 1;
|
||||
else if (milestone || workKeys.length) {
|
||||
form = await request(`${target}/form`, { method: 'POST', headers, body: formBody() });
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (![404, 405].includes(error.status)) {
|
||||
if (body._links?.type || ![404, 405].includes(error.status)) {
|
||||
return { created, stoppedAt: cardId, outcome: 'rejected', status: requestFailure(error).status,
|
||||
remaining: requests.length - position - 1, ...omissions() };
|
||||
}
|
||||
if (type !== undefined) skipped += 1;
|
||||
}
|
||||
let schema = form?._type === 'Form' ? form._embedded?.schema : null;
|
||||
if (milestone) {
|
||||
if (schema?.date?.type === 'Date') {
|
||||
delete body.startDate;
|
||||
delete body.dueDate;
|
||||
if (schema.date.writable === true && dueDate) body.date = dueDate;
|
||||
if ((dueDate && !body.date) || (startDate && startDate !== body.date)) skipped += 1;
|
||||
} else skipped += 1;
|
||||
}
|
||||
if (workKeys.includes('labels') && schema?.labels?.writable === true &&
|
||||
schema.labels._links?.allowedValues?.href === workspaceLabelsPath) {
|
||||
workspaceLabels ??= readWorkspaceChoices(request, credentials.url, workspaceLabelsPath, headers,
|
||||
row => row?._type === 'Label' && row._links?.self?.href === `/api/v3/labels/${row.id}` &&
|
||||
Number.isSafeInteger(row.id) && row.id > 0 && row.id).catch(() => undefined);
|
||||
const allowedValues = await workspaceLabels;
|
||||
if (allowedValues) schema = { ...schema, labels: { ...schema.labels, _embedded: { allowedValues } } };
|
||||
}
|
||||
if (workKeys.includes('budget') && schema?.budget?.writable === true &&
|
||||
schema.budget._links?.allowedValues?.href === budgetPath) {
|
||||
budgetChoices ??= request(credentials.url + budgetPath, { method: 'GET', headers })
|
||||
.then(openProjectBudgetLinks).catch(() => undefined);
|
||||
const allowedValues = await budgetChoices;
|
||||
if (allowedValues) schema = { ...schema, budget: { ...schema.budget, _links: { allowedValues } } };
|
||||
}
|
||||
const schema = form?._type === 'Form' ? form._embedded?.schema : null;
|
||||
for (const field of workKeys) {
|
||||
if (schema?.[field]?.writable === true) body[field] = work.payload[field];
|
||||
if (field !== 'assignee') {
|
||||
if (!applyWorkField(body, field, otherWork[field], schema)) skipped += 1;
|
||||
continue;
|
||||
}
|
||||
let property = schema?.assignee;
|
||||
const path = property?._links?.allowedValues?.href;
|
||||
if (property?.writable === true && assigneePaths.includes(path)) {
|
||||
if (!assigneeChoices.has(path)) {
|
||||
assigneeChoices.set(path, readWorkspaceChoices(request, credentials.url, path, headers, row => {
|
||||
const href = row?._links?.self?.href;
|
||||
return typeof href === 'string' && /^\/api\/v3\/(users|groups|placeholder_users)\/[1-9]\d*$/.test(href) && href;
|
||||
}).catch(() => undefined));
|
||||
}
|
||||
const allowedValues = await assigneeChoices.get(path);
|
||||
if (allowedValues) property = { ...property, _embedded: { allowedValues } };
|
||||
}
|
||||
const link = allowedWorkLink(assigneeName, property, /^\/api\/v3\/users\/[1-9]\d*$/);
|
||||
if (link) (body._links ||= {}).assignee = link;
|
||||
else skipped += 1;
|
||||
}
|
||||
// Some releases expose the array field but enforce one assignment.
|
||||
if (body._links?.targetVersions?.length > 1 &&
|
||||
!await confirmsMultipleVersions(request, `${target}/form`, headers, body)) {
|
||||
delete body._links.targetVersions;
|
||||
if (!Object.keys(body._links).length) delete body._links;
|
||||
skipped += 1;
|
||||
}
|
||||
}
|
||||
let result;
|
||||
try {
|
||||
@@ -158,10 +381,16 @@ export async function createOpenProjectWorkPackages(credentials, projectId, card
|
||||
projectPath !== `/api/v3/workspaces/${projectId}`)) {
|
||||
return { created, stoppedAt: cardId, outcome: 'unknown', status: 0, remaining: requests.length - position - 1, ...omissions() };
|
||||
}
|
||||
skippedWorkFields += skipped;
|
||||
skippedWorkFields += skipped + Number(work.automatic);
|
||||
created.push({ cardId, id: result.id });
|
||||
createdIds.set(index, result.id);
|
||||
}
|
||||
const relations = await createRelations(credentials, headers, cards, createdIds, request);
|
||||
// Automatic mode is validated only after parents, children and relations exist.
|
||||
for (const [index, id] of createdIds) {
|
||||
if (requests[index].work.automatic && await applyAutomaticScheduling(credentials.url, headers, id, request)) {
|
||||
skippedWorkFields -= 1;
|
||||
}
|
||||
}
|
||||
return { created, remaining: 0, ...omissions(), ...relations };
|
||||
}
|
||||
@@ -277,6 +277,8 @@ export function scopedExternalDocument(document, { includeScrum = true, includeL
|
||||
? `#${tag.color}` : tag?.color });
|
||||
labelIds.push(labels.get(name)._id);
|
||||
}
|
||||
const openProjectAssignee = sourceKey === 'openproject' && task.owner_username
|
||||
? resolve(task.owner_username) : undefined;
|
||||
cards.push({
|
||||
_id: cardId, title: task.title, description: task.description, labelIds,
|
||||
customFields: [...importedCustomFieldValues(task, fields).map(field => ({ _id: fieldIds.get(field.name), value: field.value })),
|
||||
@@ -293,6 +295,7 @@ export function scopedExternalDocument(document, { includeScrum = true, includeL
|
||||
color: task.color, recurrenceInterval: task.recurrence, worklogs: task.worklogs, requestedBy: task.requested_by,
|
||||
assignedBy: task.assigned_by, isOvertime: task.isOvertime,
|
||||
members: [...new Set(assignees.map(resolve).filter(Boolean))],
|
||||
...(openProjectAssignee ? { assignees: [openProjectAssignee] } : {}),
|
||||
watchers: [...new Set(watchers.map(resolve).filter(Boolean))],
|
||||
scrum: task.scrum,
|
||||
...(jira && task.jiraHistory?.length ? {
|
||||
|
||||
@@ -55,13 +55,27 @@ function mimeSaysNothing(mimeType) {
|
||||
return !t || UNINFORMATIVE_MIME.has(t);
|
||||
}
|
||||
|
||||
const STEP_EXTENSIONS = ['.step', '.stp', '.p21', '.ifc'];
|
||||
const FORMAT_EXTENSIONS = {
|
||||
'message/rfc822': ['.eml'],
|
||||
'model/step': ['.step', '.stp', '.p21'],
|
||||
'model/iges': ['.igs', '.iges'],
|
||||
'model/step': STEP_EXTENSIONS,
|
||||
'application/x-step': STEP_EXTENSIONS,
|
||||
'image/vnd.dxf': ['.dxf'],
|
||||
'application/x-dxf': ['.dxf'],
|
||||
'application/x-zip-compressed': ['.zip'],
|
||||
};
|
||||
const GENERIC_TEXT_EXTENSIONS = new Set(['.eml', '.step', '.stp', '.p21', '.x_t', '.dxf']);
|
||||
const GENERIC_CONTAINER_MIMES = new Set([
|
||||
'text/plain', 'text/xml', 'application/xml', 'application/zip',
|
||||
'application/x-zip-compressed',
|
||||
]);
|
||||
const ACTIVE_EXTENSIONS = new Set([
|
||||
'.html', '.htm', '.xhtml', '.shtml', '.svg', '.svgz', '.hta',
|
||||
'.js', '.jse', '.mjs', '.cjs', '.vbs', '.vbe', '.wsf', '.wsh',
|
||||
'.exe', '.com', '.scr', '.msi', '.bat', '.cmd', '.ps1', '.sh',
|
||||
'.php', '.phtml', '.asp', '.aspx', '.jsp', '.lnk', '.url', '.desktop',
|
||||
]);
|
||||
const KNOWN_FORMAT_EXTENSIONS = new Set([...Object.values(FORMAT_EXTENSIONS).flat(), '.x_t']);
|
||||
|
||||
// The correct extension (with leading dot) for a MIME type, or '' if unknown.
|
||||
function extensionForMime(mimeType) {
|
||||
@@ -100,8 +114,8 @@ function sanitizeUploadFileName(name, mimeType) {
|
||||
// whitespace. This is the same normalization used to DISPLAY names, so the
|
||||
// stored name matches what users see.
|
||||
let n = cleanFileName(name);
|
||||
let wantExt = extensionForMime(mimeType);
|
||||
const wantMime = String(mimeType || '').toLowerCase();
|
||||
const wantMime = String(mimeType || '').toLowerCase().trim();
|
||||
let wantExt = extensionForMime(wantMime);
|
||||
const originalExt = /(?:^|[^.])(\.[^.]+)$/.exec(n);
|
||||
// Online Gantt stores JSON under its application-owned .gantt extension.
|
||||
// A generic JSON detector describes the serialization, not the program that
|
||||
@@ -118,19 +132,23 @@ function sanitizeUploadFileName(name, mimeType) {
|
||||
if (wantExt) {
|
||||
const dot = n.lastIndexOf('.');
|
||||
const curExt = dot > 0 ? n.slice(dot).toLowerCase() : '';
|
||||
// Plain text, XML and ZIP describe the representation. A custom suffix
|
||||
// can still identify the application that opens the file.
|
||||
if (curExt && GENERIC_CONTAINER_MIMES.has(wantMime)) {
|
||||
return ACTIVE_EXTENSIONS.has(curExt) ? n.slice(0, dot) + wantExt : n;
|
||||
}
|
||||
const curMime = mime.lookup(n); // false when there is no recognized extension
|
||||
// JFIF is JPEG content, but many desktop file associations (and the
|
||||
// mime-types database used here) do not recognize .jfif. Use the portable
|
||||
// canonical extension instead of producing "photo.jfif.jpeg".
|
||||
if (curExt === wantExt || FORMAT_EXTENSIONS[wantMime]?.includes(curExt) ||
|
||||
(wantMime === 'text/plain' && GENERIC_TEXT_EXTENSIONS.has(curExt))) {
|
||||
if (curExt === wantExt || FORMAT_EXTENSIONS[wantMime]?.includes(curExt)) {
|
||||
// Custom/application-owned extensions may not exist in mime-types, but a
|
||||
// content-aware override above has already established the right suffix.
|
||||
} else if (wantMime === 'image/jpeg' && curExt === '.jfif') {
|
||||
n = n.slice(0, dot) + wantExt;
|
||||
} else if (curMime === wantMime) {
|
||||
// extension already matches the type (handles .jpg vs .jpeg) — keep it
|
||||
} else if (curMime || GENERIC_TEXT_EXTENSIONS.has(curExt)) {
|
||||
} else if (curMime || KNOWN_FORMAT_EXTENSIONS.has(curExt)) {
|
||||
// recognized but WRONG extension -> replace it
|
||||
n = n.slice(0, n.lastIndexOf('.')) + wantExt;
|
||||
} else {
|
||||
|
||||
@@ -51,6 +51,7 @@ export const NOT_COPIED = {
|
||||
syncMsTodoPreviousStatus: 'external sync bookkeeping',
|
||||
syncArchivedFromSourceAt: 'external sync bookkeeping',
|
||||
jiraIssueHistory: 'read-only Jira source history created through Jira import',
|
||||
notionSyncedMemberIds: 'Notion Sync member ownership is rebuilt from the destination board and its Sync source',
|
||||
jiraSyncedVoterIds: 'read-only board member IDs mapped from a Jira voter snapshot',
|
||||
openProjectTimeEntries: 'read-only data fetched with the configured OpenProject credentials',
|
||||
openProjectTimeEntriesOmitted: 'count for time entries fetched with the configured OpenProject credentials',
|
||||
|
||||
@@ -28,7 +28,6 @@ export const RECORDS = {
|
||||
copied: ['wipLimit', 'policy', 'split', 'cardsUseListColor', 'starred'],
|
||||
notCopied: {
|
||||
deletedAt: TRASH, deletedBy: TRASH, deleteBatchId: TRASH,
|
||||
entryRequirements: 'custom field IDs belong to the exporting board',
|
||||
linkedBoardId: 'a board of the exporting WeKan', linkedListId: 'a list of another board of the exporting WeKan',
|
||||
scrum: SCRUM, scrumRevision: SCRUM,
|
||||
syncCredentialFence: SYNC, syncCredentialGeneration: SYNC, syncCredentialIncarnation: SYNC, syncRevision: SYNC,
|
||||
@@ -38,14 +37,15 @@ export const RECORDS = {
|
||||
swimlanes: { copied: ['height'], notCopied: { scrum: SCRUM, scrumRevision: SCRUM } },
|
||||
checklists: {
|
||||
copied: ['hideAllChecklistItems', 'hideCheckedChecklistItems', 'showChecklistAtMinicard', 'resetInterval'],
|
||||
notCopied: {},
|
||||
notCopied: { plankaRemoteId: SYNC, plankaCreateStartedAt: SYNC, plankaSyncSourceKey: SYNC, plankaSyncSort: SYNC, plankaSyncTitle: SYNC },
|
||||
},
|
||||
checklistItems: { copied: [], notCopied: {} },
|
||||
checklistItems: { copied: [], notCopied: { plankaRemoteId: SYNC, plankaCreateStartedAt: SYNC, plankaSyncSourceKey: SYNC, plankaSyncSort: SYNC, plankaSyncTitle: SYNC, plankaSyncFinished: SYNC } },
|
||||
customFields: { copied: ['adminOnly', 'readOnly', 'cardKinds', 'showSumAtTopOfList'], notCopied: {} },
|
||||
cardComments: {
|
||||
copied: [],
|
||||
notCopied: {
|
||||
syncCommentId: SYNC,
|
||||
plankaCommentSendStartedAt: SYNC, plankaSentCommentId: SYNC, plankaCommentSentBaseline: SYNC,
|
||||
todoistSendStartedAt: SYNC,
|
||||
jiraCommentSendStartedAt: SYNC, jiraCommentDeliveryId: SYNC,
|
||||
jiraSentCommentId: SYNC, jiraCommentSentBaseline: SYNC,
|
||||
|
||||
@@ -512,6 +512,7 @@ Lists.helpers({
|
||||
boardId,
|
||||
title: this.title,
|
||||
archived: false,
|
||||
deletedAt: null,
|
||||
});
|
||||
|
||||
const plan = planListMove({
|
||||
@@ -568,6 +569,7 @@ Lists.helpers({
|
||||
for (const card of await this.cards()) {
|
||||
await card.move(boardId, plan.swimlaneId, listId);
|
||||
}
|
||||
return listId;
|
||||
},
|
||||
|
||||
// #6443: the _ids of the board's OTHER non-archived swimlanes when `swimlaneId`
|
||||
|
||||
@@ -400,6 +400,9 @@ class ScopedImporter {
|
||||
if (this._externalSource) {
|
||||
const canMap = id => (id === this._userId || board.hasAdmin(this._userId)) && board.isActiveMember(id);
|
||||
toCreate.members = (card.members || []).filter(canMap);
|
||||
if (this._externalSource === 'openproject') {
|
||||
toCreate.assignees = (card.assignees || []).filter(canMap);
|
||||
}
|
||||
toCreate.watchers = (card.watchers || []).filter(canMap);
|
||||
}
|
||||
toCreate.requesters = (card.requesters || []).filter(userId => boardMemberIds.has(userId));
|
||||
|
||||
@@ -793,6 +793,9 @@ export class WekanCreator {
|
||||
}
|
||||
// WIP limit, flow policy, split, role restrictions (models/lib/wekanRecordFields.js).
|
||||
Object.assign(listToCreate, wekanRecordFields('lists', list, this._recordMaps()));
|
||||
const { remapListEntryRequirements } = require('./lib/listEntryRequirements');
|
||||
const requirements = remapListEntryRequirements(list.entryRequirements, this.customFields);
|
||||
if (requirements.length) listToCreate.entryRequirements = requirements;
|
||||
const listId = await writeImportedEntity(Lists, listToCreate, {
|
||||
ids: this.lists,
|
||||
sourceId: list._id,
|
||||
@@ -1204,11 +1207,12 @@ export class WekanCreator {
|
||||
{ method: 'parseActivities' },
|
||||
{ method: 'createBoardAndLabels', createsBoard: true },
|
||||
{ method: 'applyFeatureProfileTemplate' },
|
||||
// Entry requirements refer to custom fields by their new IDs.
|
||||
{ method: 'createCustomFields', source: 'customFields' },
|
||||
{ method: 'createLists', source: 'lists' },
|
||||
{ method: 'createSwimlanes', source: 'swimlanes' },
|
||||
// Board Settings name lists, so they come once the lists exist.
|
||||
{ method: 'createBoardSettings' },
|
||||
{ method: 'createCustomFields', source: 'customFields' },
|
||||
{ method: 'createCards', source: 'cards' },
|
||||
{ method: 'createSubtasks', source: 'cards' },
|
||||
{ method: 'createCardDependencies', source: 'cards' },
|
||||
|
||||
@@ -6,8 +6,8 @@ is <https://github.com/yukiyokotani/office-open-xml-viewer> at release v0.85.2
|
||||
(commit `9756f5e`). The source npm tarball SHA256 is
|
||||
`7dd3995b65e45adfab9d7686e1a2eb69d4c5a9851cbd025e63aaf97869110831`.
|
||||
|
||||
Only the three browser viewer entry graphs, their WebAssembly parsers and their
|
||||
render workers are retained. The upstream Node API, MCP server, VS Code
|
||||
The three browser viewer entry graphs, their WebAssembly parsers, render
|
||||
workers and the Node thumbnail entry graph are retained. The MCP server, VS Code
|
||||
extension, examples, site, source toolchain, type declarations and optional
|
||||
MathJax, ChartEx, region-map and TIFF entry points are excluded. This package
|
||||
has no npm dependencies or lifecycle scripts.
|
||||
|
||||
+1323
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,67 @@
|
||||
import { t as e } from "./chunk-DmhlhrBa.js";
|
||||
//#region packages/node/src/render.ts
|
||||
var t = /* @__PURE__ */ e({
|
||||
installImageBitmapShim: () => i,
|
||||
installOffscreenCanvasShim: () => r,
|
||||
renderSlideNode: () => o,
|
||||
withNodeCanvasRuntime: () => a
|
||||
}), n = Promise.resolve();
|
||||
function r(e) {
|
||||
let t = globalThis, n = t.OffscreenCanvas, r = Object.prototype.hasOwnProperty.call(globalThis, "OffscreenCanvas");
|
||||
if (n !== void 0) return () => {};
|
||||
class i {
|
||||
constructor(t, n) {
|
||||
return e.createCanvas(t, n);
|
||||
}
|
||||
}
|
||||
return t.OffscreenCanvas = i, () => {
|
||||
r ? t.OffscreenCanvas = n : delete t.OffscreenCanvas;
|
||||
};
|
||||
}
|
||||
function i(e) {
|
||||
let t = globalThis, n = t.createImageBitmap;
|
||||
return t.createImageBitmap = async (t, n) => {
|
||||
if (t && typeof t.getContext == "function") return t;
|
||||
let r;
|
||||
if (t instanceof Uint8Array || t instanceof ArrayBuffer) r = t;
|
||||
else if (typeof t.arrayBuffer == "function") r = await t.arrayBuffer();
|
||||
else throw Error("createImageBitmap shim: unsupported source type");
|
||||
let i = n?.resizeWidth, a = n?.resizeHeight, o = typeof i == "number" && i > 0 ? { width: i } : typeof a == "number" && a > 0 ? { height: a } : void 0, s = await e.loadImage(r, o);
|
||||
if (!o || o.width !== void 0 && s.width === o.width || o.height !== void 0 && s.height === o.height) return s;
|
||||
let c = o.width === void 0 ? typeof o.height == "number" ? o.height / s.height : 1 : o.width / s.width, l = Math.max(1, Math.round(s.width * c)), u = Math.max(1, Math.round(s.height * c)), d = e.createCanvas(l, u), f = d.getContext("2d");
|
||||
return typeof f.drawImage == "function" ? (f.drawImage(s, 0, 0, l, u), s.close?.(), d) : s;
|
||||
}, () => {
|
||||
t.createImageBitmap = n;
|
||||
};
|
||||
}
|
||||
function a(e, t) {
|
||||
let a = async () => {
|
||||
let n = typeof globalThis.createImageBitmap == "function" ? () => void 0 : i(e), a = r(e);
|
||||
try {
|
||||
return await t();
|
||||
} finally {
|
||||
a(), n();
|
||||
}
|
||||
}, o = n.then(a, a);
|
||||
return n = o.then(() => void 0, () => void 0), o;
|
||||
}
|
||||
async function o(e, t, n, r = {}) {
|
||||
let { renderSlide: i } = await import("./session-BmP4lcEo.js").then((e) => e.t), o = t.slides[n];
|
||||
if (!o) throw Error(`Slide index ${n} out of range`);
|
||||
let s = r.width ?? 960, c = r.dpr ?? 2, l = r.fetchImage ?? (async () => new Blob([])), u = async () => {
|
||||
await i(e, o, t.slideWidth, t.slideHeight, {
|
||||
width: s,
|
||||
dpr: c,
|
||||
defaultTextColor: t.defaultTextColor,
|
||||
majorFont: t.majorFont,
|
||||
minorFont: t.minorFont,
|
||||
hlinkColor: t.hlinkColor ?? null,
|
||||
fetchMedia: r.fetchMedia ?? (async () => new Blob([])),
|
||||
fetchImage: l,
|
||||
skipMediaControls: !0
|
||||
});
|
||||
};
|
||||
await (r.factory ? a(r.factory, u) : u());
|
||||
}
|
||||
//#endregion
|
||||
export { a, t as i, r as n, o as r, i as t };
|
||||
@@ -0,0 +1,743 @@
|
||||
import { t as e } from "./chunk-DmhlhrBa.js";
|
||||
import { a as t, u as n } from "./slide-pull-client-RTwQbJiy.js";
|
||||
import { B as r, F as i, G as a, H as o, I as s, K as c, P as l, Q as u, R as d, U as f, W as p, X as m, Xt as h, Y as g, Z as _, cn as v, q as y } from "./line-metrics-BGtFM-ec.js";
|
||||
import { t as b } from "./transfer-mIj7E7NB.js";
|
||||
//#region packages/pptx/src/slide-cursor-operation.ts
|
||||
function x(e) {
|
||||
try {
|
||||
return f(e((e) => e.slide_cursor_resource_usage()));
|
||||
} catch (e) {
|
||||
if (String(e).includes("slide cursor usage is unavailable")) return;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function ee(e, t, n, r, i) {
|
||||
let a, o;
|
||||
try {
|
||||
if (i) {
|
||||
if (!r) throw Error("slide payload is missing before acknowledgement");
|
||||
let t = i(n, r, x(e));
|
||||
typeof t == "function" ? a = t : t && ({rollback: a, commit: o} = t);
|
||||
}
|
||||
e((e) => e.acknowledge_slide(t.operationId, t.generation)), o?.();
|
||||
} catch (e) {
|
||||
try {
|
||||
a?.();
|
||||
} catch {}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
//#region packages/pptx/src/slide-pull-worker.ts
|
||||
var te = "ooxml-pull-resetting", ne = "ooxml-pull-reset-failed", re = class {
|
||||
coordinatorGeneration = new s();
|
||||
sessions = /* @__PURE__ */ new Map();
|
||||
pendingOpens = /* @__PURE__ */ new Map();
|
||||
operationTail = Promise.resolve();
|
||||
resourceFailure;
|
||||
lifecycleState = "ready";
|
||||
resetBarrier;
|
||||
resetIdentities = /* @__PURE__ */ new Map();
|
||||
constructor(e, t, n = (e) => e(this.requireArchive())) {
|
||||
this.archive = e, this.acceptSlide = t, this.executeArchive = n;
|
||||
}
|
||||
get coordinator() {
|
||||
return this.coordinatorGeneration;
|
||||
}
|
||||
reserveOpen(e) {
|
||||
if (this.assertReady(), S(e), this.pendingOpens.has(e.sessionId) || this.sessions.has(e.sessionId)) throw Error("slide pull session id is already reserved");
|
||||
this.pendingOpens.set(e.sessionId, {
|
||||
identity: e,
|
||||
canceled: !1
|
||||
});
|
||||
}
|
||||
abandonOpen(e) {
|
||||
this.pendingOpens.delete(e);
|
||||
}
|
||||
get pendingOpenCount() {
|
||||
return this.pendingOpens.size;
|
||||
}
|
||||
async open(e, t) {
|
||||
if (this.assertReady(), this.resourceFailure) throw this.resourceFailure;
|
||||
if (!Number.isSafeInteger(e) || e < 0) throw RangeError("slide index must be a non-negative safe integer");
|
||||
let n = this.pendingOpens.get(t.sessionId);
|
||||
if (!n || !C(n.identity, t)) throw Error("slide pull session open reservation is stale or missing");
|
||||
let r, a = new Promise((e) => {
|
||||
r = e;
|
||||
}), o = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
||||
if (n.canceled) throw Error("slide pull session open was canceled");
|
||||
let a, o = !1, s = new i({
|
||||
...t,
|
||||
maxByteCredit: h,
|
||||
coordinator: this.coordinator,
|
||||
driver: {
|
||||
pull: (n) => {
|
||||
let r;
|
||||
try {
|
||||
r = this.executeArchive((r) => r.pull_slide(e, t.operationId, t.generation, n));
|
||||
} catch (e) {
|
||||
throw y(e, n, h) || (this.latchResourceFailure(e), e);
|
||||
}
|
||||
let i = b(r);
|
||||
return this.acceptSlide && (a = JSON.parse(new TextDecoder().decode(new Uint8Array(i)))), o = !0, {
|
||||
payload: i,
|
||||
byteLength: i.byteLength,
|
||||
done: !0,
|
||||
transfer: [i]
|
||||
};
|
||||
},
|
||||
measureChunk: ({ payload: e }) => e.byteLength,
|
||||
acknowledge: () => {
|
||||
if (!o) throw Error("slide unit is not awaiting acknowledgement");
|
||||
try {
|
||||
ee(this.executeArchive, t, e, a, this.acceptSlide);
|
||||
} catch (e) {
|
||||
throw this.latchResourceFailure(e), e;
|
||||
}
|
||||
o = !1, a = void 0, this.sessions.delete(t.sessionId), r();
|
||||
},
|
||||
cancel: async () => {
|
||||
try {
|
||||
this.archive() && await this.executeArchive((e) => e.cancel_slide());
|
||||
} finally {
|
||||
a = void 0, o = !1, this.sessions.delete(t.sessionId), r();
|
||||
}
|
||||
},
|
||||
close: async () => {
|
||||
try {
|
||||
this.archive() && await this.executeArchive((e) => e.cancel_slide());
|
||||
} finally {
|
||||
a = void 0, o = !1, this.sessions.delete(t.sessionId), r();
|
||||
}
|
||||
},
|
||||
resourceUsage: () => {
|
||||
try {
|
||||
return this.readResourceUsage();
|
||||
} catch (e) {
|
||||
throw this.latchResourceFailure(e), e;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.sessions.set(t.sessionId, {
|
||||
host: s,
|
||||
identity: t
|
||||
}), this.pendingOpens.delete(t.sessionId);
|
||||
}));
|
||||
this.operationTail = o.then(() => a, () => void 0);
|
||||
try {
|
||||
await o;
|
||||
} catch (e) {
|
||||
throw this.pendingOpens.delete(t.sessionId), r(), e;
|
||||
}
|
||||
}
|
||||
async postOpenedSafely(e, t, n) {
|
||||
if (this.lifecycleState !== "ready") {
|
||||
try {
|
||||
n(this.lifecycleError());
|
||||
} catch {}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
t();
|
||||
} catch (t) {
|
||||
await this.closeIdentity(e);
|
||||
try {
|
||||
n(t);
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
dispatch(e, t) {
|
||||
if (this.lifecycleState !== "ready") return t(this.responseDuringReset(e)), Promise.resolve();
|
||||
let n = this.sessions.get(e.sessionId);
|
||||
if (n) return n.host.dispatch(e, t);
|
||||
let r = this.pendingOpens.get(e.sessionId);
|
||||
if (r && (e.kind === "cancel" || e.kind === "close")) {
|
||||
let n = C(r.identity, e);
|
||||
return n && (r.canceled = !0), t(n ? {
|
||||
protocol: l,
|
||||
kind: "accepted",
|
||||
sessionId: e.sessionId,
|
||||
operationId: e.operationId,
|
||||
generation: e.generation,
|
||||
requestId: e.requestId,
|
||||
command: e.kind
|
||||
} : this.staleLifecycleResponse(e)), Promise.resolve();
|
||||
}
|
||||
return e.kind === "cancel" || e.kind === "close" ? (t({
|
||||
protocol: l,
|
||||
kind: "accepted",
|
||||
sessionId: e.sessionId,
|
||||
operationId: e.operationId,
|
||||
generation: e.generation,
|
||||
requestId: e.requestId,
|
||||
command: e.kind
|
||||
}), Promise.resolve()) : (t({
|
||||
protocol: l,
|
||||
kind: "error",
|
||||
sessionId: e.sessionId,
|
||||
operationId: e.operationId,
|
||||
generation: e.generation,
|
||||
requestId: e.requestId,
|
||||
error: c(/* @__PURE__ */ Error("slide pull session is not open"))
|
||||
}), Promise.resolve());
|
||||
}
|
||||
async dispatchSafely(e, t) {
|
||||
try {
|
||||
await this.dispatch(e, t);
|
||||
} catch (n) {
|
||||
try {
|
||||
t({
|
||||
protocol: l,
|
||||
kind: "error",
|
||||
sessionId: e.sessionId,
|
||||
operationId: e.operationId,
|
||||
generation: e.generation,
|
||||
requestId: e.requestId,
|
||||
error: c(n)
|
||||
});
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
run(e) {
|
||||
if (this.lifecycleState !== "ready") return Promise.reject(this.lifecycleError());
|
||||
let t = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
||||
if (this.resourceFailure) throw this.resourceFailure;
|
||||
return e();
|
||||
})).catch((e) => {
|
||||
throw this.latchResourceFailure(e), e;
|
||||
});
|
||||
return this.operationTail = t.then(() => void 0, () => void 0), t;
|
||||
}
|
||||
reset() {
|
||||
if (this.resetBarrier) return this.resetBarrier;
|
||||
this.lifecycleState = "resetting", this.captureResetIdentities();
|
||||
let e = this.performReset().then(() => {
|
||||
this.resetIdentities.clear(), this.lifecycleState = "ready";
|
||||
}, (e) => {
|
||||
throw this.lifecycleState = "reset-failed", e;
|
||||
}).finally(() => {
|
||||
this.resetBarrier === e && (this.resetBarrier = void 0);
|
||||
});
|
||||
return this.resetBarrier = e, e;
|
||||
}
|
||||
async performReset() {
|
||||
for (let e of this.pendingOpens.values()) e.canceled = !0;
|
||||
let e = 1;
|
||||
for (let { host: t, identity: n } of [...this.sessions.values()]) {
|
||||
let r;
|
||||
if (await t.dispatch({
|
||||
protocol: l,
|
||||
kind: "close",
|
||||
...n,
|
||||
requestId: e++
|
||||
}, (e) => {
|
||||
e.kind === "error" && (r = p(e.error));
|
||||
}), r) throw r;
|
||||
}
|
||||
this.sessions.clear(), await this.operationTail, this.pendingOpens.clear(), this.archive() && await this.executeArchive((e) => e.close_presentation_session()), this.coordinatorGeneration = new s(), this.resourceFailure = void 0;
|
||||
}
|
||||
assertReady() {
|
||||
if (this.lifecycleState !== "ready") throw this.lifecycleError();
|
||||
}
|
||||
lifecycleError() {
|
||||
let e = this.lifecycleState === "reset-failed", t = /* @__PURE__ */ Error(e ? "slide pull worker reset failed; retry reset before new work" : "slide pull worker reset is in progress");
|
||||
return t.name = "PullSessionLifecycleError", Object.assign(t, { code: e ? ne : te });
|
||||
}
|
||||
captureResetIdentities() {
|
||||
for (let { identity: e } of this.sessions.values()) this.resetIdentities.set(e.sessionId, e);
|
||||
for (let { identity: e } of this.pendingOpens.values()) this.resetIdentities.set(e.sessionId, e);
|
||||
}
|
||||
responseDuringReset(e) {
|
||||
if (e.kind === "cancel" || e.kind === "close") {
|
||||
let t = this.resetIdentities.get(e.sessionId);
|
||||
return t && !C(t, e) ? this.staleLifecycleResponse(e) : {
|
||||
protocol: l,
|
||||
kind: "accepted",
|
||||
sessionId: e.sessionId,
|
||||
operationId: e.operationId,
|
||||
generation: e.generation,
|
||||
requestId: e.requestId,
|
||||
command: e.kind
|
||||
};
|
||||
}
|
||||
return {
|
||||
protocol: l,
|
||||
kind: "error",
|
||||
sessionId: e.sessionId,
|
||||
operationId: e.operationId,
|
||||
generation: e.generation,
|
||||
requestId: e.requestId,
|
||||
error: c(this.lifecycleError())
|
||||
};
|
||||
}
|
||||
requireArchive() {
|
||||
let e = this.archive();
|
||||
if (!e) throw Error("Presentation not loaded");
|
||||
return e;
|
||||
}
|
||||
async closeIdentity(e) {
|
||||
if (this.lifecycleState !== "ready") return;
|
||||
let t = this.sessions.get(e.sessionId);
|
||||
if (t) {
|
||||
await t.host.dispatch({
|
||||
protocol: l,
|
||||
kind: "close",
|
||||
...e,
|
||||
requestId: 1
|
||||
}, () => void 0);
|
||||
return;
|
||||
}
|
||||
let n = this.pendingOpens.get(e.sessionId);
|
||||
n && C(n.identity, e) && (n.canceled = !0);
|
||||
}
|
||||
readResourceUsage() {
|
||||
return x(this.executeArchive);
|
||||
}
|
||||
latchResourceFailure(e) {
|
||||
let t = e instanceof v ? e : a(e);
|
||||
t && (this.resourceFailure ??= t);
|
||||
}
|
||||
staleLifecycleResponse(e) {
|
||||
return {
|
||||
protocol: l,
|
||||
kind: "error",
|
||||
sessionId: e.sessionId,
|
||||
operationId: e.operationId,
|
||||
generation: e.generation,
|
||||
requestId: e.requestId,
|
||||
error: {
|
||||
message: "stale lifecycle targets another slide operation",
|
||||
errorName: "PullSessionProtocolError",
|
||||
code: "ooxml-stale-lifecycle"
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
function S(e) {
|
||||
if (!Number.isSafeInteger(e.sessionId) || e.sessionId <= 0) throw RangeError("session id must be a positive safe integer");
|
||||
if (!Number.isSafeInteger(e.operationId) || e.operationId <= 0) throw RangeError("operation id must be a positive safe integer");
|
||||
if (!Number.isSafeInteger(e.generation) || e.generation <= 0) throw RangeError("generation must be a positive safe integer");
|
||||
}
|
||||
function C(e, t) {
|
||||
return e.sessionId === t.sessionId && e.operationId === t.operationId && e.generation === t.generation;
|
||||
}
|
||||
//#endregion
|
||||
//#region packages/core/src/internal/wasm-runtime-generation.ts
|
||||
function ie(e) {
|
||||
return _(e) ? new g(`WASM parser trapped and was recycled: ${e instanceof Error ? e.message : String(e)}`) : null;
|
||||
}
|
||||
var w = class {
|
||||
realm;
|
||||
live = /* @__PURE__ */ new Set();
|
||||
constructor(e, t) {
|
||||
this.realm = new u(() => e.initSync({ module: t }), () => e.reinit({ module_or_path: t }), ie), this.realm.onPoison((e) => {
|
||||
for (let t of this.live) t.poison(e);
|
||||
this.live.clear();
|
||||
});
|
||||
}
|
||||
async open(e, t) {
|
||||
for (;;) {
|
||||
this.throwIfOpenAborted(t), await this.awaitReadyOrAbort(t), this.throwIfOpenAborted(t);
|
||||
let n = this.realm.tryRunReady(e);
|
||||
if (!n.current) continue;
|
||||
let r = new ae(this, n.value, n.generation);
|
||||
if (this.live.add(r), t?.signal?.aborted) throw r.close(t.disposeOnAbort), t.abortError?.() ?? new DOMException("The operation was aborted", "AbortError");
|
||||
return r;
|
||||
}
|
||||
}
|
||||
async awaitReadyOrAbort(e) {
|
||||
let t = e?.signal;
|
||||
if (!t) {
|
||||
await this.realm.ensureReady();
|
||||
return;
|
||||
}
|
||||
this.throwIfOpenAborted(e), await new Promise((n, r) => {
|
||||
let i = () => r(e?.abortError?.() ?? new DOMException("The operation was aborted", "AbortError"));
|
||||
t.addEventListener("abort", i, { once: !0 }), this.realm.ensureReady().then(n, r).finally(() => {
|
||||
t.removeEventListener("abort", i);
|
||||
});
|
||||
});
|
||||
}
|
||||
throwIfOpenAborted(e) {
|
||||
if (e?.signal?.aborted) throw e.abortError?.() ?? new DOMException("The operation was aborted", "AbortError");
|
||||
}
|
||||
async ensureReady() {
|
||||
await this.realm.ensureReady();
|
||||
}
|
||||
run(e, t) {
|
||||
let n = e.requireLive(this.realm);
|
||||
return this.realm.run(() => t(n));
|
||||
}
|
||||
close(e, t) {
|
||||
let n = e.detachForClose();
|
||||
this.live.delete(e), n && this.realm.run(() => t(n));
|
||||
}
|
||||
}, ae = class {
|
||||
archive;
|
||||
failure;
|
||||
proxy;
|
||||
constructor(e, t, n) {
|
||||
this.host = e, this.generation = n, this.archive = t, this.proxy = new Proxy(t, { get: (e, t) => {
|
||||
let n = this.host.run(this, (e) => Reflect.get(e, t, e));
|
||||
return typeof n == "function" ? (...e) => this.host.run(this, (n) => {
|
||||
let r = Reflect.get(n, t, n);
|
||||
return Reflect.apply(r, n, e);
|
||||
}) : n;
|
||||
} });
|
||||
}
|
||||
run(e) {
|
||||
return this.host.run(this, e);
|
||||
}
|
||||
close(e) {
|
||||
this.host.close(this, e);
|
||||
}
|
||||
requireLive(e) {
|
||||
if (this.failure) throw this.failure;
|
||||
if (e.assertCurrent(this.generation), !this.archive) throw Error("WASM archive session belongs to a discarded runtime generation");
|
||||
return this.archive;
|
||||
}
|
||||
detachForClose() {
|
||||
let e = this.archive;
|
||||
return this.archive = void 0, this.failure ? void 0 : e;
|
||||
}
|
||||
poison(e) {
|
||||
let t = this.archive;
|
||||
this.failure = e, this.archive = void 0, m(t);
|
||||
}
|
||||
}, oe = /* @__PURE__ */ e({
|
||||
PptxArchive: () => T,
|
||||
default: () => Y,
|
||||
extract_font: () => se,
|
||||
extract_image: () => ce,
|
||||
extract_media: () => E,
|
||||
initSync: () => ue,
|
||||
parse_pptx: () => D,
|
||||
pptx_to_markdown: () => O,
|
||||
reinit: () => de
|
||||
}), T = class {
|
||||
__destroy_into_raw() {
|
||||
let e = this.__wbg_ptr;
|
||||
return this.__wbg_ptr = 0, A.unregister(this), e;
|
||||
}
|
||||
free() {
|
||||
let e = this.__destroy_into_raw();
|
||||
q.__wbg_pptxarchive_free(e, 0);
|
||||
}
|
||||
acknowledge_slide(e, t) {
|
||||
let n = q.pptxarchive_acknowledge_slide(this.__wbg_ptr, e, t);
|
||||
if (n[1]) throw B(n[0]);
|
||||
}
|
||||
assert_healthy() {
|
||||
let e = q.pptxarchive_assert_healthy(this.__wbg_ptr);
|
||||
if (e[1]) throw B(e[0]);
|
||||
}
|
||||
cancel_slide() {
|
||||
q.pptxarchive_cancel_slide(this.__wbg_ptr);
|
||||
}
|
||||
close_presentation_session() {
|
||||
q.pptxarchive_close_presentation_session(this.__wbg_ptr);
|
||||
}
|
||||
extract_font(e) {
|
||||
let t = z(e, q.__wbindgen_malloc, q.__wbindgen_realloc), n = K, r = q.pptxarchive_extract_font(this.__wbg_ptr, t, n);
|
||||
if (r[3]) throw B(r[2]);
|
||||
var i = j(r[0], r[1]).slice();
|
||||
return q.__wbindgen_free(r[0], r[1] * 1, 1), i;
|
||||
}
|
||||
extract_image(e) {
|
||||
let t = z(e, q.__wbindgen_malloc, q.__wbindgen_realloc), n = K, r = q.pptxarchive_extract_image(this.__wbg_ptr, t, n);
|
||||
if (r[3]) throw B(r[2]);
|
||||
var i = j(r[0], r[1]).slice();
|
||||
return q.__wbindgen_free(r[0], r[1] * 1, 1), i;
|
||||
}
|
||||
extract_media(e) {
|
||||
let t = z(e, q.__wbindgen_malloc, q.__wbindgen_realloc), n = K, r = q.pptxarchive_extract_media(this.__wbg_ptr, t, n);
|
||||
if (r[3]) throw B(r[2]);
|
||||
var i = j(r[0], r[1]).slice();
|
||||
return q.__wbindgen_free(r[0], r[1] * 1, 1), i;
|
||||
}
|
||||
constructor(e, t, n, r) {
|
||||
let i = R(e, q.__wbindgen_malloc), a = K, o = q.pptxarchive_new(i, a, !L(t), L(t) ? BigInt(0) : t, !L(n), L(n) ? BigInt(0) : n, !L(r), L(r) ? BigInt(0) : r);
|
||||
if (o[2]) throw B(o[1]);
|
||||
return this.__wbg_ptr = o[0] >>> 0, A.register(this, this.__wbg_ptr, this), this;
|
||||
}
|
||||
parse() {
|
||||
let e = q.pptxarchive_parse(this.__wbg_ptr);
|
||||
if (e[3]) throw B(e[2]);
|
||||
var t = j(e[0], e[1]).slice();
|
||||
return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
||||
}
|
||||
presentation_bootstrap() {
|
||||
let e = q.pptxarchive_presentation_bootstrap(this.__wbg_ptr);
|
||||
if (e[3]) throw B(e[2]);
|
||||
var t = j(e[0], e[1]).slice();
|
||||
return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
||||
}
|
||||
pull_slide(e, t, n, r) {
|
||||
let i = q.pptxarchive_pull_slide(this.__wbg_ptr, e, t, n, r);
|
||||
if (i[3]) throw B(i[2]);
|
||||
var a = j(i[0], i[1]).slice();
|
||||
return q.__wbindgen_free(i[0], i[1] * 1, 1), a;
|
||||
}
|
||||
resource_usage() {
|
||||
let e = q.pptxarchive_resource_usage(this.__wbg_ptr);
|
||||
if (e[3]) throw B(e[2]);
|
||||
var t = j(e[0], e[1]).slice();
|
||||
return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
||||
}
|
||||
slide_cursor_resource_usage() {
|
||||
let e = q.pptxarchive_slide_cursor_resource_usage(this.__wbg_ptr);
|
||||
if (e[3]) throw B(e[2]);
|
||||
var t = j(e[0], e[1]).slice();
|
||||
return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
||||
}
|
||||
to_markdown() {
|
||||
let e, t;
|
||||
try {
|
||||
let i = q.pptxarchive_to_markdown(this.__wbg_ptr);
|
||||
var n = i[0], r = i[1];
|
||||
if (i[3]) throw n = 0, r = 0, B(i[2]);
|
||||
return e = n, t = r, P(n, r);
|
||||
} finally {
|
||||
q.__wbindgen_free(e, t, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
Symbol.dispose && (T.prototype[Symbol.dispose] = T.prototype.free);
|
||||
function se(e, t, n, r) {
|
||||
let i = R(e, q.__wbindgen_malloc), a = K, o = z(t, q.__wbindgen_malloc, q.__wbindgen_realloc), s = K, c = q.extract_font(i, a, o, s, !L(n), L(n) ? BigInt(0) : n, !L(r), L(r) ? BigInt(0) : r);
|
||||
if (c[3]) throw B(c[2]);
|
||||
var l = j(c[0], c[1]).slice();
|
||||
return q.__wbindgen_free(c[0], c[1] * 1, 1), l;
|
||||
}
|
||||
function ce(e, t, n, r) {
|
||||
let i = R(e, q.__wbindgen_malloc), a = K, o = z(t, q.__wbindgen_malloc, q.__wbindgen_realloc), s = K, c = q.extract_image(i, a, o, s, !L(n), L(n) ? BigInt(0) : n, !L(r), L(r) ? BigInt(0) : r);
|
||||
if (c[3]) throw B(c[2]);
|
||||
var l = j(c[0], c[1]).slice();
|
||||
return q.__wbindgen_free(c[0], c[1] * 1, 1), l;
|
||||
}
|
||||
function E(e, t, n, r) {
|
||||
let i = R(e, q.__wbindgen_malloc), a = K, o = z(t, q.__wbindgen_malloc, q.__wbindgen_realloc), s = K, c = q.extract_media(i, a, o, s, !L(n), L(n) ? BigInt(0) : n, !L(r), L(r) ? BigInt(0) : r);
|
||||
if (c[3]) throw B(c[2]);
|
||||
var l = j(c[0], c[1]).slice();
|
||||
return q.__wbindgen_free(c[0], c[1] * 1, 1), l;
|
||||
}
|
||||
function D(e, t, n) {
|
||||
let r = R(e, q.__wbindgen_malloc), i = K, a = q.parse_pptx(r, i, !L(t), L(t) ? BigInt(0) : t, !L(n), L(n) ? BigInt(0) : n);
|
||||
if (a[3]) throw B(a[2]);
|
||||
var o = j(a[0], a[1]).slice();
|
||||
return q.__wbindgen_free(a[0], a[1] * 1, 1), o;
|
||||
}
|
||||
function O(e, t, n) {
|
||||
let r, i;
|
||||
try {
|
||||
let s = R(e, q.__wbindgen_malloc), c = K, l = q.pptx_to_markdown(s, c, !L(t), L(t) ? BigInt(0) : t, !L(n), L(n) ? BigInt(0) : n);
|
||||
var a = l[0], o = l[1];
|
||||
if (l[3]) throw a = 0, o = 0, B(l[2]);
|
||||
return r = a, i = o, P(a, o);
|
||||
} finally {
|
||||
q.__wbindgen_free(r, i, 1);
|
||||
}
|
||||
}
|
||||
function k() {
|
||||
return {
|
||||
__proto__: null,
|
||||
"./pptx_parser_bg.js": {
|
||||
__proto__: null,
|
||||
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(e, t) {
|
||||
throw Error(P(e, t));
|
||||
},
|
||||
__wbg_error_a6fa202b58aa1cd3: function(e, t) {
|
||||
let n, r;
|
||||
try {
|
||||
n = e, r = t, console.error(P(e, t));
|
||||
} finally {
|
||||
q.__wbindgen_free(n, r, 1);
|
||||
}
|
||||
},
|
||||
__wbg_new_227d7c05414eb861: function() {
|
||||
return /* @__PURE__ */ Error();
|
||||
},
|
||||
__wbg_stack_3b0d974bbf31e44f: function(e, t) {
|
||||
let n = t.stack, r = z(n, q.__wbindgen_malloc, q.__wbindgen_realloc), i = K;
|
||||
N().setInt32(e + 4, i, !0), N().setInt32(e + 0, r, !0);
|
||||
},
|
||||
__wbindgen_cast_0000000000000001: function(e, t) {
|
||||
return P(e, t);
|
||||
},
|
||||
__wbindgen_init_externref_table: function() {
|
||||
let e = q.__wbindgen_externrefs, t = e.grow(4);
|
||||
e.set(0, void 0), e.set(t + 0, void 0), e.set(t + 1, null), e.set(t + 2, !0), e.set(t + 3, !1);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
var A = typeof FinalizationRegistry > "u" ? {
|
||||
register: () => {},
|
||||
unregister: () => {}
|
||||
} : new FinalizationRegistry((e) => q.__wbg_pptxarchive_free(e >>> 0, 1));
|
||||
function j(e, t) {
|
||||
return e >>>= 0, I().subarray(e / 1, e / 1 + t);
|
||||
}
|
||||
var M = null;
|
||||
function N() {
|
||||
return (M === null || M.buffer.detached === !0 || M.buffer.detached === void 0 && M.buffer !== q.memory.buffer) && (M = new DataView(q.memory.buffer)), M;
|
||||
}
|
||||
function P(e, t) {
|
||||
return e >>>= 0, W(e, t);
|
||||
}
|
||||
var F = null;
|
||||
function I() {
|
||||
return (F === null || F.byteLength === 0) && (F = new Uint8Array(q.memory.buffer)), F;
|
||||
}
|
||||
function L(e) {
|
||||
return e == null;
|
||||
}
|
||||
function R(e, t) {
|
||||
let n = t(e.length * 1, 1) >>> 0;
|
||||
return I().set(e, n / 1), K = e.length, n;
|
||||
}
|
||||
function z(e, t, n) {
|
||||
if (n === void 0) {
|
||||
let n = G.encode(e), r = t(n.length, 1) >>> 0;
|
||||
return I().subarray(r, r + n.length).set(n), K = n.length, r;
|
||||
}
|
||||
let r = e.length, i = t(r, 1) >>> 0, a = I(), o = 0;
|
||||
for (; o < r; o++) {
|
||||
let t = e.charCodeAt(o);
|
||||
if (t > 127) break;
|
||||
a[i + o] = t;
|
||||
}
|
||||
if (o !== r) {
|
||||
o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
|
||||
let t = I().subarray(i + o, i + r), a = G.encodeInto(e, t);
|
||||
o += a.written, i = n(i, r, o, 1) >>> 0;
|
||||
}
|
||||
return K = o, i;
|
||||
}
|
||||
function B(e) {
|
||||
let t = q.__wbindgen_externrefs.get(e);
|
||||
return q.__externref_table_dealloc(e), t;
|
||||
}
|
||||
var V = new TextDecoder("utf-8", {
|
||||
ignoreBOM: !0,
|
||||
fatal: !0
|
||||
});
|
||||
V.decode();
|
||||
var H = 2146435072, U = 0;
|
||||
function W(e, t) {
|
||||
return U += t, U >= H && (V = new TextDecoder("utf-8", {
|
||||
ignoreBOM: !0,
|
||||
fatal: !0
|
||||
}), V.decode(), U = t), V.decode(I().subarray(e, e + t));
|
||||
}
|
||||
var G = new TextEncoder();
|
||||
"encodeInto" in G || (G.encodeInto = function(e, t) {
|
||||
let n = G.encode(e);
|
||||
return t.set(n), {
|
||||
read: e.length,
|
||||
written: n.length
|
||||
};
|
||||
});
|
||||
var K = 0, q;
|
||||
function J(e, t) {
|
||||
return q = e.exports, M = null, F = null, q.__wbindgen_start(), q;
|
||||
}
|
||||
async function le(e, t) {
|
||||
if (typeof Response == "function" && e instanceof Response) {
|
||||
if (typeof WebAssembly.instantiateStreaming == "function") try {
|
||||
return await WebAssembly.instantiateStreaming(e, t);
|
||||
} catch (t) {
|
||||
if (e.ok && n(e.type) && e.headers.get("Content-Type") !== "application/wasm") console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", t);
|
||||
else throw t;
|
||||
}
|
||||
let r = await e.arrayBuffer();
|
||||
return await WebAssembly.instantiate(r, t);
|
||||
} else {
|
||||
let n = await WebAssembly.instantiate(e, t);
|
||||
return n instanceof WebAssembly.Instance ? {
|
||||
instance: n,
|
||||
module: e
|
||||
} : n;
|
||||
}
|
||||
function n(e) {
|
||||
switch (e) {
|
||||
case "basic":
|
||||
case "cors":
|
||||
case "default": return !0;
|
||||
}
|
||||
return !1;
|
||||
}
|
||||
}
|
||||
function ue(e) {
|
||||
if (q !== void 0) return q;
|
||||
e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module: e} = e : console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));
|
||||
let t = k();
|
||||
return e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)), J(new WebAssembly.Instance(e, t), e);
|
||||
}
|
||||
async function Y(e) {
|
||||
if (q !== void 0) return q;
|
||||
e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module_or_path: e} = e : console.warn("using deprecated parameters for the initialization function; pass a single object instead"));
|
||||
let t = k();
|
||||
(typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
|
||||
let { instance: n, module: r } = await le(await e, t);
|
||||
return J(n, r);
|
||||
}
|
||||
async function de(e) {
|
||||
return q = void 0, M = null, F = null, Y(e);
|
||||
}
|
||||
//#endregion
|
||||
//#region packages/pptx/src/internal/node-acquisition.ts
|
||||
var X, Z;
|
||||
function fe(e) {
|
||||
if (!Z) X = e, Z = new w(oe, e);
|
||||
else if (X !== e) throw Error("PPTX runtime was already initialized with another WebAssembly.Module");
|
||||
return Z;
|
||||
}
|
||||
async function pe(e, n, i = {}) {
|
||||
let s = r(i), c = new d({
|
||||
enabled: s.debug || s.onResourceMetrics !== void 0,
|
||||
format: "pptx",
|
||||
mode: "node",
|
||||
scope: "session",
|
||||
policy: s.policy,
|
||||
onMetrics: s.onResourceMetrics,
|
||||
emitToConsole: s.debug
|
||||
});
|
||||
c.setSourceBytes(e.byteLength);
|
||||
let l;
|
||||
try {
|
||||
Q(i.signal);
|
||||
let [r, a, u] = o(s.policy), d = T;
|
||||
l = await fe(n).open(() => new d(e, r, a, u), {
|
||||
signal: i.signal,
|
||||
abortError: $,
|
||||
disposeOnAbort: (e) => e.free()
|
||||
}), Q(i.signal);
|
||||
let f = l.proxy, p = t(JSON.parse(new TextDecoder().decode(f.presentation_bootstrap())));
|
||||
return c.checkpoint("presentation bootstrap ready"), {
|
||||
archive: f,
|
||||
bootstrap: p,
|
||||
metrics: c,
|
||||
closeArchive: () => l?.close((e) => e.free())
|
||||
};
|
||||
} catch (e) {
|
||||
try {
|
||||
l?.close((e) => e.free());
|
||||
} catch {}
|
||||
let t = a(e) ?? e;
|
||||
throw c.fail(t), t;
|
||||
}
|
||||
}
|
||||
function Q(e) {
|
||||
if (e?.aborted) throw $();
|
||||
}
|
||||
function $() {
|
||||
let e = /* @__PURE__ */ Error("PPTX presentation session was aborted");
|
||||
return e.name = "AbortError", e;
|
||||
}
|
||||
//#endregion
|
||||
//#region packages/pptx/src/internal/session.ts
|
||||
var me = /* @__PURE__ */ e({ renderSlide: () => n });
|
||||
//#endregion
|
||||
export { x as a, re as i, pe as n, w as r, me as t };
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@wekan/office-open-xml-viewer",
|
||||
"version": "0.85.2-wekan.1",
|
||||
"description": "Minimal browser-only OOXML viewer fork for WeKan attachments",
|
||||
"description": "Minimal OOXML viewer fork for WeKan attachments",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"sideEffects": false,
|
||||
@@ -9,7 +9,8 @@
|
||||
"exports": {
|
||||
"./docx": "./dist/docx.mjs",
|
||||
"./xlsx": "./dist/xlsx.mjs",
|
||||
"./pptx": "./dist/pptx.mjs"
|
||||
"./pptx": "./dist/pptx.mjs",
|
||||
"./node": "./dist/node.mjs"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
|
||||
@@ -23,6 +23,325 @@ Releases per day:
|
||||
| 14 | 1 |
|
||||
| 15 | 1 |
|
||||
| 16 | 1 |
|
||||
| 18 | 1 |
|
||||
| 19 | 1 |
|
||||
|
||||
# v13.16 2026-11-19 WeKan ® release
|
||||
|
||||
**In short:** **ListLockBulkBleed** is fixed, and a list that refuses a role
|
||||
now also refuses that role's bulk writes, dependency lines, rule actions and
|
||||
changes to the list or swimlane itself. Administrators can give chosen users,
|
||||
teams and organizations a smaller WeKan with opt-in **feature profiles**. A
|
||||
server no longer runs out of memory in the hourly **History integrity audit**,
|
||||
**scheduled rules** can create cards again, and **Card Excel export** and
|
||||
clearing a card's text work again.
|
||||
|
||||
This release fixes the following CRITICAL SECURITY ISSUE of [ListLockBulkBleed](https://wekan.fi/hall-of-fame/listlockbulkbleed/):
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/ba3d94390ba724344a2d5cfe50e9dee3cc6f8d89">Bulk REST card writes and server-side card writes ask the list's role exception</a>. Thanks to immanuwell and xet7.</summary>
|
||||
|
||||
[GHSA-83w9-74mx-7v83](https://github.com/wekan/wekan/security/advisories/GHSA-83w9-74mx-7v83),
|
||||
CWE-863. A board admin can refuse a role write access in one list (#4527).
|
||||
`DELETE /api/boards/:boardId/cards/bulk` and
|
||||
`POST /api/boards/:boardId/cards/labels` take their cards from the body, so no
|
||||
URL names a list, and asked only for board write access; the methods
|
||||
`archiveSelectedCards`, `copyCard` and `createLinkedCard` write from server
|
||||
code, past the Cards allow/deny rules. A normal member the list refused could
|
||||
permanently delete its cards in one request, relabel and archive them, and copy
|
||||
or link new cards into it.
|
||||
|
||||
The bulk routes now read every card and ask each list before the first write:
|
||||
any refusal is a 403 and nothing changes, and each removal and relabel is keyed
|
||||
on the list that was checked. The refusal shows in Admin Panel / Problems as
|
||||
ListLockBulkBleed (`authz.list-locked-bulk`, medium, never disables). The
|
||||
methods answer `not-authorized` and are not recorded, because Copy Card and
|
||||
Multi-Selection reach them in ordinary use. The same shape was fixed in twelve
|
||||
more paths: converting a card to a board, adding a subtask,
|
||||
`createCardWithDueDate`, the iCalendar import, sending and receiving board
|
||||
email, creating a version-control issue, moving board objects, History and
|
||||
position-history undo and redo, renaming an attachment, the scoped import and a
|
||||
card's rule button. Dependency lines keep their own board-wide rule.
|
||||
`tests/listLockBulkBleed.test.cjs` runs the gate on the reporter's board and
|
||||
pins every path; `tests/playwright/specs/list-lock-bulk.e2e.js` replays the
|
||||
proof of concept.
|
||||
|
||||
</details>
|
||||
|
||||
and adds the following new feature:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/fc21b0b177dc8f8902efa39d0f89c8b041c7cf2d">Feature profiles hide features from the users, teams and organizations an administrator chooses</a>. Thanks to mimZD and xet7.</summary>
|
||||
|
||||
[#6837](https://github.com/wekan/wekan/issues/6837): Admin Panel / Settings /
|
||||
Visibility / Features gains feature profiles - a name, the optional features it
|
||||
hides, and the users, teams and organizations it applies to. It is strictly
|
||||
opt-in: a user with no profile sees everything, a profile only hides and changes
|
||||
no data or permission, and the member menu tells the user which profile hides
|
||||
how many features, so nothing looks missing. Every place that hides a disabled
|
||||
feature follows it. The new strings are in every language.
|
||||
`tests/featureProfiles.test.cjs` and `feature-profiles.e2e.js` cover it.
|
||||
|
||||
</details>
|
||||
|
||||
and fixes the following bugs:
|
||||
|
||||
**Per-list role exceptions** - what else a list that refuses a role refuses,
|
||||
as decided after ListLockBulkBleed.
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/da6d9d39b8bd209006fc02fe735f1c277a2be693">Dependency lines follow the card's list</a>. Thanks to xet7.</summary>
|
||||
|
||||
A dependency line is stored on its source card, but it followed only the
|
||||
board-wide dependency rule, so a role a list refused could still add, change and
|
||||
remove lines on that list's cards. Now the methods answer `not-authorized`, the
|
||||
REST dependency routes answer 403 recorded as ListLockBleed, and the import
|
||||
skips such lines; board and site admins are not restricted.
|
||||
`tests/listLockDependencies.test.cjs` and `tests/listPermissions.test.cjs` pin
|
||||
it, and `list-lock-bulk.e2e.js` replays it over REST.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/3202a1d7ac1027b41af5a5dfbe03893ccbc89c36">Deleting, archiving or moving a list or swimlane follows the list</a>. Thanks to xet7.</summary>
|
||||
|
||||
These do the same to the cards in them, yet were gated by board write access
|
||||
alone. A list that refuses a role now also refuses that role deleting,
|
||||
restoring, archiving or moving it, and deleting, archiving or moving a swimlane
|
||||
holding its cards - on DDP, REST (403, recorded as ListLockBleed) and client
|
||||
writes alike. The list menu no longer offers its archive actions there.
|
||||
Renaming and reordering stay allowed, and board admins are never restricted.
|
||||
`tests/listLockStructure.test.cjs` pins it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/ee24453dcb5d9ed8af5c07b848cbd5bd8979ae28">A rule action into a refusing list is skipped, and the rest of the rule runs</a>. Thanks to xet7.</summary>
|
||||
|
||||
A rule's move, archive, create-card, copy, link and list actions checked only
|
||||
board write access. Each now asks the lists it writes in as the user who
|
||||
triggered the rule; a refusing list skips that action and shows in Admin Panel /
|
||||
Problems as ListLockRule (detected, low), since a rule meeting a locked list is
|
||||
not an attack. `tests/listLockRules.test.cjs` pins it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/a0f36819610e6d0aa9c170340f8421c1b7fc2bbe">List Sync's rule replay skips such an action too</a>. Thanks to xet7.</summary>
|
||||
|
||||
The journaled List Sync replay still wrote with board write access only. Each of
|
||||
its list-writing runners now decides before saving its command, records a
|
||||
durable skip and lets the rest of the plan run; a replay reads the saved skip,
|
||||
so it never re-decides and never skips a half-finished action.
|
||||
`tests/listSyncRuleListSkip.test.cjs` pins it.
|
||||
|
||||
</details>
|
||||
|
||||
**Server memory and timed jobs** - what runs on its own, every hour.
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/cfd9a62466a64b58d514d46c3c6560f003704523">Swap alone is not high RAM usage, and resource monitors are not named like vulnerabilities</a>. Thanks to xet7.</summary>
|
||||
|
||||
A laptop with many programs open showed "RamBleed, high: high RAM usage started
|
||||
(>= 90%)" at RAM 52% and swap 60%: swap at 25% started a period by itself. Swap
|
||||
now counts only while RAM is also tight, the row says what started it, and only
|
||||
RAM near full is high severity. The RAM, CPU, disk and speed rows are named for
|
||||
what happened (HighRamUsage, HighCpuUsage, HighDiskUsage, SlowRequest) without a
|
||||
CWE, and old rows are renamed at startup. `tests/ramHighTracker.test.cjs` and
|
||||
`tests/resourceStreamNames.test.cjs` cover it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/7459c5bde66ea22966526a7179eede62b5233f0e">The History integrity audit streams each board instead of loading it whole</a>. Thanks to xet7.</summary>
|
||||
|
||||
A production server died twice with "JavaScript heap out of memory", 42 and 74
|
||||
seconds after the hourly History integrity audit started, both times in its
|
||||
first run after a restart. The audit fetched each board's whole History - every
|
||||
row with its full previous and new content - into memory. It now streams each
|
||||
board through a cursor and keeps only hashes and small summaries; the findings
|
||||
are the same, in the same order. `tests/historyIntegrityStreaming.test.cjs`
|
||||
compares both on forked, tampered and orphaned chains and fails if a board is
|
||||
fetched whole.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/f23695cc1bf6447fb38693ea8fe2e1ce4ab51f8f">Scheduled rules act as the board's admin, so a created card has an author</a>. Thanks to xet7.</summary>
|
||||
|
||||
Every run of a scheduled rule with a "create card" action failed with "User ID
|
||||
is required in cards insertAsync". Scheduled rules, auto-archive and attachment
|
||||
retention acted as `board.createdBy`, but boards have no such field, so they ran
|
||||
as nobody. They now act as the board's first active admin
|
||||
(`models/lib/boardActor.js`), and the rule's new card names its author.
|
||||
`tests/boardActor.test.cjs` scans the tree so nothing reads `board.createdBy`
|
||||
again.
|
||||
|
||||
</details>
|
||||
|
||||
**Cards** - exporting a card, and clearing its text.
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/997c6d88ad4c67850831aa99de1f874765c90a41">Card Excel export works with only Description or only Labels selected</a>. Thanks to AhmedLukman and xet7.</summary>
|
||||
|
||||
The card Excel exporter loads the board, list and swimlane only when the
|
||||
selected fields need them, and passes `null` for the rest. The shared card
|
||||
document builder defaulted them with `board = {}`, which applies only to
|
||||
`undefined`, so it read `.title` of `null` and the download ended in "Export
|
||||
failed". The titles are optional now (`board?.title || ''`), which also covers
|
||||
a PDF card export of a card with no swimlane.
|
||||
`tests/cardExportDocument.test.cjs`
|
||||
fails on the old code with that TypeError, and
|
||||
`tests/playwright/specs/card-excel-field-selection.e2e.js` downloads both
|
||||
workbooks from the real route and checks that each holds only its own field.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/c59c751547aa36fabda088eed4cfd7b8ce6b37e4">REST card update can clear a card title</a>. Thanks to AhmedLukman and xet7.</summary>
|
||||
|
||||
`PUT` with `{"title":""}` answered 404 and kept the old title, because the
|
||||
handler read the title by truthiness. An empty title is a value now, a title
|
||||
that is not a string is a 400 before anything is written, and
|
||||
[an update that matches no card](https://github.com/wekan/wekan/commit/79a98822cbe6f1aaa0da0ad2646c7b2cb4fb2726)
|
||||
is a 404 again. `tests/restCardSort.test.cjs` and
|
||||
`tests/playwright/specs/rest-card-title.e2e.js` cover it.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/aacb2fd4d68c4873bd01685dceee172c24e48379">A cleared card title or description can be undone and redone</a>. Thanks to AhmedLukman and xet7.</summary>
|
||||
|
||||
Clearing a value is an edit kept in History, not a deletion, so it is
|
||||
restorable whatever Admin Panel / Problems / Delete says. Undo already put the
|
||||
old text back, but redo and Restore of the clearing threw: collection2 removes
|
||||
`''` from `$set` and then refuses the empty modifier. History, the card details,
|
||||
the board description and the REST card update now write `''` as it is, and a
|
||||
REST title of only spaces no longer fails with a 500.
|
||||
`tests/emptyStringClearWrites.test.cjs` and
|
||||
`tests/playwright/specs/card-clear-undo-redo.e2e.js` cover it.
|
||||
|
||||
</details>
|
||||
|
||||
and has the following developer-facing changes:
|
||||
|
||||
**Card Excel export** - the browser test for the fix above.
|
||||
|
||||
- [A Playwright spec drives the card Excel export with one field selected](https://github.com/wekan/wekan/commit/320a3ca8672b6a70867baa0c3f657d3a5eb53536).
|
||||
Thanks to AhmedLukman and xet7.
|
||||
|
||||
**Node test suites** - a sandbox that resolves its helpers.
|
||||
|
||||
- [The attachment cleanup test resolves the Playwright helpers' own requires](https://github.com/wekan/wekan/commit/74dd0b705e21ecb4723dcb8a6055c7edc5aae9aa).
|
||||
Thanks to xet7.
|
||||
|
||||
**WeLite REST API** - the upstream REST specs, run against the native WeLite
|
||||
target as well.
|
||||
|
||||
- [Ownership selection](https://github.com/wekan/wekan/commit/049b628a0310a33026de423a590a6c33489d5b41). Thanks to xet7.
|
||||
- [Card title edits](https://github.com/wekan/wekan/commit/22dae19a64325695a17dd90ea7f4675ffeecfbed). Thanks to xet7.
|
||||
- [Board card sorting](https://github.com/wekan/wekan/commit/5f06b28aef680d2682e7fa4e965a0e797b502214). Thanks to xet7.
|
||||
- [Archive and restore](https://github.com/wekan/wekan/commit/11fc468ff77f9126b97d1eca72de9c2d90314022). Thanks to xet7.
|
||||
- [Subtasks](https://github.com/wekan/wekan/commit/db3f489ab27f672c9d1ab4db5feaf3a116eba928). Thanks to xet7.
|
||||
- [Overtime](https://github.com/wekan/wekan/commit/2033c177ce452f59bc6cb9d3d07a6566169ed015). Thanks to xet7.
|
||||
- [People features](https://github.com/wekan/wekan/commit/72ee1c8b231896586086ac7067ea6dd96135506c). Thanks to xet7.
|
||||
- [User update](https://github.com/wekan/wekan/commit/e4115e68905f4b9a2d521a749a9fe77dde322aa9). Thanks to xet7.
|
||||
- [Checklists](https://github.com/wekan/wekan/commit/ede46c7a9873f20864a77eeda7cb5007762824ff). Thanks to xet7.
|
||||
- [Write-route scope](https://github.com/wekan/wekan/commit/399a8defec10165e1cf7fa18faa5113d5bb7176f). Thanks to xet7.
|
||||
- [Assignment removal](https://github.com/wekan/wekan/commit/8abb9504bb1f714873419f7b481650d758294ef7). Thanks to xet7.
|
||||
- [Dropdown item rename](https://github.com/wekan/wekan/commit/b8fd94a7e70bf65e85b8d06b491e4d3d13e3a9ec). Thanks to xet7.
|
||||
- [Dropdown item deletion](https://github.com/wekan/wekan/commit/f1adc7982eca4aebf8831403f6b4bd219cec51b9). Thanks to xet7.
|
||||
- [Custom-field lifecycle](https://github.com/wekan/wekan/commit/6bf2d53d756e59f494ea50587f62bc467afb7b77). Thanks to xet7.
|
||||
- [Webhook settings](https://github.com/wekan/wekan/commit/f34fee658206ab4d90583f58746067793f10d12a). Thanks to xet7.
|
||||
- [Native Playwright credentials are seeded before an API token is used](https://github.com/wekan/wekan/commit/a9059b7b155aaea4bf9ccb1647a492bab251bb10).
|
||||
Thanks to xet7.
|
||||
|
||||
**WeLite attachments** - the attachment workflows in the native browser.
|
||||
|
||||
- [The upstream card attachment cascade spec](https://github.com/wekan/wekan/commit/26e27f62c4b6b9e2bcd1e10623de7dd3e0b31b5e). Thanks to xet7.
|
||||
- [Attachment rename, and a missing form token is refused](https://github.com/wekan/wekan/commit/7c3b798a1d0ff6e26b6afa8f49c3359a73ba526a). Thanks to xet7.
|
||||
- [Direct attachment removal in Chromium](https://github.com/wekan/wekan/commit/c060c6d2db51b2fc22fab72dadecd90ab173bd8f). Thanks to xet7.
|
||||
- [The Version Control Attachments workflow](https://github.com/wekan/wekan/commit/b6bc2b200ce7545ca43b2f6b3a3ac39874227812). Thanks to xet7.
|
||||
- [The Finnish attachment preview](https://github.com/wekan/wekan/commit/c5344761d856cf5234e5a12ccc61f336c6a9a0e8). Thanks to xet7.
|
||||
- [The cascade spec reuses its browser session](https://github.com/wekan/wekan/commit/bd6b00c5f437237a3cab8bf7d51172d948e45462). Thanks to xet7.
|
||||
- [The attachment browser workflow gets the time it needs](https://github.com/wekan/wekan/commit/333928f123f9dd061042c8b18b0e44663dc76d04). Thanks to xet7.
|
||||
|
||||
**WeLite boards and sessions** - export links and session revocation.
|
||||
|
||||
- [Both export links on the board](https://github.com/wekan/wekan/commit/075e6dbe730291543c8a384ce58429167976741c). Thanks to xet7.
|
||||
- [Revoking one browser session](https://github.com/wekan/wekan/commit/e30c439fa7f4e82bb2f4f949513aa1fcc4287953). Thanks to xet7.
|
||||
|
||||
**WeLite right-to-left captions** - Arabic table captions read in their own
|
||||
direction.
|
||||
|
||||
- [People table captions](https://github.com/wekan/wekan/commit/f1fe22ac16254fa3d7f14df6c09dd3f250c7d61a). Thanks to xet7.
|
||||
- [Regional Arabic People table captions](https://github.com/wekan/wekan/commit/8c1152f23468e76d07c964b5f1358900372c8248). Thanks to xet7.
|
||||
- [Arabic webhook field captions](https://github.com/wekan/wekan/commit/6f7292cffdfb42a7accf4955735bbd8a43d4472a). Thanks to xet7.
|
||||
- [Regional Arabic attachment captions](https://github.com/wekan/wekan/commit/ba9504d6db8dbd2adf8e72b98cb10c991a379cda). Thanks to xet7.
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
|
||||
# v13.15 2026-11-18 WeKan ® release
|
||||
|
||||
**In short:** **RaceBleed** is fixed: deleting a card while somebody moves it
|
||||
to another board no longer destroys its checklists, comments and attachments
|
||||
while the card itself survives there, and a member deleting a card that was
|
||||
just moved keeps their account. REST handlers now answer **404, not 500**, for
|
||||
a swimlane, user or board that is not there.
|
||||
|
||||
This release fixes the following CRITICAL SECURITY ISSUE of [RaceBleed](https://wekan.fi/hall-of-fame/racebleed/):
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/c7a496c9cfd8f30e5bda16515eedeaa2ec80dc65">A card's children are destroyed only for a card whose own removal happened</a>. Thanks to xingmuse and xet7.</summary>
|
||||
|
||||
[GHSA-3vjg-3p4q-8fwh](https://github.com/wekan/wekan/security/advisories/GHSA-3vjg-3p4q-8fwh),
|
||||
CWE-367. The REST card delete looked the card up on the board the caller was
|
||||
authorised for, destroyed its checklists, checklist items, comments,
|
||||
attachments and subcards by card id, and removed the card itself last, keyed
|
||||
on that board and list. A move to another board landing in between left the
|
||||
card alive on a board the deleter cannot read, stripped of every child, with
|
||||
both requests answering 200. Every hooked removal had the same shape:
|
||||
collection-hooks runs `Cards.before.remove`, where the cascade was, and then
|
||||
removes by the caller's original selector - a swimlane, a delete batch, a
|
||||
parent - which a moved card no longer matches. The custom-field link clean-up
|
||||
did the same to the cards linked to it.
|
||||
|
||||
The card document is now the claim (`models/lib/claimedCardRemoval.js`): the
|
||||
single and bulk REST deletes remove the card first and destroy its children
|
||||
only when that removal matched, and the hooked removals cascade from
|
||||
`Cards.after.remove`, only for a card that is really gone. A list deletion
|
||||
removes a card only while it is still in that list, and the REST board move
|
||||
that loses to a delete is a 404 instead of a 500.
|
||||
|
||||
A delete that lost the race, or arrived after the card was moved away from
|
||||
the named board, is refused and shows in Admin Panel / Problems as RaceBleed
|
||||
(`authz.card-delete-race`, medium). It never disables the account: a stale
|
||||
view is not an attack, and PurgeBleed's critical record used to disable a
|
||||
member who deleted a card somebody had just moved.
|
||||
`tests/claimedCardRemoval.test.cjs` replays the reported race and scans
|
||||
`server/` for any cascade before or without the card's removal;
|
||||
`tests/playwright/specs/race-bleed.e2e.js` races twelve moves against
|
||||
deletes and checks that a surviving card always keeps its checklist.
|
||||
|
||||
</details>
|
||||
|
||||
and fixes the following bug:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/baaeea27e3dc6083b5d6a39d5b44a4e6d26ca088">REST API: a handler's not-found error is a 404, not a 500</a>. Thanks to xet7.</summary>
|
||||
|
||||
`httpStatusForError` knew only `NotFound`, while about two hundred throw sites
|
||||
spell it Meteor's way - `not-found`, `board-not-found`, `user-not-found` and
|
||||
the rest. So deleting a missing swimlane, or adding a board member nobody is
|
||||
called, answered 500 "Internal server error" on a real server, though the
|
||||
unit test, which stubs the helper, saw the 404. Any name that is or ends in
|
||||
`not-found` is now a 404 with its message; anything unknown is still a 500
|
||||
carrying no detail. `tests/restNotFoundStatus.test.cjs` runs the real helper
|
||||
and fails on a spelling it would not map.
|
||||
|
||||
</details>
|
||||
|
||||
Thanks to above GitHub users for their contributions and translators for their translations.
|
||||
|
||||
# v13.14 2026-11-16 WeKan ® release
|
||||
|
||||
|
||||
Generated
+6
-6
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "wekan",
|
||||
"version": "v13.39.0",
|
||||
"version": "v13.45.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "wekan",
|
||||
"version": "v13.39.0",
|
||||
"version": "v13.45.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -41,7 +41,7 @@
|
||||
"bson": "^7.3.1",
|
||||
"chart.js": "^4.6.2",
|
||||
"dhtmlx-gantt": "^10.0.3",
|
||||
"dompurify": "^3.4.17",
|
||||
"dompurify": "^3.5.1",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"fflate": "^0.8.3",
|
||||
"file-type": "^22.2.0",
|
||||
@@ -7602,9 +7602,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/dompurify": {
|
||||
"version": "3.4.17",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.17.tgz",
|
||||
"integrity": "sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==",
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.5.1.tgz",
|
||||
"integrity": "sha512-9fRTM0QJhaSDzR2y4Ym59AW3J3wvNIsQrFQmDilCsExEA/Daks2t5UXh75tE38PB7v8S2/3+JP1UT89Zo9YvEg==",
|
||||
"license": "(MPL-2.0 OR Apache-2.0)",
|
||||
"optionalDependencies": {
|
||||
"@types/trusted-types": "^2.0.7"
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wekan",
|
||||
"version": "v13.39.0",
|
||||
"version": "v13.45.0",
|
||||
"description": "Open-Source kanban",
|
||||
"private": true,
|
||||
"repository": {
|
||||
@@ -89,7 +89,7 @@
|
||||
"bson": "^7.3.1",
|
||||
"chart.js": "^4.6.2",
|
||||
"dhtmlx-gantt": "^10.0.3",
|
||||
"dompurify": "^3.4.17",
|
||||
"dompurify": "^3.5.1",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"fflate": "^0.8.3",
|
||||
"file-type": "^22.2.0",
|
||||
|
||||
@@ -61,7 +61,7 @@ export function getSecureDOMPurifyConfig(urlSchemes = []) {
|
||||
ALLOWED_TAGS: ['a', 'p', 'br', 'strong', 'em', 'u', 'cite', 's', 'del', 'strike', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'img', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'hr', 'div', 'span', 'time', 'details', 'summary', 'input', ...MATHML_TAGS],
|
||||
// Allow safe attributes including href for anchor tags, plus MathML presentation attributes.
|
||||
// 'type', 'checked', 'disabled' are for the task-list checkbox above (#2419).
|
||||
ALLOWED_ATTR: ['href', 'title', 'alt', 'src', 'width', 'height', 'target', 'rel', 'datetime', 'data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block', 'type', 'checked', 'disabled', ...MATHML_ATTR],
|
||||
ALLOWED_ATTR: ['href', 'title', 'alt', 'src', 'width', 'height', 'target', 'rel', 'datetime', 'data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block', 'data-jira-panel', 'type', 'checked', 'disabled', ...MATHML_ATTR],
|
||||
// Allow safe protocols for links
|
||||
// Plus any custom schemes the administrator listed (#3218).
|
||||
ALLOWED_URI_REGEXP: allowedUriRegExp(urlSchemes),
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
'use strict';
|
||||
|
||||
const { workerData, parentPort } = require('node:worker_threads');
|
||||
const { createRequire } = require('node:module');
|
||||
const path = require('node:path');
|
||||
const { pathToFileURL } = require('node:url');
|
||||
|
||||
const { kind, input, rows, edge } = workerData;
|
||||
const load = createRequire(path.join(process.cwd(), 'npm', 'package.json'));
|
||||
const pdfRoot = path.dirname(load.resolve('pdfjs-dist/package.json'));
|
||||
const { createCanvas, loadImage } = createRequire(path.join(pdfRoot, 'package.json'))('@napi-rs/canvas');
|
||||
const sharp = load('sharp');
|
||||
|
||||
const officeOptions = {
|
||||
resourceLimits: { maxArchiveEntryBytes: 16 * 1024 * 1024, maxTotalInflatedBytes: 64 * 1024 * 1024, maxArchiveEntries: 2048 },
|
||||
factory: {
|
||||
createCanvas(width, height) {
|
||||
if (!Number.isFinite(width * height) || width < 1 || height < 1 || width * height > 4_000_000) {
|
||||
throw new Error('Document canvas exceeds the conversion limit');
|
||||
}
|
||||
return createCanvas(width, height);
|
||||
},
|
||||
async loadImage(bytes, target) {
|
||||
let image = sharp(Buffer.from(bytes), { limitInputPixels: 4_000_000, failOn: 'error' });
|
||||
if (target?.width && target?.height) {
|
||||
image = image.resize(Math.min(edge, Math.ceil(target.width)), Math.min(edge, Math.ceil(target.height)),
|
||||
{ fit: 'inside', withoutEnlargement: true });
|
||||
}
|
||||
return loadImage(await image.png().toBuffer());
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async function renderPdf() {
|
||||
const { getDocument, AnnotationMode, VerbosityLevel } = await import(
|
||||
pathToFileURL(load.resolve('pdfjs-dist/legacy/build/pdf.mjs')).href);
|
||||
const local = dir => path.join(pdfRoot, dir) + path.sep;
|
||||
const document = getDocument({
|
||||
data: input, verbosity: VerbosityLevel.ERRORS, useSystemFonts: false, useWorkerFetch: false,
|
||||
cMapUrl: local('cmaps'), cMapPacked: true, standardFontDataUrl: local('standard_fonts'),
|
||||
wasmUrl: local('wasm'), canvasMaxAreaInBytes: 16_000_000, maxImageSize: 16_000_000,
|
||||
});
|
||||
try {
|
||||
const page = await (await document.promise).getPage(1);
|
||||
const original = page.getViewport({ scale: 1 });
|
||||
const viewport = page.getViewport({ scale: edge / Math.max(original.width, original.height) });
|
||||
const canvas = officeOptions.factory.createCanvas(Math.max(1, Math.ceil(viewport.width)),
|
||||
Math.max(1, Math.ceil(viewport.height)));
|
||||
await page.render({ canvas, canvasContext: canvas.getContext('2d'), viewport,
|
||||
annotationMode: AnnotationMode.DISABLE }).promise;
|
||||
return canvas;
|
||||
} finally {
|
||||
await document.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
function drawRows(rows, sheet) {
|
||||
const canvas = createCanvas(edge, sheet ? 320 : edge);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = '#fff';
|
||||
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.font = '17px sans-serif';
|
||||
let y = 16;
|
||||
for (const row of rows) {
|
||||
if (y + 22 > canvas.height) break;
|
||||
const values = sheet ? row.slice(0, 6) : [row.join(' ')];
|
||||
const width = sheet ? 80 : edge - 24;
|
||||
for (let col = 0; col < values.length; col += 1) {
|
||||
const x = 12 + col * width;
|
||||
if (sheet) {
|
||||
ctx.strokeStyle = '#ccd2da';
|
||||
ctx.strokeRect(x, y, width, 22);
|
||||
}
|
||||
ctx.fillStyle = '#202832';
|
||||
ctx.fillText(String(values[col] ?? '').slice(0, 100), x + 3, y + 17, width - 6);
|
||||
}
|
||||
y += 22;
|
||||
}
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function drawDxf(paths) {
|
||||
const canvas = createCanvas(edge, edge);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = '#fff';
|
||||
ctx.fillRect(0, 0, edge, edge);
|
||||
let minX = Infinity;
|
||||
let minY = Infinity;
|
||||
let maxX = -Infinity;
|
||||
let maxY = -Infinity;
|
||||
for (const outline of paths) {
|
||||
for (const [x, y] of outline) {
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
maxY = Math.max(maxY, y);
|
||||
}
|
||||
}
|
||||
const span = Math.max(maxX - minX, maxY - minY);
|
||||
if (!span) throw new Error('DXF geometry has no extent');
|
||||
const size = edge - 32;
|
||||
const left = (edge - (maxX - minX) / span * size) / 2;
|
||||
const top = (edge - (maxY - minY) / span * size) / 2;
|
||||
ctx.strokeStyle = '#202832';
|
||||
ctx.lineWidth = 2;
|
||||
ctx.beginPath();
|
||||
for (const outline of paths) {
|
||||
outline.forEach(([x, y], i) => {
|
||||
const px = left + (x - minX) / span * size;
|
||||
const py = top + (maxY - y) / span * size;
|
||||
if (i === 0) ctx.moveTo(px, py);
|
||||
else ctx.lineTo(px, py);
|
||||
});
|
||||
}
|
||||
ctx.stroke();
|
||||
return canvas;
|
||||
}
|
||||
|
||||
async function renderOffice() {
|
||||
const { openDocxDocument, openXlsxWorkbook, openPptxPresentation } = await import(
|
||||
pathToFileURL(load.resolve('@wekan/office-open-xml-viewer/node')).href);
|
||||
if (kind === 'docx') {
|
||||
const doc = await openDocxDocument(input, officeOptions);
|
||||
try {
|
||||
const { widthPt, heightPt } = doc.pageSize(0);
|
||||
return await doc.renderPage(0, { width: Math.max(1, Math.floor(edge * widthPt / Math.max(widthPt, heightPt))), dpr: 1 });
|
||||
} finally { await doc.close(); }
|
||||
}
|
||||
if (kind === 'pptx') {
|
||||
const doc = await openPptxPresentation(input, officeOptions);
|
||||
try {
|
||||
const width = Math.max(1, Math.floor(edge * doc.slideWidth / Math.max(doc.slideWidth, doc.slideHeight)));
|
||||
const canvas = createCanvas(1, 1);
|
||||
for await (const slide of doc.slides()) {
|
||||
await doc.renderSlide(canvas, slide, { width, dpr: 1, factory: officeOptions.factory });
|
||||
return canvas;
|
||||
}
|
||||
throw new Error('Presentation has no slides');
|
||||
} finally { await doc.close(); }
|
||||
}
|
||||
const doc = await openXlsxWorkbook(input, officeOptions);
|
||||
try {
|
||||
const grid = [];
|
||||
for await (const chunk of doc.worksheetRows(0)) {
|
||||
if (chunk.kind !== 'rows') break;
|
||||
for (const row of chunk.rows) {
|
||||
if (row.hidden) continue;
|
||||
const cells = Array(6).fill('');
|
||||
for (const { col, value } of row.cells) {
|
||||
if (col < 0 || col >= cells.length) continue;
|
||||
cells[col] = value.text ?? value.number ?? value.bool ?? value.error
|
||||
?? doc.workbookIndex.sharedStrings[value.si]?.text ?? '';
|
||||
}
|
||||
grid.push(cells);
|
||||
if (grid.length === 13) break;
|
||||
}
|
||||
if (grid.length === 13) break;
|
||||
}
|
||||
return drawRows(grid, true);
|
||||
} finally { await doc.close(); }
|
||||
}
|
||||
|
||||
(async () => {
|
||||
let image;
|
||||
if (kind === 'embedded') image = Buffer.from(input);
|
||||
else {
|
||||
const canvas = kind === 'pdf' ? await renderPdf()
|
||||
: kind === 'dxf' ? drawDxf(input)
|
||||
: rows ? drawRows(rows, kind === 'ods' || kind === 'xls') : await renderOffice();
|
||||
image = canvas.toBuffer('image/png');
|
||||
}
|
||||
const webp = await sharp(image, { limitInputPixels: 4_000_000, failOn: 'error' })
|
||||
.flatten({ background: '#fff' }).resize(edge, edge, { fit: 'inside', withoutEnlargement: true })
|
||||
.webp({ quality: 80 }).toBuffer();
|
||||
parentPort.postMessage(webp);
|
||||
})().catch(error => parentPort.postMessage({ error: error.message }));
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf8" />
|
||||
<title>WeKan REST API v13.39</title>
|
||||
<title>WeKan REST API v13.45</title>
|
||||
<!-- needed for adaptive design -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
@@ -498,11 +498,11 @@ data-styled.g662[id="sc-hFhjrW"]{content:"gelAUe,"}/*!sc*/
|
||||
|
||||
<body>
|
||||
|
||||
<div id="redoc"><div class="sc-dPmKWx eXwHqO redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-hHttOM iMkNMJ menu-content"><div class="sc-jokKPH fejYuX"><div data-testid="search-trigger" class="sc-cRcubC kWLWEm"><div class="sc-gzhUzI ejGLvh"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-bUAICN hRyRtS"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-gpABuY dGxToZ"><ul data-component-name="Menu/Menu" class="sc-llaQDn gIDdEs"><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-iMaYoB kYPxgQ"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="WeKan REST API" class="sc-cKRyZE edpvXG">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB dpiTia"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Production Security Concerns" class="sc-cKRyZE cXpWdQ">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Login" class="sc-cKRyZE cXpWdQ">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="AttachmentStorageSettings" class="sc-cKRyZE cXpWdQ">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-Line truncated
|
||||
<div id="redoc"><div class="sc-dPmKWx eXwHqO redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-hHttOM iMkNMJ menu-content"><div class="sc-jokKPH fejYuX"><div data-testid="search-trigger" class="sc-cRcubC kWLWEm"><div class="sc-gzhUzI ejGLvh"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-bUAICN hRyRtS"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-gpABuY dGxToZ"><ul data-component-name="Menu/Menu" class="sc-llaQDn gIDdEs"><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-iMaYoB kYPxgQ"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="WeKan REST API" class="sc-cKRyZE edpvXG">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB dpiTia"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Production Security Concerns" class="sc-cKRyZE cXpWdQ">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Login" class="sc-cKRyZE cXpWdQ">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="AttachmentStorageSettings" class="sc-cKRyZE cXpWdQ">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-Line truncated
|
||||
<script type="module">
|
||||
import { hydrate } from "https://cdn.redocly.com/redoc/v3.2.0/bundles/redoc.standalone.js";
|
||||
|
||||
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.39","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
|
||||
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.45","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
|
||||
const __redoc_options = {"skipBundle":true,"disableTelemetry":false};
|
||||
|
||||
hydrate(__redoc_definition, __redoc_options, document.getElementById('redoc'));
|
||||
|
||||
+16
-1
@@ -1,7 +1,7 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: WeKan REST API
|
||||
version: v13.39
|
||||
version: v13.45
|
||||
description: |
|
||||
The REST API allows you to control and extend WeKan with ease.
|
||||
|
||||
@@ -2490,6 +2490,14 @@ paths:
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
'409':
|
||||
description: |-
|
||||
The domain changed during removal.
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
/api/boards/{board}/export:
|
||||
get:
|
||||
operationId: exportJson
|
||||
@@ -3680,6 +3688,11 @@ paths:
|
||||
description: the toSwimlaneId value
|
||||
type: string
|
||||
required: true
|
||||
- name: position
|
||||
in: formData
|
||||
description: the position value
|
||||
type: string
|
||||
required: true
|
||||
- name: board
|
||||
in: path
|
||||
description: the board value
|
||||
@@ -7673,6 +7686,8 @@ definitions:
|
||||
type: string
|
||||
startDate:
|
||||
type: string
|
||||
startDateMapping:
|
||||
type: string
|
||||
dueDate:
|
||||
type: string
|
||||
dueComplete:
|
||||
|
||||
@@ -90,11 +90,9 @@ const POLICY = [
|
||||
dir === join(NPM, 'meteor', name, 'node_modules', 'core-js')),
|
||||
},
|
||||
{
|
||||
why: 'browser-only build inputs. Blockly and the Office viewer are imported '
|
||||
+ 'only by client code; meteor-node-stubs supplies browser polyfills. '
|
||||
+ 'Their compiled browser chunks ship separately in programs/web.browser.',
|
||||
test: dir => ['blockly', 'meteor-node-stubs'].includes(basename(dir))
|
||||
|| (basename(dir) === 'office-open-xml-viewer' && basename(dirname(dir)) === '@wekan'),
|
||||
why: 'Blockly and meteor-node-stubs compile into browser chunks. '
|
||||
+ 'The Office package also contains the Node document thumbnail renderer.',
|
||||
test: dir => ['blockly', 'meteor-node-stubs'].includes(basename(dir)),
|
||||
},
|
||||
{
|
||||
why: 'a TypeScript compiler. A devDependency of 196 packages in this tree '
|
||||
|
||||
@@ -142,6 +142,8 @@ def prepare(repo, output, release, database_image=''):
|
||||
if hook.count(pull_block) != 1:
|
||||
raise ValueError('Expected one preinst image-pull block before downtime')
|
||||
fallback = Path(__file__).with_name('ucs-pull-image.sh').read_text(encoding='utf-8')
|
||||
helper_check = 'docker run --rm --entrypoint /usr/local/bin/node "$image" /opt/ucs-migration/start.mjs --check'
|
||||
hook = hook.replace(pull_block + '\n' + helper_check, pull_block)
|
||||
hook = hook.replace(pull_block, fallback + '\n' + """
|
||||
ucs_compose="${BASH_SOURCE[0]%.preinst}.compose"
|
||||
if [ ! -f "$ucs_compose" ]; then ucs_compose="$(dirname -- "${BASH_SOURCE[0]}")/compose"; fi
|
||||
@@ -154,7 +156,9 @@ docker run --rm --entrypoint /usr/local/bin/node "$image" /opt/ucs-migration/sta
|
||||
worker_tail = '-v /var/run/docker.sock:/var/run/docker.sock -v "$target:/data" "$helper"'
|
||||
if hook.count(worker_tail) != 1:
|
||||
raise ValueError('Expected one UCS migration worker command')
|
||||
hook = hook.replace(worker_tail, worker_tail + ' /usr/local/bin/node /opt/ucs-migration/start.mjs')
|
||||
worker_command = worker_tail + ' /usr/local/bin/node /opt/ucs-migration/start.mjs'
|
||||
if worker_command not in hook:
|
||||
hook = hook.replace(worker_tail, worker_command)
|
||||
hook = distroless_ownership(hook)
|
||||
(destination / 'preinst').write_text(hook, encoding='utf-8')
|
||||
return {'app_image': app_image, 'helper_image': helper_image, 'database_image': database_image}
|
||||
|
||||
@@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
|
||||
appTitle = (defaultText = "Wekan"),
|
||||
# The name of the app as it is displayed to the user.
|
||||
|
||||
appVersion = 1339,
|
||||
appVersion = 1345,
|
||||
# Increment this for every release.
|
||||
|
||||
appMarketingVersion = (defaultText = "13.39~2026-12-02"),
|
||||
appMarketingVersion = (defaultText = "13.45~2026-12-05"),
|
||||
# Human-readable presentation of the app version.
|
||||
|
||||
minUpgradableAppVersion = 0,
|
||||
|
||||
+28
-7
@@ -15,7 +15,7 @@ import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import { Exporter } from '/models/exporter';
|
||||
import { externalExportScope } from '/models/lib/exportFields';
|
||||
import { anonymizeExportIdentities, assertExportEnabled } from '/models/lib/importExportSecurity';
|
||||
import { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues } from '/models/lib/openProjectApiExport';
|
||||
import { createOpenProjectWorkPackages, openProjectExportWorkFields, openProjectExportWorkValues, openProjectExportLabelValues } from '/models/lib/openProjectApiExport';
|
||||
import { createJiraIssues } from '/models/lib/jiraApiExport';
|
||||
import { secureTransfer } from '/server/lib/secureTransfer';
|
||||
import * as planka from '/models/lib/apiImport/planka';
|
||||
@@ -127,8 +127,8 @@ Meteor.methods({
|
||||
if (!complete) saved = await writeNotionBulkCheckpoint(checkpointId, checkpoint);
|
||||
},
|
||||
});
|
||||
if (stalled || (!complete && saved)) {
|
||||
result.push({ id, ok: false, error: 'history-request-retry' });
|
||||
if (!complete) {
|
||||
result.push({ id, ok: false, error: stalled || saved ? 'history-request-retry' : 'import-too-large' });
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
@@ -190,20 +190,41 @@ Meteor.methods({
|
||||
const includeSubtasks = !fields?.length || fields.includes('subtasks');
|
||||
const includeDependencies = !fields?.length || fields.includes('dependencies');
|
||||
const workMappings = fields?.includes('custom-fields')
|
||||
? openProjectExportWorkFields(await ReactiveCache.getCustomFields({ boardIds: boardId, type: 'number' })) : new Map();
|
||||
? openProjectExportWorkFields(await ReactiveCache.getCustomFields({ boardIds: boardId, type: { $in: ['number', 'text', 'checkbox'] } })) : new Map();
|
||||
const includePeople = fields?.includes('people');
|
||||
const includeLabels = fields?.includes('labels');
|
||||
const board = includeLabels ? await ReactiveCache.getBoard(boardId) : null;
|
||||
const labelsById = new Map((board?.labels || []).map(({ _id, name }) => [_id, name]));
|
||||
const selector = await exporter._scopedCardSelector(boardId);
|
||||
const cards = await ReactiveCache.getCards(selector, {
|
||||
fields: { _id: 1, title: 1, ...(includeDescription ? { description: 1 } : {}),
|
||||
...(includeDates ? { startAt: 1, dueAt: 1 } : {}), ...(includeSubtasks ? { parentId: 1, parentIds: 1 } : {}),
|
||||
...(includeDependencies ? { cardDependencies: 1 } : {}), ...(workMappings.size ? { customFields: 1 } : {}) },
|
||||
...(includeDependencies ? { cardDependencies: 1 } : {}), ...(workMappings.size ? { customFields: 1 } : {}),
|
||||
...(includeLabels ? { labelIds: 1 } : {}), ...(includePeople ? { assignees: 1 } : {}) },
|
||||
sort: { sort: 1, _id: 1 },
|
||||
});
|
||||
const records = cards.map(card => ({
|
||||
cardId: card._id, title: card.title, description: card.description, startAt: card.startAt, dueAt: card.dueAt,
|
||||
parentId: card.parentId, parentIds: card.parentIds, cardDependencies: card.cardDependencies,
|
||||
...(workMappings.size ? { workFields: openProjectExportWorkValues(card, workMappings) } : {}),
|
||||
...(workMappings.size || includeLabels ? { workFields: {
|
||||
...openProjectExportWorkValues(card, workMappings),
|
||||
...openProjectExportLabelValues(card.labelIds?.map(id => labelsById.get(id))),
|
||||
} } : {}),
|
||||
}));
|
||||
await anonymizeExportIdentities({ boardId, cards: records, language: user.profile?.language });
|
||||
const anonymized = await anonymizeExportIdentities({ boardId, cards: records, language: user.profile?.language });
|
||||
if (includePeople && !anonymized) {
|
||||
// OpenProject supports one assignee. Preserve an unambiguous assignment
|
||||
// and leave multi-person cards unassigned.
|
||||
const assignments = cards.map(card => [...new Set(card.assignees || [])]);
|
||||
const ids = [...new Set(assignments.filter(ids => ids.length === 1).map(([id]) => id))];
|
||||
const users = ids.length ? await ReactiveCache.getUsers({ _id: { $in: ids } }, {
|
||||
fields: { username: 1, 'profile.fullname': 1 },
|
||||
}) : [];
|
||||
const names = new Map(users.map(user => [user._id, user.profile?.fullname || user.username]));
|
||||
assignments.forEach((ids, index) => {
|
||||
if (ids.length) records[index].assigneeName = ids.length === 1 ? names.get(ids[0]) || '' : '';
|
||||
});
|
||||
}
|
||||
const safeRecords = secureTransfer(records, { direction: 'export', source: 'export:openproject-api' });
|
||||
try {
|
||||
return await createOpenProjectWorkPackages(clean, projectId, safeRecords, apiImportRequest);
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
import { legacyOfficeThumbnailRows } from './legacyOfficeThumbnail.js';
|
||||
import { dxfThumbnailPaths } from './dxfThumbnail.js';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { inflateRawSync } from 'node:zlib';
|
||||
import { Worker } from 'node:worker_threads';
|
||||
import { Parser } from 'htmlparser2';
|
||||
import { ZipDirectory } from '../../models/lib/zipDirectory.js';
|
||||
import { OdfBlocks } from '../../models/lib/odfBlocks.js';
|
||||
import thumbnailRules from '../../models/lib/attachmentThumbnail.js';
|
||||
import previewStore from './attachmentPreviewStore.js';
|
||||
import { boundedStreamBuffer } from './imageGif.js';
|
||||
|
||||
const { THUMBNAIL_EDGE } = thumbnailRules;
|
||||
export const DOCUMENT_MAX_BYTES = 16 * 1024 * 1024;
|
||||
const ODF_PART_BYTES = 1024 * 1024;
|
||||
const MAX_PENDING = 24;
|
||||
const MAX_RUNNING = 2;
|
||||
const RENDER_TIMEOUT_MS = 15_000;
|
||||
const MAX_ROWS = 20;
|
||||
const building = new Map();
|
||||
const waiting = [];
|
||||
let active = 0;
|
||||
|
||||
async function odfInput(kind, data) {
|
||||
const zip = await new ZipDirectory({ size: data.length, bytes: (a, b) => data.subarray(a, b) }).open();
|
||||
if (zip.count > 2048) throw new Error('OpenDocument archive has too many entries');
|
||||
let content;
|
||||
for await (const entry of zip.entries()) {
|
||||
if (!['Thumbnails/thumbnail.png', 'content.xml'].includes(entry.name)
|
||||
|| entry.size > ODF_PART_BYTES || entry.compressedSize > ODF_PART_BYTES) continue;
|
||||
const start = await zip.dataStart(entry);
|
||||
const raw = data.subarray(start, start + entry.compressedSize);
|
||||
if (raw.length !== entry.compressedSize) continue;
|
||||
const bytes = entry.method === 0 ? raw
|
||||
: entry.method === 8 ? inflateRawSync(raw, { maxOutputLength: ODF_PART_BYTES }) : null;
|
||||
if (!bytes || bytes.length !== entry.size) continue;
|
||||
if (entry.name === 'Thumbnails/thumbnail.png'
|
||||
&& bytes.subarray(0, 8).equals(Buffer.from('89504e470d0a1a0a', 'hex'))) {
|
||||
return { kind: 'embedded', input: bytes };
|
||||
}
|
||||
if (entry.name === 'content.xml') content = bytes;
|
||||
}
|
||||
if (!content) throw new Error('OpenDocument has no readable first page');
|
||||
|
||||
const blocks = new OdfBlocks();
|
||||
const rows = [];
|
||||
let pages = 0;
|
||||
let stopped = false;
|
||||
const parser = new Parser({
|
||||
onopentag(name, attrs) {
|
||||
if (blocks.scopes.length >= 128) throw new Error('OpenDocument XML is too deeply nested');
|
||||
blocks.open(name, attrs);
|
||||
},
|
||||
ontext: text => blocks.addText(text),
|
||||
onclosetag(name) {
|
||||
blocks.close(name);
|
||||
for (let block = blocks.take(); block && rows.length < MAX_ROWS; block = blocks.take()) {
|
||||
if (block.kind === 'page') {
|
||||
pages += 1;
|
||||
if (kind !== 'odt' && pages > 1) stopped = true;
|
||||
} else if (block.kind === 'row') {
|
||||
rows.push(block.cells.slice(0, 6).map(text => text.slice(0, 100)));
|
||||
} else {
|
||||
rows.push([block.text.slice(0, 100)]);
|
||||
}
|
||||
if (stopped || rows.length === MAX_ROWS) break;
|
||||
}
|
||||
if (stopped || rows.length === MAX_ROWS) parser.pause();
|
||||
},
|
||||
}, { xmlMode: true, decodeEntities: true });
|
||||
parser.end(content.toString('utf8'));
|
||||
return { kind, rows };
|
||||
}
|
||||
|
||||
export async function renderDocumentThumbnail(kind, data, workerSource) {
|
||||
if (!Buffer.isBuffer(data) || data.length === 0 || data.length > DOCUMENT_MAX_BYTES) {
|
||||
throw new Error('Document exceeds the thumbnail conversion limit');
|
||||
}
|
||||
let parameters = { kind, input: data };
|
||||
if (['odt', 'ods', 'odp'].includes(kind)) parameters = await odfInput(kind, data);
|
||||
if (['doc', 'xls', 'ppt'].includes(kind)) parameters = { kind, rows: await legacyOfficeThumbnailRows(kind, data) };
|
||||
if (kind === 'dxf') parameters.input = dxfThumbnailPaths(data);
|
||||
return new Promise((resolve, reject) => {
|
||||
const worker = new Worker(workerSource, {
|
||||
eval: true,
|
||||
execArgv: [],
|
||||
workerData: { ...parameters, edge: THUMBNAIL_EDGE },
|
||||
resourceLimits: { maxOldGenerationSizeMb: 128 },
|
||||
});
|
||||
const timer = setTimeout(() => {
|
||||
reject(new Error('Document thumbnail timed out'));
|
||||
void worker.terminate();
|
||||
}, RENDER_TIMEOUT_MS);
|
||||
worker.once('message', message => {
|
||||
clearTimeout(timer);
|
||||
if (message.error) reject(new Error(message.error));
|
||||
else resolve(Buffer.from(message));
|
||||
});
|
||||
worker.once('error', error => {
|
||||
clearTimeout(timer);
|
||||
reject(error);
|
||||
});
|
||||
worker.once('exit', code => {
|
||||
clearTimeout(timer);
|
||||
reject(new Error(`Document renderer exited before returning a thumbnail (${code})`));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function getDocumentThumbnail(attachment, key, kind, openStream, loadWorker) {
|
||||
const id = String(attachment._id).replace(/[^\w-]/g, '');
|
||||
const dir = previewStore.previewRoot();
|
||||
const file = path.join(dir, `${id}.thumb-v1-${key}.webp`);
|
||||
try {
|
||||
return await fs.readFile(file);
|
||||
} catch (error) {
|
||||
if (error.code !== 'ENOENT') throw error;
|
||||
}
|
||||
if (building.has(file)) return building.get(file);
|
||||
if (building.size >= MAX_PENDING) throw new Error('Document thumbnail queue is full');
|
||||
// Reserve the slot before yielding. On completion hand it directly to the
|
||||
// next waiter, so a new request cannot claim the same slot.
|
||||
const slot = active < MAX_RUNNING ? (active += 1, Promise.resolve())
|
||||
: new Promise(resolve => waiting.push(resolve));
|
||||
const result = (async () => {
|
||||
await slot;
|
||||
try {
|
||||
const source = await loadWorker();
|
||||
const contents = await boundedStreamBuffer(await openStream(), DOCUMENT_MAX_BYTES);
|
||||
const image = await renderDocumentThumbnail(kind, contents, source);
|
||||
// The file shares the attachment preview directory and deletion hook.
|
||||
const temp = `${file}.${process.pid}.tmp`;
|
||||
try {
|
||||
await fs.mkdir(dir, { recursive: true, mode: 0o700 });
|
||||
await fs.writeFile(temp, image, { mode: 0o600 });
|
||||
await fs.rename(temp, file);
|
||||
} catch (error) {
|
||||
await fs.rm(temp, { force: true }).catch(() => {});
|
||||
// Some installations provide read-only preview storage. The response
|
||||
// can still use the in-memory cache even if the derived file is absent.
|
||||
}
|
||||
return image;
|
||||
} finally {
|
||||
building.delete(file);
|
||||
const next = waiting.shift();
|
||||
if (next) next();
|
||||
else active -= 1;
|
||||
}
|
||||
})();
|
||||
building.set(file, result);
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
const MAX_BYTES = 2 * 1024 * 1024;
|
||||
const MAX_POINTS = 50_000;
|
||||
const TURN = 2 * Math.PI;
|
||||
|
||||
export function dxfThumbnailPaths(input) {
|
||||
if (input.length > MAX_BYTES || input.includes(0)) throw new Error('Unsupported DXF');
|
||||
const lines = input.toString('utf8').replace(/^\uFEFF/, '').trimEnd().split(/\r?\n/);
|
||||
if (lines.length % 2 !== 0) throw new Error('Incomplete DXF group');
|
||||
const paths = [];
|
||||
let points = 0;
|
||||
let section = false;
|
||||
let polyline;
|
||||
let ended = false;
|
||||
|
||||
function add(path) {
|
||||
if (path.length < 2) return;
|
||||
points += path.length;
|
||||
if (points > MAX_POINTS || path.some(([x, y]) =>
|
||||
!Number.isFinite(x) || !Number.isFinite(y) || Math.abs(x) > 1e15 || Math.abs(y) > 1e15)) {
|
||||
throw new Error('DXF geometry exceeds thumbnail limits');
|
||||
}
|
||||
paths.push(path);
|
||||
}
|
||||
|
||||
function arc(x, y, ux, uy, vx, vy, start, sweep) {
|
||||
const steps = Math.max(2, Math.ceil(Math.abs(sweep) * 64 / TURN));
|
||||
return Array.from({ length: steps + 1 }, (_, index) => {
|
||||
const t = start + sweep * index / steps;
|
||||
return [x + ux * Math.cos(t) + vx * Math.sin(t), y + uy * Math.cos(t) + vy * Math.sin(t)];
|
||||
});
|
||||
}
|
||||
|
||||
function drawPolyline(vertices, closed) {
|
||||
if (vertices.length < 2) return;
|
||||
const count = closed ? vertices.length : vertices.length - 1;
|
||||
for (let i = 0; i < count; i += 1) {
|
||||
const [x, y, bulge] = vertices[i];
|
||||
const [nx, ny] = vertices[(i + 1) % vertices.length];
|
||||
if (!Number.isFinite(bulge)) throw new Error('Invalid DXF bulge');
|
||||
if (Math.abs(bulge) < 1e-8 || (nx === x && ny === y)) {
|
||||
add([[x, y], [nx, ny]]);
|
||||
continue;
|
||||
}
|
||||
const offset = (1 / bulge - bulge) / 4;
|
||||
const cx = (x + nx) / 2 - (ny - y) * offset;
|
||||
const cy = (y + ny) / 2 + (nx - x) * offset;
|
||||
add(arc(cx, cy, x - cx, y - cy, cy - y, x - cx, 0, 4 * Math.atan(bulge)));
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < lines.length;) {
|
||||
if (lines[i].trim() === '999') {
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
if (lines[i].trim() !== '0') throw new Error('Invalid DXF record');
|
||||
const entity = lines[i + 1].trim();
|
||||
i += 2;
|
||||
const groups = new Map();
|
||||
const vertices = [];
|
||||
let vertex;
|
||||
const fits = [];
|
||||
let fit;
|
||||
while (i < lines.length && lines[i].trim() !== '0') {
|
||||
const code = lines[i].trim();
|
||||
const value = lines[i + 1].trim();
|
||||
if (!/^\d+$/.test(code)) throw new Error('Invalid DXF group code');
|
||||
if (!groups.has(code)) groups.set(code, value);
|
||||
if (section && (entity === 'SPLINE' || entity === 'LWPOLYLINE')) {
|
||||
if (code === '10') vertices.push(vertex = [Number(value), NaN, 0]);
|
||||
if (code === '20' && vertex) vertex[1] = Number(value);
|
||||
if (code === '42' && vertex) vertex[2] = Number(value);
|
||||
if (entity === 'SPLINE' && code === '11') fits.push(fit = [Number(value), NaN]);
|
||||
if (entity === 'SPLINE' && code === '21' && fit) fit[1] = Number(value);
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
|
||||
if (entity === 'SECTION') section = groups.get('2') === 'ENTITIES';
|
||||
if (entity === 'EOF') { ended = true; break; }
|
||||
if (!section) continue;
|
||||
const n = (code, fallback = NaN) => groups.has(code) ? Number(groups.get(code)) : fallback;
|
||||
const flags = n('70', 0);
|
||||
if (entity === 'ENDSEC') section = false;
|
||||
if (entity === 'POLYLINE') polyline = { vertices: [], flags, paper: n('67', 0) };
|
||||
if (entity === 'VERTEX' && polyline) polyline.vertices.push([n('10'), n('20'), n('42', 0)]);
|
||||
if (entity === 'SEQEND' && polyline) {
|
||||
if (!polyline.paper && !(polyline.flags & 120)) drawPolyline(polyline.vertices, polyline.flags & 1);
|
||||
polyline = undefined;
|
||||
}
|
||||
if (n('67', 0) || (groups.has('410') && groups.get('410').toUpperCase() !== 'MODEL')) continue;
|
||||
const x = n('10');
|
||||
const y = n('20');
|
||||
if (entity === 'LINE') add([[x, y], [n('11'), n('21')]]);
|
||||
if (entity === 'LWPOLYLINE') drawPolyline(vertices, flags & 1);
|
||||
if (entity === 'SPLINE') add(fits.length >= 2 ? fits : vertices.map(([vx, vy]) => [vx, vy]));
|
||||
if (entity === 'CIRCLE' || entity === 'ARC' || entity === 'ELLIPSE') {
|
||||
const ellipse = entity === 'ELLIPSE';
|
||||
const ux = ellipse ? n('11') : n('40');
|
||||
const uy = ellipse ? n('21') : 0;
|
||||
const ratio = ellipse ? n('40') : 1;
|
||||
const units = ellipse ? 1 : Math.PI / 180;
|
||||
const start = entity === 'CIRCLE' ? 0 : (ellipse ? n('41', 0) : n('50')) * units;
|
||||
const end = entity === 'CIRCLE' ? TURN : (ellipse ? n('42', TURN) : n('51')) * units;
|
||||
const delta = end - start;
|
||||
const sweep = ((delta % TURN) + TURN) % TURN || TURN;
|
||||
if (!Number.isFinite(delta) || ratio <= 0 || (!ellipse && ux <= 0)) throw new Error('Invalid DXF curve');
|
||||
add(arc(x, y, ux, uy, -uy * ratio, ux * ratio, start, sweep));
|
||||
}
|
||||
}
|
||||
if (!ended || section || !paths.length) throw new Error('DXF has no readable model geometry');
|
||||
return paths;
|
||||
}
|
||||
@@ -14,13 +14,15 @@ export function sanitizeInput(input, { allowJiraTextColor = false, allowJiraBack
|
||||
allowedTags: [],
|
||||
allowedAttributes: {},
|
||||
}) : sanitizeHtml(input, {
|
||||
allowedTags: ['span', ...(allowJiraCloudNodes ? ['time', 'details', 'summary'] : [])],
|
||||
allowedAttributes: { span: ['style', ...(allowJiraCloudNodes ? ['data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block'] : [])], ...(allowJiraCloudNodes ? { time: ['datetime'], details: ['data-jira-expand'] } : {}) },
|
||||
allowedTags: ['span', 'u', 'sub', 'sup', ...(allowJiraCloudNodes ? ['time', 'details', 'summary', 'div'] : ['cite'])],
|
||||
allowedAttributes: { span: ['style', ...(allowJiraCloudNodes ? ['data-jira-status', 'data-jira-mention', 'data-jira-emoji', 'data-jira-cell-block'] : [])], ...(allowJiraCloudNodes ? { time: ['datetime'], details: ['data-jira-expand'], div: ['data-jira-panel'] } : {}) },
|
||||
allowedStyles: { span: {
|
||||
color: [/^(?:#[a-f0-9]{6}|red|green|blue|black|white|yellow|gray|grey|orange|purple)$/i],
|
||||
...(allowJiraBackgroundColor ? { 'background-color': [/^#[a-f0-9]{6}$/i] } : {}),
|
||||
} },
|
||||
exclusiveFilter: frame => frame.tag === 'span' && !frame.attribs.style && !frame.attribs['data-jira-status'] && !frame.attribs['data-jira-mention'] && !frame.attribs['data-jira-emoji'] && !frame.attribs['data-jira-cell-block'] ? 'excludeTag' : false,
|
||||
exclusiveFilter: frame => frame.tag === 'div' && !/^(?:info|note|warning|success|error)$/.test(frame.attribs['data-jira-panel'])
|
||||
? 'excludeTag'
|
||||
: frame.tag === 'span' && !frame.attribs.style && !frame.attribs['data-jira-status'] && !frame.attribs['data-jira-mention'] && !frame.attribs['data-jira-emoji'] && !frame.attribs['data-jira-cell-block'] ? 'excludeTag' : false,
|
||||
});
|
||||
|
||||
// Additional check for CSS injection patterns
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
import { openCompoundFile } from '../../models/lib/outlookMsgFormat.js';
|
||||
|
||||
const STREAM_LIMIT = 16 * 1024 * 1024;
|
||||
const TEXT_LIMIT = 2400;
|
||||
const ROW_LIMIT = 13;
|
||||
const COL_LIMIT = 6;
|
||||
const RECORD_LIMIT = 250_000;
|
||||
const ansi = new TextDecoder('windows-1252');
|
||||
|
||||
function requireValid(condition) {
|
||||
if (!condition) throw new Error('Unsupported or damaged legacy Office document');
|
||||
}
|
||||
|
||||
function textRows(text) {
|
||||
return text.replace(/\x13[^\x14\x15]*(?:\x14|\x15)/g, '')
|
||||
.split(/[\r\n\v\f]+/)
|
||||
.map(line => line.replace(/[\x00-\x08\x0e-\x1f]/g, '').trim())
|
||||
.filter(Boolean).slice(0, 20).map(line => [line.slice(0, 100)]);
|
||||
}
|
||||
|
||||
async function wordRows(read) {
|
||||
const word = await read('WordDocument');
|
||||
requireValid(word.readUInt16LE(0) === 0xa5ec && word.readUInt16LE(2) >= 0x00c1);
|
||||
const flags = word.readUInt16LE(10);
|
||||
requireValid(!(flags & 0x8100));
|
||||
const table = await read(flags & 0x0200 ? '1Table' : '0Table');
|
||||
|
||||
// MS-DOC: the CLX maps main-story character positions to stream offsets.
|
||||
const longs = 34 + word.readUInt16LE(32) * 2;
|
||||
const pairs = longs + 2 + word.readUInt16LE(longs) * 4;
|
||||
const limit = Math.min(TEXT_LIMIT, word.readUInt32LE(longs + 14));
|
||||
const clxStart = word.readUInt32LE(pairs + 2 + 33 * 8);
|
||||
const clxEnd = clxStart + word.readUInt32LE(pairs + 6 + 33 * 8);
|
||||
requireValid(clxEnd <= table.length);
|
||||
let pos = clxStart;
|
||||
while (pos < clxEnd && table[pos] === 1) pos += 3 + table.readUInt16LE(pos + 1);
|
||||
requireValid(table[pos] === 2 && pos + 5 <= clxEnd);
|
||||
const length = table.readUInt32LE(pos + 1);
|
||||
pos += 5;
|
||||
const count = (length - 4) / 12;
|
||||
requireValid(Number.isInteger(count) && count > 0 && pos + length <= clxEnd);
|
||||
let text = '';
|
||||
for (let i = 0; i < count; i += 1) {
|
||||
const start = table.readUInt32LE(pos + i * 4);
|
||||
if (start >= limit) break;
|
||||
const end = Math.min(limit, table.readUInt32LE(pos + (i + 1) * 4));
|
||||
requireValid(end > start);
|
||||
const fc = table.readUInt32LE(pos + (count + 1) * 4 + i * 8 + 2);
|
||||
const compressed = Boolean(fc & 0x40000000);
|
||||
const offset = (fc & 0x3fffffff) / (compressed ? 2 : 1);
|
||||
const last = offset + (end - start) * (compressed ? 1 : 2);
|
||||
requireValid(Number.isInteger(offset) && last <= word.length);
|
||||
const chars = word.subarray(offset, last);
|
||||
text += compressed ? ansi.decode(chars) : chars.toString('utf16le');
|
||||
}
|
||||
return textRows(text);
|
||||
}
|
||||
|
||||
function* biffRecords(data, start = 0) {
|
||||
let records = 0;
|
||||
for (let pos = start; pos + 4 <= data.length;) {
|
||||
requireValid(++records <= RECORD_LIMIT);
|
||||
const type = data.readUInt16LE(pos);
|
||||
const length = data.readUInt16LE(pos + 2);
|
||||
pos += 4;
|
||||
requireValid(pos + length <= data.length);
|
||||
yield { type, body: data.subarray(pos, pos + length) };
|
||||
if (type === 0x000a) return;
|
||||
pos += length;
|
||||
}
|
||||
throw new Error('Incomplete BIFF stream');
|
||||
}
|
||||
|
||||
// MS-XLS: only a continuation inside character data starts with an encoding byte.
|
||||
function sharedStrings(chunks, wanted) {
|
||||
if (!wanted.size) return new Map();
|
||||
requireValid(chunks[0]?.length >= 8);
|
||||
const count = chunks[0].readUInt32LE(4);
|
||||
const last = Math.max(...wanted);
|
||||
requireValid(last < count && last < 100_000);
|
||||
let chunk = 0;
|
||||
let pos = 8;
|
||||
function advance() {
|
||||
pos = 0;
|
||||
requireValid(++chunk < chunks.length && chunks[chunk].length > 0);
|
||||
}
|
||||
function byte() {
|
||||
if (pos === chunks[chunk].length) advance();
|
||||
return chunks[chunk][pos++];
|
||||
}
|
||||
function uint(size) {
|
||||
let n = 0;
|
||||
for (let i = 0; i < size; i += 1) n += byte() * 256 ** i;
|
||||
return n;
|
||||
}
|
||||
function skip(length) {
|
||||
while (length > 0) {
|
||||
if (pos === chunks[chunk].length) advance();
|
||||
const step = Math.min(length, chunks[chunk].length - pos);
|
||||
pos += step;
|
||||
length -= step;
|
||||
}
|
||||
}
|
||||
const found = new Map();
|
||||
for (let index = 0; index <= last; index += 1) {
|
||||
let remaining = uint(2);
|
||||
const flags = byte();
|
||||
let width = flags & 1 ? 2 : 1;
|
||||
const runs = flags & 8 ? uint(2) : 0;
|
||||
const phoneticBytes = flags & 4 ? uint(4) : 0;
|
||||
let text = '';
|
||||
while (remaining > 0) {
|
||||
if (pos === chunks[chunk].length) {
|
||||
advance();
|
||||
width = byte() & 1 ? 2 : 1;
|
||||
}
|
||||
const chars = Math.min(remaining, Math.floor((chunks[chunk].length - pos) / width));
|
||||
requireValid(chars > 0);
|
||||
if (wanted.has(index) && text.length < 100) {
|
||||
const sample = chunks[chunk].subarray(pos, pos + Math.min(chars, 100 - text.length) * width);
|
||||
text += sample.toString(width === 2 ? 'utf16le' : 'latin1');
|
||||
}
|
||||
pos += chars * width;
|
||||
remaining -= chars;
|
||||
}
|
||||
skip(runs * 4 + phoneticBytes);
|
||||
if (wanted.has(index)) found.set(index, text);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
function rkValue(bits) {
|
||||
let number;
|
||||
if (bits & 2) number = bits >> 2;
|
||||
else {
|
||||
const bytes = Buffer.alloc(8);
|
||||
bytes.writeInt32LE(bits & ~3, 4);
|
||||
number = bytes.readDoubleLE();
|
||||
}
|
||||
return bits & 1 ? number / 100 : number;
|
||||
}
|
||||
|
||||
async function excelRows(read) {
|
||||
const workbook = await read('Workbook', 'Book');
|
||||
let firstSheet;
|
||||
const sst = [];
|
||||
let inSst = false;
|
||||
for (const { type, body } of biffRecords(workbook)) {
|
||||
if (type === 0x0809) requireValid(body.readUInt16LE() === 0x0600);
|
||||
if (type === 0x002f) throw new Error('Encrypted BIFF workbook');
|
||||
if (type === 0x0085 && body[5] === 0 && firstSheet === undefined) firstSheet = body.readUInt32LE();
|
||||
inSst = type === 0x00fc || (inSst && type === 0x003c);
|
||||
if (inSst) sst.push(body);
|
||||
}
|
||||
requireValid(workbook.readUInt16LE(0) === 0x0809 && workbook.readUInt16LE(6) === 0x0005 && firstSheet > 0 && workbook.readUInt16LE(firstSheet) === 0x0809
|
||||
&& workbook.readUInt16LE(firstSheet + 6) === 0x0010);
|
||||
const grid = [];
|
||||
const wanted = new Set();
|
||||
function cell(row, column, value) {
|
||||
if (row >= ROW_LIMIT || column >= COL_LIMIT) return;
|
||||
(grid[row] ??= Array(COL_LIMIT).fill(''))[column] = value;
|
||||
}
|
||||
for (const { type, body } of biffRecords(workbook, firstSheet)) {
|
||||
if (![0x00fd, 0x0203, 0x027e, 0x00bd, 0x0205, 0x0006, 0x0204].includes(type)) continue;
|
||||
const row = body.readUInt16LE(0);
|
||||
const col = body.readUInt16LE(2);
|
||||
if (row >= ROW_LIMIT || col >= COL_LIMIT) continue;
|
||||
if (type === 0x00fd) {
|
||||
const index = body.readUInt32LE(6);
|
||||
wanted.add(index);
|
||||
cell(row, col, { index });
|
||||
} else if (type === 0x0203 || (type === 0x0006 && body.readUInt16LE(12) !== 0xffff)) {
|
||||
cell(row, col, body.readDoubleLE(6));
|
||||
} else if (type === 0x027e) {
|
||||
cell(row, col, rkValue(body.readInt32LE(6)));
|
||||
} else if (type === 0x00bd) {
|
||||
requireValid(body.length >= 12 && (body.length - 6) % 6 === 0);
|
||||
for (let offset = 4, column = col; offset < body.length - 2 && column < COL_LIMIT; offset += 6, column += 1) {
|
||||
cell(row, column, rkValue(body.readInt32LE(offset + 2)));
|
||||
}
|
||||
} else if (type === 0x0205 && body.length >= 8 && body[7] === 0) {
|
||||
cell(row, col, body[6] ? 'TRUE' : 'FALSE');
|
||||
} else if (type === 0x0204) {
|
||||
const width = body[8] & 1 ? 2 : 1;
|
||||
const end = 9 + body.readUInt16LE(6) * width;
|
||||
requireValid(end <= body.length);
|
||||
cell(row, col, body.toString(width === 2 ? 'utf16le' : 'latin1', 9, Math.min(end, 9 + width * 100)));
|
||||
}
|
||||
}
|
||||
const strings = sharedStrings(sst, wanted);
|
||||
return Array.from(grid, row => row?.map(value => value?.index === undefined ? value : strings.get(value.index)) ?? []);
|
||||
}
|
||||
|
||||
function pptRecord(data, offset) {
|
||||
const header = data.readUInt16LE(offset);
|
||||
const type = data.readUInt16LE(offset + 2);
|
||||
const start = offset + 8;
|
||||
const end = start + data.readUInt32LE(offset + 4);
|
||||
requireValid(end <= data.length);
|
||||
return { type, instance: header >>> 4, container: (header & 15) === 15, start, end };
|
||||
}
|
||||
|
||||
function* pptChildren(data, parent) {
|
||||
for (let pos = parent.start; pos < parent.end;) {
|
||||
const child = pptRecord(data, pos);
|
||||
requireValid(child.end <= parent.end);
|
||||
yield child;
|
||||
pos = child.end;
|
||||
}
|
||||
}
|
||||
|
||||
async function powerpointRows(read) {
|
||||
const current = await read('Current User');
|
||||
const data = await read('PowerPoint Document');
|
||||
requireValid(pptRecord(current, 0).type === 4086 && current.readUInt32LE(12) === 0xe391c05f);
|
||||
|
||||
// MS-PPT: later edits override earlier persist-directory entries.
|
||||
const offsets = new Map();
|
||||
let editOffset = current.readUInt32LE(16);
|
||||
let documentId;
|
||||
for (let edits = 0; editOffset; edits += 1) {
|
||||
const edit = pptRecord(data, editOffset);
|
||||
requireValid(edits < 256 && edit.type === 4085 && edit.end - edit.start >= 28);
|
||||
documentId ??= data.readUInt32LE(edit.start + 16);
|
||||
const directory = pptRecord(data, data.readUInt32LE(edit.start + 12));
|
||||
requireValid(directory.type === 6002);
|
||||
for (let pos = directory.start; pos < directory.end;) {
|
||||
const header = data.readUInt32LE(pos);
|
||||
const count = header >>> 20;
|
||||
const firstId = header & 0xfffff;
|
||||
pos += 4;
|
||||
requireValid(count > 0 && pos + count * 4 <= directory.end && offsets.size + count <= 100_000);
|
||||
for (let i = 0; i < count; i += 1, pos += 4) {
|
||||
if (!offsets.has(firstId + i)) offsets.set(firstId + i, data.readUInt32LE(pos));
|
||||
}
|
||||
}
|
||||
const previous = data.readUInt32LE(edit.start + 8);
|
||||
requireValid(previous < editOffset);
|
||||
editOffset = previous;
|
||||
}
|
||||
requireValid(offsets.has(documentId));
|
||||
const document = pptRecord(data, offsets.get(documentId));
|
||||
requireValid(document.type === 1000 && document.container);
|
||||
let slideId;
|
||||
const snippets = [];
|
||||
let remaining = TEXT_LIMIT;
|
||||
let records = 0;
|
||||
function collect(record) {
|
||||
if (record.type === 4000 || record.type === 4008) {
|
||||
const wide = record.type === 4000;
|
||||
const sample = data.subarray(record.start, Math.min(record.end, record.start + remaining * (wide ? 2 : 1)));
|
||||
const text = sample.toString(wide ? 'utf16le' : 'latin1');
|
||||
snippets.push(text);
|
||||
remaining -= Math.max(1, text.length);
|
||||
}
|
||||
}
|
||||
for (const list of pptChildren(data, document)) {
|
||||
if (list.type !== 4080 || list.instance !== 0) continue;
|
||||
for (const record of pptChildren(data, list)) {
|
||||
if (record.type === 1011) {
|
||||
if (slideId !== undefined) break;
|
||||
slideId = data.readUInt32LE(record.start);
|
||||
} else if (slideId !== undefined && remaining > 0) collect(record);
|
||||
}
|
||||
break;
|
||||
}
|
||||
requireValid(offsets.has(slideId));
|
||||
const slide = pptRecord(data, offsets.get(slideId));
|
||||
requireValid(slide.type === 1006 && slide.container);
|
||||
function collectFromShapes(parent, depth) {
|
||||
requireValid(depth < 32);
|
||||
for (const record of pptChildren(data, parent)) {
|
||||
requireValid(++records <= RECORD_LIMIT);
|
||||
if (remaining <= 0) return;
|
||||
if (record.container || record.type === 0xf00d) collectFromShapes(record, depth + 1);
|
||||
else collect(record);
|
||||
}
|
||||
}
|
||||
if (remaining > 0) collectFromShapes(slide, 0);
|
||||
return textRows(snippets.join('\r'));
|
||||
}
|
||||
|
||||
export async function legacyOfficeThumbnailRows(kind, data) {
|
||||
// Bound the bytes visited even if damaged allocation tables refer to the same sector repeatedly.
|
||||
let bytesLeft = STREAM_LIMIT * 3;
|
||||
const compound = await openCompoundFile((offset, length) => {
|
||||
bytesLeft -= length;
|
||||
requireValid(bytesLeft >= 0);
|
||||
return data.subarray(offset, offset + length);
|
||||
}, data.length);
|
||||
const read = async (...names) => {
|
||||
const name = names.find(candidate => compound.streams.has(candidate));
|
||||
requireValid(name !== undefined);
|
||||
const bytes = await compound.read(name, STREAM_LIMIT);
|
||||
requireValid(bytes?.length === compound.streams.get(name).size && bytes.length > 0);
|
||||
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
||||
};
|
||||
const render = { doc: wordRows, xls: excelRows, ppt: powerpointRows }[kind];
|
||||
const rows = await render(read);
|
||||
requireValid(rows.some(row => row.some(value => value !== '' && value !== undefined)));
|
||||
return rows;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ function describeSyncConflict(conflict, card, task, list, sourceKey, cards = [])
|
||||
const local = card[field], incoming = task[field];
|
||||
const fingerprint = createHash('sha256').update(JSON.stringify([
|
||||
list._id, list.boardId, list.syncRevision, sourceKey, conflict.cardId,
|
||||
conflict.externalId, field, local, incoming, card.syncLastSource,
|
||||
conflict.externalId, field, local, incoming, card.syncLastSource, task.startDateMapping,
|
||||
card.archived, Object.hasOwn(card, field),
|
||||
])).digest('hex');
|
||||
return { ...conflict, local: local ?? '', incoming: incoming ?? '', fingerprint };
|
||||
@@ -44,6 +44,7 @@ function planSyncConflictResolution(conflicts, cards, tasks, list, sourceKey, re
|
||||
return { card, changes: {
|
||||
syncLastSource: { ...(card.syncLastSource || {}), [resolution.field]: task[resolution.field],
|
||||
...(timeMappings[resolution.field] ? { [`${resolution.field}Mapping`]: timeMappings[resolution.field].identity } : {}),
|
||||
...(resolution.field === 'startDate' && task.startDateMapping ? { startDateMapping: task.startDateMapping } : {}),
|
||||
...(resolution.field === 'estimate' && estimateMapping ? { estimateMapping: estimateMapping.identity } : {}) },
|
||||
...(resolution.choice === 'source' ? { [resolution.field]: task[resolution.field] } : {}),
|
||||
} };
|
||||
|
||||
+80
-15
@@ -21,7 +21,7 @@ import { validateAttachmentUrl } from '/models/lib/attachmentUrlValidation';
|
||||
import { attachRepositoryComments, rateLimitWait } from '/models/lib/listSyncIssueDetails';
|
||||
// The services' API clients, as the API import uses them (server/apiImport.js).
|
||||
import { apiImportRequest } from '/server/lib/apiImportRequest';
|
||||
import { openProjectSchemaPath, readOpenProjectHierarchyMetadata, readOpenProjectPlanning, readOpenProjectPlanningCatalog, readOpenProjectRelations, readOpenProjectTimeEntries, readOpenProjectWorkPackageDetails } from '/models/lib/apiImport/openproject';
|
||||
import { openProjectBudgetLinks, openProjectSchemaPath, readOpenProjectHierarchyMetadata, readOpenProjectPlanning, readOpenProjectPlanningCatalog, readOpenProjectRelations, readOpenProjectTimeEntries, readOpenProjectWorkPackageDetails } from '/models/lib/apiImport/openproject';
|
||||
import { openProjectVersionLinks, openProjectTitleKey, openProjectPlanningAssignmentId } from '/models/lib/openProjectVersions';
|
||||
import { OPENPROJECT_TIME_FIELDS, isoDurationHours, sameOpenProjectDuration } from '/models/lib/openProjectDurations';
|
||||
import { readJiraSyncComments, readJiraCloudIssueHistories, completeJiraDataCenterHistories, readJiraProjectSprints } from '/models/lib/apiImport/jira';
|
||||
@@ -212,6 +212,16 @@ async function fetchJiraSprintField(base, headers) {
|
||||
// the planning reader (models/lib/jiraScrumPlanning.js jiraPlanningFields) reads.
|
||||
const sprintSchema = id => ({ [id]: { type: 'array', items: 'json', custom: JIRA_SPRINT_SCHEMA } });
|
||||
|
||||
async function fetchJiraStartDateField(get, version) {
|
||||
const fields = await get(`/rest/api/${version}/field`);
|
||||
if (!Array.isArray(fields)) throw new Error('Invalid Jira field list');
|
||||
const ids = new Set(fields.filter(field => typeof field?.name === 'string' &&
|
||||
field.name.trim().toLowerCase() === 'start date' && field.schema?.type === 'date' &&
|
||||
/^customfield_[1-9]\d{0,15}$/.test(field.id || '')).map(field => field.id));
|
||||
if (ids.size !== 1) throw new Error('Jira requires one visible date field named Start date.');
|
||||
return ids.values().next().value;
|
||||
}
|
||||
|
||||
async function fetchJiraCloudIssues(base, jql, headers, estimateFieldId, planning = {}) {
|
||||
const issues = [], tokens = new Set();
|
||||
const url = new URL(`${base}/rest/api/3/search/jql`);
|
||||
@@ -225,6 +235,7 @@ async function fetchJiraCloudIssues(base, jql, headers, estimateFieldId, plannin
|
||||
fields.push(estimateFieldId);
|
||||
}
|
||||
if (planning.sprintField) fields.push(planning.sprintField);
|
||||
if (planning.startDateField) fields.push(planning.startDateField);
|
||||
if (planning.labels) fields.push('priority', 'components', 'versions');
|
||||
if (planning.releases || planning.labels) fields.push('fixVersions');
|
||||
if (planning.dependencies) fields.push('issuelinks');
|
||||
@@ -282,6 +293,7 @@ export async function fetchJiraIssues(syncSource, credential) {
|
||||
const history = fields.includes('jiraHistory');
|
||||
const apiVersion = cloud ? 3 : 2;
|
||||
const get = async path => (await fetchJson(base + path, headers)).body;
|
||||
const startDateField = fields.includes('startDate') ? await fetchJiraStartDateField(get, apiVersion) : undefined;
|
||||
const complete = async result => {
|
||||
if (labels && result.issues.some(issue => !Array.isArray(issue?.fields?.labels) ||
|
||||
issue.fields.labels.some(label => typeof label !== 'string' || !label.trim()))) {
|
||||
@@ -305,12 +317,13 @@ export async function fetchJiraIssues(syncSource, credential) {
|
||||
}
|
||||
return {
|
||||
...withHistory,
|
||||
...(startDateField ? { jiraStartDateFieldId: startDateField } : {}),
|
||||
...(projectVersions ? { jiraProjectVersions: projectVersions } : {}),
|
||||
...(fields.includes('sprint') && catalogEligible ? await readJiraProjectSprints(get, syncSource.projectKey) : {}),
|
||||
...(voterIdentities ? { jiraVoterSnapshots: await readJiraSyncVoters(get, apiVersion, syncSource.projectKey, result.issues) } : {}),
|
||||
};
|
||||
};
|
||||
const planning = { labels, releases: fields.includes('releases'), dependencies: fields.includes('dependencies'), comments, voterIdentities, history,
|
||||
const planning = { startDateField, labels, releases: fields.includes('releases'), dependencies: fields.includes('dependencies'), comments, voterIdentities, history,
|
||||
subtasks: fields.includes('subtasks'), votes: fields.includes('jiraVotes'),
|
||||
sprintField: fields.includes('sprint') ? await fetchJiraSprintField(base, headers) : null };
|
||||
if (cloud) {
|
||||
@@ -318,7 +331,7 @@ export async function fetchJiraIssues(syncSource, credential) {
|
||||
}
|
||||
const estimateFieldId = syncSource.estimateFieldId;
|
||||
if (estimateFieldId !== undefined && !/^customfield_\d{1,20}$/.test(estimateFieldId)) throw new Error('Invalid Jira estimate field');
|
||||
const extraFields = [...(estimateFieldId ? [estimateFieldId] : []), ...(planning.dependencies ? ['issuelinks'] : []), ...(planning.subtasks ? ['parent'] : []), ...(comments || voterIdentities || history ? ['security'] : []), ...(labels ? ['labels', 'priority', 'components', 'fixVersions', 'versions'] : []), ...(planning.votes ? ['votes'] : [])];
|
||||
const extraFields = [...(startDateField ? [startDateField] : []), ...(estimateFieldId ? [estimateFieldId] : []), ...(planning.dependencies ? ['issuelinks'] : []), ...(planning.subtasks ? ['parent'] : []), ...(comments || voterIdentities || history ? ['security'] : []), ...(labels ? ['labels', 'priority', 'components', 'fixVersions', 'versions'] : []), ...(planning.votes ? ['votes'] : [])];
|
||||
const selectedFields = extraFields.length ? `&fields=*navigable,${extraFields.join(',')}` : '';
|
||||
const issues = []; let total;
|
||||
for (let page = 0; page < MAX_SYNC_PAGES; page += 1) {
|
||||
@@ -449,7 +462,7 @@ export function isJiraCloud(url) {
|
||||
return new URL(url).hostname.endsWith('.atlassian.net');
|
||||
}
|
||||
|
||||
export async function updateJiraIssue(source, credential, issue, fields, assertCurrent, timetracking) {
|
||||
export async function updateJiraIssue(source, credential, issue, fields, assertCurrent, timetracking, startDateField) {
|
||||
if (inGrain()) throw new Error('Writing back to Jira is not available in Sandstorm.');
|
||||
if (!/^[1-9]\d{0,19}$/.test(String(issue.id))) throw new Error('Invalid Jira issue ID.');
|
||||
const base = String(source.url || '').replace(/\/+$/, '');
|
||||
@@ -457,11 +470,27 @@ export async function updateJiraIssue(source, credential, issue, fields, assertC
|
||||
const url = `${base}/rest/api/${version}/issue/${issue.id}`;
|
||||
const auth = { Authorization: jiraAuthorization(base, credential) };
|
||||
const { isDeepStrictEqual } = require('node:util');
|
||||
let skippedStartDate = false;
|
||||
if (startDateField) {
|
||||
const { body: metadata } = await fetchJson(`${url}/editmeta`, { ...auth, Accept: 'application/json' })
|
||||
.catch(error => {
|
||||
if ([403, 404].includes(error.status)) return {};
|
||||
throw error;
|
||||
});
|
||||
const date = metadata?.fields?.[startDateField];
|
||||
if (date?.schema?.type !== 'date' || (!Array.isArray(date.operations) || !date.operations.includes('set')) ||
|
||||
(fields[startDateField] === null && date.required !== false)) {
|
||||
fields = { ...fields };
|
||||
delete fields[startDateField];
|
||||
skippedStartDate = true;
|
||||
}
|
||||
}
|
||||
if (!Object.keys(fields).length && !timetracking) return { updated: false, skippedStartDate };
|
||||
const selected = Object.keys(fields);
|
||||
const requested = timetracking ? [...selected, 'timetracking'] : selected;
|
||||
const { body: current } = await fetchJson(`${url}?fields=${requested.join(',')}`, { ...auth, Accept: 'application/json' });
|
||||
if (String(current?.id) !== String(issue.id) || current.key !== issue.key ||
|
||||
selected.some(field => !Object.hasOwn(current.fields || {}, field) || !isDeepStrictEqual(current.fields[field], issue.fields[field]))) return false;
|
||||
selected.some(field => !Object.hasOwn(current.fields || {}, field) || !isDeepStrictEqual(current.fields[field], issue.fields[field]))) return { updated: false, skippedStartDate };
|
||||
if (timetracking) {
|
||||
const previous = issue.fields?.timetracking;
|
||||
const latest = current.fields?.timetracking;
|
||||
@@ -469,14 +498,14 @@ export async function updateJiraIssue(source, credential, issue, fields, assertC
|
||||
const seconds = field + 'Seconds';
|
||||
return !Object.hasOwn(previous || {}, seconds) || !Object.hasOwn(latest || {}, seconds) || latest[seconds] !== previous[seconds];
|
||||
});
|
||||
if (changed) return false;
|
||||
if (changed) return { updated: false, skippedStartDate };
|
||||
}
|
||||
if (!await assertCurrent()) return false;
|
||||
if (!await assertCurrent()) return { updated: false, skippedStartDate };
|
||||
await writeSyncJson(url, 'PUT', auth, {
|
||||
...(Object.keys(fields).length ? { fields } : {}),
|
||||
...(timetracking ? { update: { timetracking: [{ edit: timetracking }] } } : {}),
|
||||
}, true);
|
||||
return true;
|
||||
return { updated: true, skippedStartDate };
|
||||
}
|
||||
|
||||
export async function updateJiraIssuePriority(source, credential, issue, name, assertCurrent) {
|
||||
@@ -766,23 +795,43 @@ export async function updateOpenProjectWorkPackage(source, credential, workPacka
|
||||
payload.storyPoints = points;
|
||||
}
|
||||
const warnings = [];
|
||||
if (dueField === 'date' && fields.startDate) {
|
||||
warnings.push('OpenProject milestones do not have a start date.');
|
||||
}
|
||||
const linkFields = [
|
||||
['budget', /^\/api\/v3\/budgets\/[1-9]\d*$/],
|
||||
['status', /^\/api\/v3\/statuses\/[1-9]\d*$/],
|
||||
['type', /^\/api\/v3\/types\/[1-9]\d*$/],
|
||||
['priority', /^\/api\/v3\/priorities\/[1-9]\d*$/],
|
||||
].filter(([field]) => Object.hasOwn(fields, field));
|
||||
if (linkFields.length) {
|
||||
if (source.statusId || source.filterId || linkFields.some(([field]) => typeof fields[field] !== 'string' || !fields[field].trim())) {
|
||||
throw new Error('OpenProject status and priority write-back require a named value on an unfiltered list.');
|
||||
if (source.statusId || source.filterId || linkFields.some(([field]) =>
|
||||
!(field === 'budget' && fields.budget === null) && (typeof fields[field] !== 'string' || !fields[field].trim()))) {
|
||||
throw new Error('OpenProject link fields require an allowed value on an unfiltered list.');
|
||||
}
|
||||
const form = await writeSyncJson(`${base}/api/v3/work_packages/${id}/form`, 'POST', auth, { lockVersion });
|
||||
if (stillCurrent && !await stillCurrent()) return;
|
||||
for (const [field, path] of linkFields) {
|
||||
const property = form?._embedded?.schema?.[field];
|
||||
const links = property?._links?.allowedValues;
|
||||
let links = property?._links?.allowedValues;
|
||||
if (field === 'budget' && property?.writable === true) {
|
||||
if (fields.budget === null) {
|
||||
(payload._links ||= {}).budget = { href: null };
|
||||
continue;
|
||||
}
|
||||
const project = workPackage._links?.project?.href;
|
||||
const projectId = typeof project === 'string' && /^\/api\/v3\/(?:projects|workspaces)\/([1-9]\d*)$/.exec(project)?.[1];
|
||||
const budgetsPath = projectId ? `/api/v3/projects/${projectId}/budgets` : undefined;
|
||||
if (budgetsPath && links?.href === budgetsPath) {
|
||||
links = await fetchJson(base + budgetsPath, { ...auth, Accept: 'application/hal+json' })
|
||||
.then(({ body }) => openProjectBudgetLinks(body)).catch(() => undefined);
|
||||
if (stillCurrent && !await stillCurrent()) return;
|
||||
}
|
||||
}
|
||||
const embedded = property?._embedded?.allowedValues;
|
||||
const candidates = [
|
||||
...(Array.isArray(links) ? links : []),
|
||||
...(Array.isArray(embedded) ? embedded.map(value => ({ title: value?.name, href: value?._links?.self?.href })) : []),
|
||||
...(Array.isArray(embedded) ? embedded.map(value => ({ title: field === 'budget' ? value?.subject : value?.name, href: value?._links?.self?.href })) : []),
|
||||
];
|
||||
const matches = new Set(candidates.filter(link => link?.title === fields[field] &&
|
||||
typeof link.href === 'string' && path.test(link.href)).map(link => link.href));
|
||||
@@ -791,7 +840,7 @@ export async function updateOpenProjectWorkPackage(source, credential, workPacka
|
||||
} else {
|
||||
warnings.push(field === 'status'
|
||||
? 'OpenProject does not report a unique allowed transition to this status.'
|
||||
: 'OpenProject does not report this priority as a unique allowed value.');
|
||||
: `OpenProject does not report this ${field} as a unique allowed value.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -818,6 +867,22 @@ export async function updateOpenProjectWorkPackage(source, credential, workPacka
|
||||
payload[remote] = seconds === null ? null : `PT${seconds}S`;
|
||||
estimates.push([remote, value]);
|
||||
}
|
||||
const type = payload._links?.type;
|
||||
if (type) {
|
||||
// Changing type can change fields and workflow. Preview the full update,
|
||||
// keeping milestone conversion separate from ordinary type write-back.
|
||||
const form = await writeSyncJson(`${base}/api/v3/work_packages/${id}/form`, 'POST', auth, payload);
|
||||
if (stillCurrent && !await stillCurrent()) return;
|
||||
const { schema, payload: preview, validationErrors } = form?._embedded || {};
|
||||
const compatibleDates = dueField === 'date' ? schema?.date?.type === 'Date'
|
||||
: schema?.dueDate?.type === 'Date' && !schema.date;
|
||||
if (form?._type !== 'Form' || !compatibleDates || preview?._links?.type?.href !== type.href ||
|
||||
Object.keys(validationErrors || {}).length) {
|
||||
delete payload._links.type;
|
||||
if (!Object.keys(payload._links).length) delete payload._links;
|
||||
warnings.push('OpenProject did not confirm a compatible work package type.');
|
||||
}
|
||||
}
|
||||
const warning = warnings.join(' ') || undefined;
|
||||
if (Object.keys(payload).length === 1) return warning;
|
||||
const updated = await writeSyncJson(`${base}/api/v3/work_packages/${id}`, 'PATCH',
|
||||
@@ -948,7 +1013,7 @@ export async function fetchOpenProjectWorkPackages(syncSource, credential) {
|
||||
function apiSyncFetcher(type, client, request = () => apiImportRequest) {
|
||||
// `client` and `request` are functions, read at the call: the module's
|
||||
// imports are not there yet when the table below is built in a test.
|
||||
return async (syncSource, credential, { notionBodyResume } = {}) => {
|
||||
return async (syncSource, credential, { notionBodyResume, notionRollupResume } = {}) => {
|
||||
if (inGrain()) throw new Error('Sync from this service is not available in Sandstorm.');
|
||||
const { apiSyncCredentials, DEPENDENCY_SYNC_SOURCES, SUBTASK_SYNC_SOURCES } = require('/models/lib/apiSyncSources');
|
||||
const { cleanApiImportCredentials } = require('/models/lib/apiImportServices');
|
||||
@@ -957,7 +1022,7 @@ function apiSyncFetcher(type, client, request = () => apiImportRequest) {
|
||||
const api = client();
|
||||
const fields = DEPENDENCY_SYNC_SOURCES.includes(type) || SUBTASK_SYNC_SOURCES.includes(type) || ['todoistapi', 'notionapi', 'planka'].includes(type)
|
||||
? [syncSource.fields] : [];
|
||||
if (type === 'notionapi') fields.push(syncSource.notionBodyAfter, notionBodyResume);
|
||||
if (type === 'notionapi') fields.push(syncSource.notionBodyAfter, notionBodyResume, notionRollupResume);
|
||||
return await (api.fetchForSync || api.fetch)(sign, String(syncSource.projectKey || ''), request(), ...fields);
|
||||
} catch (error) {
|
||||
throw syncFetchError(error);
|
||||
|
||||
@@ -18,7 +18,7 @@ const present = value => value !== undefined && value !== null && value !== '' &
|
||||
|
||||
// The planning attributes as Sync reads them once selected; otherwise what the
|
||||
// one-time import does with them (a tag), as before.
|
||||
function issueRules(type, issue, estimateMapping, timeMappings, selected = new Set(), sprintField = null, markdown = false) {
|
||||
function issueRules(type, issue, estimateMapping, timeMappings, selected = new Set(), sprintField = null, markdown = false, jiraStartDateFieldId) {
|
||||
const planning = (field, otherwise) => (selected.has(field) ? mapped(field, true) : otherwise);
|
||||
if (type === 'openproject') {
|
||||
// What parseOpenProject reads of a work package (models/lib/externalParsers.js).
|
||||
@@ -84,6 +84,7 @@ function issueRules(type, issue, estimateMapping, timeMappings, selected = new S
|
||||
comment: Array.isArray(issue.syncComments) ? unusedFallback : selected.has('comments') ? undefined : mapped('comments'),
|
||||
...(selected.has('comments') ? { security: mapped('externalId') } : {}),
|
||||
duedate: mapped('dueDate', true),
|
||||
...(jiraStartDateFieldId ? { [jiraStartDateFieldId]: mapped('startDate', true) } : {}),
|
||||
assignee: mapped('owner_username'), reporter: mapped('requested_by'),
|
||||
timespent: fields.timetracking?.timeSpentSeconds == null ? mapped('spentTime', true) : unusedFallback,
|
||||
...timeRules, timetracking: trackingRules,
|
||||
@@ -188,7 +189,7 @@ function describeSyncSourceCoverage(type, raw, fields, estimateMapping = null, t
|
||||
add(issuePath, 'excluded-item');
|
||||
continue;
|
||||
}
|
||||
const rules = issueRules(type, issue, estimateMapping, timeMappings, selected, sprintField, markdown);
|
||||
const rules = issueRules(type, issue, estimateMapping, timeMappings, selected, sprintField, markdown, raw.jiraStartDateFieldId);
|
||||
if (workPackages) {
|
||||
const plan = openProjectDetails?.planningByIssue?.get(String(issue.id));
|
||||
for (const [key, field] of [
|
||||
@@ -236,7 +237,7 @@ function describeSyncSourceCoverage(type, raw, fields, estimateMapping = null, t
|
||||
maxResults: mapped('externalId'), total: mapped('externalId'), isLast: mapped('externalId'),
|
||||
nextPageToken: mapped('externalId'), board: { name: mapped('board.name') },
|
||||
// WeKan's own Jira export saying its text is Markdown (jiraWikiMarkup.js).
|
||||
wekanTextFormat: mapped('externalId'),
|
||||
wekanTextFormat: mapped('externalId'), jiraStartDateFieldId: mapped('externalId'),
|
||||
// Which field is the Sprint (server/lib/listSyncFetch.js), not issue data.
|
||||
...(sprintField ? { schema: mapped('externalId') } : {}) };
|
||||
inspect(raw, envelope, '');
|
||||
|
||||
@@ -648,7 +648,7 @@ export async function writeBackToOpenProject({ list, source, sourceKey, credenti
|
||||
const writableTimeMappings = Object.fromEntries(Object.entries(timeMappings)
|
||||
.filter(([field]) => ['originalEstimate', 'remainingEstimate', 'scheduleManually', 'ignoreNonWorkingDays', 'duration', 'progress'].includes(field)));
|
||||
if (!source.statusId && !source.filterId) {
|
||||
for (const field of ['status', 'priority']) {
|
||||
for (const field of ['status', 'priority', 'type', 'budget']) {
|
||||
if (timeMappings[field] && !timeMappings[field].openProjectReadOnly) writableTimeMappings[field] = timeMappings[field];
|
||||
}
|
||||
}
|
||||
@@ -720,7 +720,7 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
|
||||
.filter(([field, mapping]) => ['originalEstimate', 'remainingEstimate'].includes(field) && !mapping.jiraReadOnly));
|
||||
const writableMappings = estimateMapping ? { ...writableTimes, estimate: estimateMapping } : writableTimes;
|
||||
const fields = (source.fields || ['title', 'description']).filter(field =>
|
||||
['title', 'description', 'dueDate'].includes(field) || Object.hasOwn(writableMappings, field));
|
||||
['title', 'description', 'dueDate', 'startDate'].includes(field) || Object.hasOwn(writableMappings, field));
|
||||
const sendComments = source.fields?.includes('comments');
|
||||
const sendLabels = source.fields?.includes('labels') && source.jiraLabelWriteBackSince instanceof Date && jiraLabelSnapshots;
|
||||
if (!fields.length && !sendComments && !sendLabels) return;
|
||||
@@ -733,9 +733,12 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
|
||||
const { addSyncTimeEstimates, cardSyncTimes } = require('/models/lib/listSyncTimeEstimates');
|
||||
let tasks = addSyncTimeEstimates(addSyncEstimates(parseJira(raw).tasks, raw, estimateMapping), raw, writableTimes);
|
||||
if (fields.includes('dueDate')) tasks = addIssueDueDates('jira', raw, tasks);
|
||||
if (fields.includes('startDate')) {
|
||||
tasks = addIssueDueDates('jira', raw, tasks, 'startDate');
|
||||
}
|
||||
const scope = { boardId: list.boardId, listId: list._id, syncSourceKey: sourceKey };
|
||||
const cards = await Cards.find({ ...scope, syncExternalId: { $in: [...byKey.keys()] } }, {
|
||||
transform: null, fields: { syncExternalId: 1, title: 1, description: 1, archived: 1, dueAt: 1, syncLastSource: 1, customFields: 1, ...(sendLabels ? { labelIds: 1, jiraLabelBaseline: 1 } : {}) },
|
||||
transform: null, fields: { syncExternalId: 1, title: 1, description: 1, archived: 1, dueAt: 1, startAt: 1, syncLastSource: 1, customFields: 1, ...(sendLabels ? { labelIds: 1, jiraLabelBaseline: 1 } : {}) },
|
||||
}).fetchAsync();
|
||||
if (sendLabels) {
|
||||
const { planJiraLabelWriteBack, planJiraPriorityWriteBack, planJiraOptionWriteBack } = require('/models/lib/jiraLabelWriteBack');
|
||||
@@ -763,8 +766,10 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
|
||||
}
|
||||
}
|
||||
const datedCards = cards.map(card => ({ ...card, ...cardSyncTimes(card, writableTimes), estimate: cardSyncEstimate(card, estimateMapping),
|
||||
startDate: card.startAt?.toISOString().slice(0, 10) || '',
|
||||
dueDate: card.dueAt?.toISOString().slice(0, 10) || '' }));
|
||||
let invalidTimeEstimates = 0;
|
||||
let skippedStartDates = 0;
|
||||
for (const { card, body } of planTaskTextWriteBack({ tasks, cards: datedCards, fields, timeMappings: writableMappings })) {
|
||||
const issue = byKey.get(card.syncExternalId);
|
||||
const prefix = `[${issue.key}] `;
|
||||
@@ -784,6 +789,9 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
|
||||
canonicalDescription = jiraTextToMarkdown(remoteFields.description, adfPlainText);
|
||||
assertEquivalentDescription(body.description, canonicalDescription);
|
||||
}
|
||||
const startDateField = body.startDate !== undefined && raw.jiraStartDateFieldId &&
|
||||
card.syncLastSource?.startDateMapping === raw.jiraStartDateFieldId ? raw.jiraStartDateFieldId : undefined;
|
||||
if (startDateField) remoteFields[startDateField] = body.startDate || null;
|
||||
if (body.dueDate !== undefined) remoteFields.duedate = body.dueDate || null;
|
||||
if (body.estimate !== undefined) remoteFields[estimateMapping.estimateFieldId] = body.estimate;
|
||||
const edit = {};
|
||||
@@ -799,12 +807,13 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
|
||||
const timetracking = Object.keys(edit).length ? edit : undefined;
|
||||
if (!Object.keys(remoteFields).length && !timetracking) continue;
|
||||
const selector = { ...scope, _id: card._id, ...exactFieldSelector(card,
|
||||
['syncExternalId', 'title', 'description', 'archived', 'dueAt', 'syncLastSource', ...(Object.keys(writableMappings).length ? ['customFields'] : [])]) };
|
||||
['syncExternalId', 'title', 'description', 'archived', 'dueAt', 'startAt', 'syncLastSource', ...(Object.keys(writableMappings).length ? ['customFields'] : [])]) };
|
||||
await assertCurrent();
|
||||
const updated = await updateJiraIssue(source, credential, issue, remoteFields, async () => {
|
||||
const { updated, skippedStartDate } = await updateJiraIssue(source, credential, issue, remoteFields, async () => {
|
||||
await assertCurrent();
|
||||
return !!await fieldReadContext.exit(() => Cards.findOneAsync(selector, { fields: { _id: 1 } }));
|
||||
}, timetracking);
|
||||
}, timetracking, startDateField);
|
||||
if (skippedStartDate) skippedStartDates += 1;
|
||||
if (!updated) continue;
|
||||
const changes = {};
|
||||
if (remoteFields.summary && card.title !== prefix + remoteFields.summary) changes.title = prefix + remoteFields.summary;
|
||||
@@ -859,9 +868,14 @@ export async function writeBackToJira({ list, source, sourceKey, credential, ass
|
||||
send: (issue, body, claim) => addJiraServiceRequestComment(source, credential, issue, body, claim),
|
||||
});
|
||||
}
|
||||
const warnings = [];
|
||||
if (invalidTimeEstimates) {
|
||||
throw new Error(`Jira skipped ${invalidTimeEstimates} time estimate edit(s). Enter a duration in whole minutes, including zero.`);
|
||||
warnings.push(`Jira skipped ${invalidTimeEstimates} time estimate edit(s). Enter a duration in whole minutes, including zero.`);
|
||||
}
|
||||
if (skippedStartDates) {
|
||||
warnings.push(`Jira did not allow ${skippedStartDates} Start date edit(s).`);
|
||||
}
|
||||
if (warnings.length) throw new Error(warnings.join(' '));
|
||||
}
|
||||
|
||||
async function writeJiraCommentEdits({ scope, cards, targets, assertCurrent, prepareBody, send, serviceRequest = false }) {
|
||||
|
||||
@@ -17,7 +17,10 @@ Meteor.startup(async () => {
|
||||
const lifetime = 60 * 60 * 1000;
|
||||
const compress = promisify(gzip);
|
||||
const decompress = promisify(gunzip);
|
||||
const maxBulkBytes = 64 * 1024 * 1024;
|
||||
// Bound both the stored snapshot and its expansion. Most Markdown compresses
|
||||
// much smaller than its decoded size.
|
||||
const maxBulkBytes = 256 * 1024 * 1024;
|
||||
const maxEncodedBytes = 64 * 1024 * 1024;
|
||||
const chunkSize = 8 * 1024 * 1024;
|
||||
|
||||
export async function readNotionBodyCheckpoint(list, credential) {
|
||||
@@ -35,6 +38,26 @@ export async function writeNotionBodyCheckpoint(list, credential, checkpoint) {
|
||||
await NotionBodyCheckpoints.upsertAsync(identity, { $set: { checkpoint, expiresAt: new Date(Date.now() + lifetime) } });
|
||||
}
|
||||
|
||||
function rollupCheckpointIdentity(list, credential) {
|
||||
return { _id: `rollup:${credential._id}`, listId: list._id, boardId: list.boardId };
|
||||
}
|
||||
|
||||
export async function readNotionRollupCheckpoint(list, credential) {
|
||||
return (await NotionBodyCheckpoints.findOneAsync({
|
||||
...rollupCheckpointIdentity(list, credential), expiresAt: { $gt: new Date() },
|
||||
}))?.checkpoint;
|
||||
}
|
||||
|
||||
export async function writeNotionRollupCheckpoint(list, credential, checkpoint) {
|
||||
const identity = rollupCheckpointIdentity(list, credential);
|
||||
if (!checkpoint) {
|
||||
await NotionBodyCheckpoints.removeAsync(identity);
|
||||
return;
|
||||
}
|
||||
await NotionBodyCheckpoints.upsertAsync(identity,
|
||||
{ $set: { checkpoint, expiresAt: new Date(checkpoint.startedAt + lifetime) } });
|
||||
}
|
||||
|
||||
export function notionBulkCheckpointId(userId, sourceId, fields, token) {
|
||||
return `bulk:${createHash('sha256').update(JSON.stringify([userId, sourceId, fields, token])).digest('hex')}`;
|
||||
}
|
||||
@@ -48,7 +71,7 @@ export async function readNotionBulkCheckpoint(id) {
|
||||
if (pieces.length !== saved.parts || pieces.some((piece, index) => piece.part !== index)) return undefined;
|
||||
contents = pieces.map(piece => piece.contents).join('');
|
||||
}
|
||||
if (!contents) return undefined;
|
||||
if (!contents || contents.length > maxEncodedBytes) return undefined;
|
||||
return JSON.parse((await decompress(Buffer.from(contents, 'base64'), { maxOutputLength: maxBulkBytes })).toString());
|
||||
}
|
||||
|
||||
@@ -60,6 +83,7 @@ export async function writeNotionBulkCheckpoint(id, progress) {
|
||||
const bytes = Buffer.from(JSON.stringify(progress));
|
||||
if (bytes.length > maxBulkBytes) return false;
|
||||
const contents = (await compress(bytes)).toString('base64');
|
||||
if (contents.length > maxEncodedBytes) return false;
|
||||
const expiresAt = new Date(Date.now() + lifetime);
|
||||
const previous = await NotionBodyCheckpoints.findOneAsync(id, { fields: { generation: 1 } });
|
||||
if (contents.length <= chunkSize) {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const { createHash } = require('node:crypto');
|
||||
const { isIP } = require('node:net');
|
||||
const { locationFromHeaders, hasCoordinates } = require('../../models/lib/geoHeaders');
|
||||
const { normaliseAddress } = require('../../models/lib/ipAddress');
|
||||
const { resolveClientKey } = require('./loginAttemptThrottle');
|
||||
|
||||
function personalApiTokenSource(req, forwardedCount) {
|
||||
function resolveAuditOrigin(req, forwardedCount) {
|
||||
const raw = resolveClientKey({ headers: req.headers, socketAddress: req.socket?.remoteAddress, forwardedCount });
|
||||
const ip = isIP(raw) ? normaliseAddress(raw) : '';
|
||||
const incoming = forwardedCount > 0 ? locationFromHeaders(req.headers) : null;
|
||||
@@ -18,4 +19,10 @@ function personalApiTokenSource(req, forwardedCount) {
|
||||
return { ip, location };
|
||||
}
|
||||
|
||||
module.exports = { personalApiTokenSource };
|
||||
function auditUsageId(tokenId, ip, country, boardId, action, status) {
|
||||
// Preserve the grouping key for records already in the usage collection.
|
||||
const fields = JSON.stringify([tokenId, ip, country || '', boardId, action, status]);
|
||||
return createHash('sha256').update(fields).digest('hex');
|
||||
}
|
||||
|
||||
module.exports = { resolveAuditOrigin, auditUsageId };
|
||||
@@ -1,5 +1,9 @@
|
||||
import { sanitizeTransferValue } from '/models/lib/importExportBoundary';
|
||||
import { MAX_NOTION_IMPORT_MARKDOWN_BYTES } from '/models/lib/notionApiFormat';
|
||||
import { sanitizeInput } from '/server/lib/inputSanitizer';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
|
||||
const jiraPanelLine = /^<!-- (?:jira-panel:[a-z0-9%_.!~*'()-]{0,6144}|\/jira-panel) -->$/gmi;
|
||||
|
||||
// Server wrapper around the pure structural boundary. This is deliberately the
|
||||
// only place that couples transfer validation to server HTML sanitization and Admin Problems,
|
||||
@@ -11,16 +15,31 @@ export function secureTransfer(value, context = {}) {
|
||||
sanitizeHtml: (input, path) => {
|
||||
const jiraDescription = context.direction === 'export' && context.source === 'export:jira-api' &&
|
||||
/^\/\d+\/description$/.test(path);
|
||||
return sanitizeInput(input, {
|
||||
// sanitize-html removes comments, including the Data Center panel
|
||||
// boundaries. Protect only these standalone marker lines, while the
|
||||
// panel body still passes through the usual sanitizer.
|
||||
const panelMarkers = new Map();
|
||||
const text = jiraDescription && context.jiraCloud !== true
|
||||
? input.replace(jiraPanelLine, marker => {
|
||||
const placeholder = `JIRAPANEL${randomUUID()}`;
|
||||
panelMarkers.set(placeholder, marker);
|
||||
return placeholder;
|
||||
})
|
||||
: input;
|
||||
const clean = sanitizeInput(text, {
|
||||
allowJiraTextColor: jiraDescription,
|
||||
allowJiraBackgroundColor: jiraDescription && context.jiraCloud === true,
|
||||
allowJiraCloudNodes: jiraDescription && context.jiraCloud === true,
|
||||
});
|
||||
return panelMarkers.size ? clean.replace(/^JIRAPANEL[0-9a-f-]{36}$/gm,
|
||||
marker => panelMarkers.get(marker) || marker) : clean;
|
||||
},
|
||||
maxDepth: context.maxDepth,
|
||||
maxNodes: context.maxNodes,
|
||||
maxArray: context.maxArray,
|
||||
maxString: context.maxString,
|
||||
maxStringForPath: path => context.direction === 'import' && context.source === 'import:notionapi' &&
|
||||
/^\/pages\/\d+\/body$/.test(path) ? MAX_NOTION_IMPORT_MARKDOWN_BYTES : undefined,
|
||||
maxBinaryString: context.maxBinaryString,
|
||||
});
|
||||
if (result.warnings.length) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { Random } from 'meteor/random';
|
||||
import {
|
||||
NotionBodyCheckpoints, notionBulkCheckpointId, readNotionBulkCheckpoint, writeNotionBulkCheckpoint,
|
||||
readNotionRollupCheckpoint, writeNotionRollupCheckpoint,
|
||||
} from '/server/lib/notionBodyCheckpoints';
|
||||
|
||||
describe('Notion bulk checkpoint storage', function () {
|
||||
@@ -40,6 +41,40 @@ describe('Notion bulk checkpoint storage', function () {
|
||||
}
|
||||
});
|
||||
|
||||
it('resumes compressed Markdown snapshots larger than 64 MiB', async function () {
|
||||
if (!Meteor.isAppTest) this.skip();
|
||||
this.timeout(15000);
|
||||
const id = notionBulkCheckpointId(Random.id(), Random.id(), ['description'], Random.secret());
|
||||
const body = 'Markdown paragraph. '.repeat(210000);
|
||||
const progress = { cursor: 'next-page', document: {
|
||||
pages: Array.from({ length: 17 }, (_, index) => ({ id: String(index), body })),
|
||||
} };
|
||||
try {
|
||||
assert.ok(body.length * progress.document.pages.length > 64 * 1024 * 1024);
|
||||
assert.equal(await writeNotionBulkCheckpoint(id, progress), true);
|
||||
assert.deepEqual(await readNotionBulkCheckpoint(id), progress);
|
||||
} finally {
|
||||
await writeNotionBulkCheckpoint(id, null);
|
||||
}
|
||||
});
|
||||
|
||||
it('isolates rollup progress by list and credential and respects its deadline', async function () {
|
||||
if (!Meteor.isAppTest) this.skip();
|
||||
const list = { _id: Random.id(), boardId: Random.id() };
|
||||
const credential = { _id: Random.id() };
|
||||
const progress = { sourceId: Random.id(), startedAt: Date.now(), targets: [[Random.id(), Random.id()]] };
|
||||
try {
|
||||
await writeNotionRollupCheckpoint(list, credential, progress);
|
||||
assert.deepEqual(await readNotionRollupCheckpoint(list, credential), progress);
|
||||
assert.equal(await readNotionRollupCheckpoint({ ...list, _id: Random.id() }, credential), undefined);
|
||||
assert.equal(await readNotionRollupCheckpoint(list, { _id: Random.id() }), undefined);
|
||||
await writeNotionRollupCheckpoint(list, credential, { ...progress, startedAt: progress.startedAt - 3600001 });
|
||||
assert.equal(await readNotionRollupCheckpoint(list, credential), undefined);
|
||||
} finally {
|
||||
await writeNotionRollupCheckpoint(list, credential, null);
|
||||
}
|
||||
});
|
||||
|
||||
it('splits a large page snapshot across MongoDB documents', async function () {
|
||||
if (!Meteor.isAppTest) this.skip();
|
||||
this.timeout(15000);
|
||||
|
||||
+12
-6
@@ -34,7 +34,7 @@ const { MAPPED_FIELDS, syncTimeFieldSelector, syncTimeMappings, timeMappingIdent
|
||||
import ListSyncCredentials from '/models/listSyncCredentials';
|
||||
import { EXTERNAL_PARSERS, openProjectTimeEntriesByPackage, SYNC_CAPABLE_SOURCES } from '/models/lib/externalParsers';
|
||||
import { planListSyncReconcile, validateListSyncTasks } from '/models/lib/listSyncReconcile';
|
||||
import { readNotionBodyCheckpoint, writeNotionBodyCheckpoint } from '/server/lib/notionBodyCheckpoints';
|
||||
import { readNotionBodyCheckpoint, writeNotionBodyCheckpoint, readNotionRollupCheckpoint, writeNotionRollupCheckpoint } from '/server/lib/notionBodyCheckpoints';
|
||||
import { validateImportSourceShape } from '/models/lib/importSourceShape';
|
||||
import { LIST_SYNC_FETCHERS, recordSyncUrlBlocked, isJiraCloud } from '/server/lib/listSyncFetch';
|
||||
import { SyncedCron } from '/server/cron/syncedCron';
|
||||
@@ -206,16 +206,22 @@ async function reconcileList(list, { fetchers = LIST_SYNC_FETCHERS, resolution,
|
||||
$set: { syncWriteBackError: String((writeError && writeError.message) || writeError).slice(0, 500) } });
|
||||
}
|
||||
}
|
||||
const resumeNotionBody = source.type === 'notionapi' && source.fields?.includes('description') &&
|
||||
!dryRun && !resolution && !conflictScope && recordCoverage;
|
||||
const checkpointNotion = source.type === 'notionapi' && !dryRun && !resolution && !conflictScope && recordCoverage;
|
||||
const resumeNotionBody = checkpointNotion && source.fields?.includes('description');
|
||||
const resumeNotionRollup = checkpointNotion && source.fields?.includes('dependencies');
|
||||
const notionBodyResume = resumeNotionBody ? await readNotionBodyCheckpoint(list, credential) : undefined;
|
||||
const notionRollupResume = resumeNotionRollup ? await readNotionRollupCheckpoint(list, credential) : undefined;
|
||||
const raw = await fetcher(estimateMapping ? { ...source, estimateFieldId: estimateMapping.estimateFieldId } : source,
|
||||
credential, { notionBodyResume });
|
||||
credential, { notionBodyResume, notionRollupResume });
|
||||
validateImportSourceShape(source.type, raw);
|
||||
if (resumeNotionBody && raw.bodyCheckpoint !== notionBodyResume) {
|
||||
await assertCurrent();
|
||||
await writeNotionBodyCheckpoint(list, credential, raw.bodyCheckpoint);
|
||||
}
|
||||
if (resumeNotionRollup && (raw.rollupCheckpoint || notionRollupResume)) {
|
||||
await assertCurrent();
|
||||
await writeNotionRollupCheckpoint(list, credential, raw.rollupCheckpoint);
|
||||
}
|
||||
if (source.type === 'notionapi') {
|
||||
notionBodyAfter = raw.nextBodyAfter;
|
||||
if (source.fields?.includes('notionPeople')) {
|
||||
@@ -309,7 +315,7 @@ async function reconcileList(list, { fetchers = LIST_SYNC_FETCHERS, resolution,
|
||||
const { addIssueDueDates } = require('/models/lib/listSyncIssueDueDates');
|
||||
parsed.tasks = addIssueDueDates(source.type, raw, parsed.tasks);
|
||||
}
|
||||
if (['openproject', 'redmineapi'].includes(source.type) && source.fields?.includes('startDate')) {
|
||||
if (['jira', 'openproject', 'redmineapi'].includes(source.type) && source.fields?.includes('startDate')) {
|
||||
const { addIssueDueDates } = require('/models/lib/listSyncIssueDueDates');
|
||||
parsed.tasks = addIssueDueDates(source.type, raw, parsed.tasks, 'startDate');
|
||||
}
|
||||
@@ -809,7 +815,7 @@ async function reconcileList(list, { fetchers = LIST_SYNC_FETCHERS, resolution,
|
||||
...syncTimeBaseline(task, timeMappings),
|
||||
...(task.dueDate !== undefined ? { dueDate: task.dueDate } : {}),
|
||||
...(task.dueComplete !== undefined ? { dueComplete: task.dueComplete } : {}),
|
||||
...(task.startDate !== undefined ? { startDate: task.startDate } : {}),
|
||||
...(task.startDate !== undefined ? { startDate: task.startDate, ...(task.startDateMapping ? { startDateMapping: task.startDateMapping } : {}) } : {}),
|
||||
...(task.reminderDate !== undefined ? { reminderDate: task.reminderDate } : {}),
|
||||
...(task.title !== undefined ? { title: task.title } : {}),
|
||||
...(task.description !== undefined ? { description: task.description } : {}),
|
||||
|
||||
+43
-16
@@ -138,16 +138,28 @@ const foreachRemovedMember = (doc, modifier, callback) => {
|
||||
};
|
||||
|
||||
Meteor.methods({
|
||||
async 'boards.addLabel'(boardId, name, color, dueAt) {
|
||||
check(boardId, String);
|
||||
check(name, String);
|
||||
check(color, String);
|
||||
check(dueAt, Match.Maybe(Date));
|
||||
await Authentication.checkBoardAdmin(this.userId, boardId);
|
||||
const board = await Boards.findOneAsync(boardId);
|
||||
if (!board) throw new Meteor.Error('not-found');
|
||||
return board.addLabel(name, color, dueAt);
|
||||
},
|
||||
|
||||
// #6947: Board Settings / Date's due date colours, a board admin's. A
|
||||
// threshold null goes back to the default; anything but 0 to a year of
|
||||
// hours is refused.
|
||||
// null threshold restores the default. Red can start up to a year before
|
||||
// or after the due date.
|
||||
async setBoardDueThresholds(boardId, dueSoonHours, overdueAfterHours) {
|
||||
check(boardId, String);
|
||||
check(dueSoonHours, Match.OneOf(Number, null));
|
||||
check(overdueAfterHours, Match.OneOf(Number, null));
|
||||
const { validThresholdHours } = require('/models/lib/dueDateThresholds');
|
||||
for (const value of [dueSoonHours, overdueAfterHours]) {
|
||||
if (value !== null && !validThresholdHours(value)) throw new Meteor.Error('invalid-due-threshold');
|
||||
const { MAX_THRESHOLD_HOURS, validThresholdHours } = require('/models/lib/dueDateThresholds');
|
||||
if ((dueSoonHours !== null && !validThresholdHours(dueSoonHours)) ||
|
||||
(overdueAfterHours !== null && !validThresholdHours(overdueAfterHours, -MAX_THRESHOLD_HOURS))) {
|
||||
throw new Meteor.Error('invalid-due-threshold');
|
||||
}
|
||||
const board = await ReactiveCache.getBoard(boardId);
|
||||
if (!this.userId || !board || !allowIsBoardAdmin(this.userId, board)) {
|
||||
@@ -1866,13 +1878,18 @@ WebApp.handlers.post('/api/boards/:boardId/domains', async function(req, res) {
|
||||
sendJsonResult(res, { code: 400, data: { error: `Invalid domain: ${rawDomain}` } });
|
||||
return;
|
||||
}
|
||||
const domains = (authBoard.domains || []).slice();
|
||||
if (!domains.some(d => d.domain === domain)) {
|
||||
domains.push({ domain, isActive: true });
|
||||
if (authBoard.domains === null) {
|
||||
await Boards.updateAsync({ _id: boardId, domains: null }, { $set: { domains: [] } });
|
||||
}
|
||||
// Reuse the existing setBoardDomains method (same auth + validation).
|
||||
await Meteor.callAsync('setBoardDomains', domains, boardId);
|
||||
await Boards.updateAsync(
|
||||
{ _id: boardId, $nor: [{ 'domains.domain': domain }] },
|
||||
{ $push: { domains: { domain, isActive: true } } },
|
||||
);
|
||||
const updated = await ReactiveCache.getBoard(boardId);
|
||||
if (!updated) {
|
||||
sendJsonResult(res, { code: 404, data: { error: 'Board not found' } });
|
||||
return;
|
||||
}
|
||||
sendJsonResult(res, { code: 200, data: updated.domains || [] });
|
||||
} catch (error) {
|
||||
sendJsonResult(res, publicErrorData(error));
|
||||
@@ -1893,6 +1910,7 @@ WebApp.handlers.post('/api/boards/:boardId/domains', async function(req, res) {
|
||||
* @param {string} domain the email domain to remove, e.g. "example.com"
|
||||
* @return_type [{domain: string, isActive: boolean}]
|
||||
* @response 404 {error: string} The board does not have that domain.
|
||||
* @response 409 {error: string} The domain changed during removal.
|
||||
*/
|
||||
WebApp.handlers.delete('/api/boards/:boardId/domains/:domain', async function(req, res) {
|
||||
try {
|
||||
@@ -1915,16 +1933,25 @@ WebApp.handlers.delete('/api/boards/:boardId/domains/:domain', async function(re
|
||||
return;
|
||||
}
|
||||
const normalized = String(req.params.domain || '').trim().toLowerCase();
|
||||
const filtered = (authBoard.domains || []).filter(d => d.domain !== normalized);
|
||||
// A domain the board does not have is 404, not a 200 for a removal that
|
||||
// removed nothing.
|
||||
if (filtered.length === (authBoard.domains || []).length) {
|
||||
const entries = (authBoard.domains || []).filter(entry => entry.domain === normalized);
|
||||
if (!entries.length) {
|
||||
sendJsonResult(res, { code: 404, data: { error: 'Domain not found' } });
|
||||
return;
|
||||
}
|
||||
// Reuse the existing setBoardDomains method (same auth + validation).
|
||||
await Meteor.callAsync('setBoardDomains', filtered, boardId);
|
||||
// Older FerretDB versions require the complete embedded documents to remove them.
|
||||
const removed = await Boards.updateAsync(
|
||||
{ _id: boardId, domains: { $all: entries } },
|
||||
{ $pullAll: { domains: entries } },
|
||||
);
|
||||
const updated = await ReactiveCache.getBoard(boardId);
|
||||
if (!removed) {
|
||||
if (!updated?.domains?.some(entry => entry.domain === normalized)) {
|
||||
sendJsonResult(res, { code: 404, data: { error: 'Domain not found' } });
|
||||
} else {
|
||||
sendJsonResult(res, { code: 409, data: { error: 'Domain changed during removal' } });
|
||||
}
|
||||
return;
|
||||
}
|
||||
sendJsonResult(res, { code: 200, data: updated.domains || [] });
|
||||
} catch (error) {
|
||||
sendJsonResult(res, publicErrorData(error));
|
||||
|
||||
@@ -1866,6 +1866,10 @@ WebApp.handlers.post(
|
||||
results.push({ index: i, error: 'authorId not found' });
|
||||
continue;
|
||||
}
|
||||
if (input.parentId !== undefined && input.parentId !== null && typeof input.parentId !== 'string') {
|
||||
results.push({ index: i, error: 'Invalid parentId' });
|
||||
continue;
|
||||
}
|
||||
// ParentBleed, bulk sibling: the parent check the single create makes.
|
||||
// Cards.direct skips the DDP deny rule, so this is the only guard here.
|
||||
try {
|
||||
|
||||
+20
-1
@@ -12,6 +12,7 @@ import Lists, { normalizeListColor } from '/models/lists';
|
||||
import UserPositionHistory from '/models/userPositionHistory';
|
||||
import { ensureIndex } from '/server/lib/mongoStartup';
|
||||
import { computeSortForIndex } from '/server/lib/utils';
|
||||
import { listPositionUpdates } from '/models/lib/insertPosition';
|
||||
import { buildListPutUpdate } from '/models/lib/listApiUpdate';
|
||||
import { Random } from 'meteor/random';
|
||||
import { getFeatureFlags } from '/models/lib/featureFlags';
|
||||
@@ -1096,6 +1097,21 @@ async function repositionList(listId, toBoardId, position) {
|
||||
await Lists.direct.updateAsync({ _id: listId }, { $set: { sort: newSort } });
|
||||
}
|
||||
|
||||
async function positionCrossBoardList(listId, toBoardId, position) {
|
||||
const scope = { boardId: toBoardId, archived: false, deletedAt: null };
|
||||
const lists = await ReactiveCache.getLists(scope, { sort: { sort: 1 }, fields: { sort: 1 } });
|
||||
if (!lists.some(list => list._id === listId)) return;
|
||||
const siblings = lists.filter(list => list._id !== listId);
|
||||
const { sort, repairs } = listPositionUpdates(siblings, position);
|
||||
for (const repair of repairs) {
|
||||
await Lists.direct.updateAsync(
|
||||
{ ...scope, _id: repair.list._id, sort: repair.list.sort ?? null },
|
||||
{ $set: { sort: repair.sort } },
|
||||
);
|
||||
}
|
||||
await Lists.direct.updateAsync({ ...scope, _id: listId }, { $set: { sort } });
|
||||
}
|
||||
|
||||
// Copy a list (deep copy: its cards) to the same or a different board, at a
|
||||
// 0-based `position` from the left. Body: { toBoardId?, toSwimlaneId?, position? }
|
||||
WebApp.handlers.post(
|
||||
@@ -1147,7 +1163,10 @@ WebApp.handlers.post(
|
||||
sendJsonResult(res, { code: 200, data: { _id: paramListId } });
|
||||
return;
|
||||
}
|
||||
await list.move(toBoardId, req.body.toSwimlaneId);
|
||||
const { position } = req.body;
|
||||
const index = typeof position === 'number' || typeof position === 'string' ? Number(position) : NaN;
|
||||
const destinationListId = await list.move(toBoardId, req.body.toSwimlaneId);
|
||||
if (position != null) await positionCrossBoardList(destinationListId, toBoardId, index);
|
||||
sendJsonResult(res, { code: 200, data: { _id: paramListId } });
|
||||
},
|
||||
);
|
||||
@@ -8,7 +8,7 @@ import { ReactiveCache } from '/imports/reactiveCache';
|
||||
|
||||
const { personalApiRequest } = require('/models/lib/personalApiTokenScope');
|
||||
const { memberReadsWholeBoard } = require('/models/lib/boardReadAccess');
|
||||
const { personalApiTokenSource } = require('/server/lib/personalApiTokenSource');
|
||||
const { resolveAuditOrigin, auditUsageId } = require('/server/lib/personalApiAudit');
|
||||
const { csvLine } = require('/models/lib/adminCsvExport');
|
||||
const { classifyAddress } = require('/models/lib/ipAddress');
|
||||
|
||||
@@ -17,8 +17,9 @@ const Tokens = new Mongo.Collection('personalApiTokens', { defineMutationMethods
|
||||
const Usage = new Mongo.Collection('personalApiTokenUsage', { defineMutationMethods: false });
|
||||
const DAY = 86400000;
|
||||
const DEFAULT_DAYS = 90;
|
||||
// The verifier receives a 256-bit random token, never a user-chosen password.
|
||||
const hash = value => createHash('sha256').update(value).digest('hex');
|
||||
// Generated bearer tokens contain 256 random bits. The digest is the
|
||||
// indexed lookup key and must stay compatible with already issued tokens.
|
||||
const tokenDigest = secret => createHash('sha256').update(secret).digest('hex');
|
||||
const publicFields = {
|
||||
_id: 0, publicId: 1, userId: 1, name: 1, scope: 1, boards: 1, createdAt: 1, expiresAt: 1, lastUsed: 1, revokedAt: 1,
|
||||
};
|
||||
@@ -45,8 +46,8 @@ function activeToken(token, config, at) {
|
||||
|
||||
async function recordUsage(token, { action, boardId }, req, status, startedAt) {
|
||||
const endedAt = new Date();
|
||||
const { ip, location } = personalApiTokenSource(req, Number(process.env.HTTP_FORWARDED_COUNT || 0));
|
||||
const id = hash(JSON.stringify([token._id, ip, location.country || '', boardId, action, status]));
|
||||
const { ip, location } = resolveAuditOrigin(req, Number(process.env.HTTP_FORWARDED_COUNT || 0));
|
||||
const id = auditUsageId(token._id, ip, location.country, boardId, action, status);
|
||||
await Usage.rawCollection().updateOne({ _id: id }, {
|
||||
$setOnInsert: { tokenId: token.publicId, userId: token.userId, tokenName: token.name, ip, boardId, action, status },
|
||||
$set: { location },
|
||||
@@ -63,7 +64,7 @@ export async function authenticatePersonalApiToken(req, res, next) {
|
||||
const config = await policy();
|
||||
if (config.enabled && /^wkp_[a-f0-9]{64}$/.test(req.authToken) &&
|
||||
/^Bearer\s+wkp_[a-f0-9]{64}$/i.test(req.headers.authorization || '')) {
|
||||
const token = await Tokens.findOneAsync(hash(req.authToken));
|
||||
const token = await Tokens.findOneAsync(tokenDigest(req.authToken));
|
||||
if (token && activeToken(token, config, startedAt)) {
|
||||
const user = await activeUserById(token.userId, 'personal-api-token', req);
|
||||
const permitted = personalApiRequest(token, req.method, req.url, req.body);
|
||||
@@ -124,7 +125,7 @@ Meteor.methods({
|
||||
}
|
||||
const secret = 'wkp_' + randomBytes(32).toString('hex');
|
||||
await Tokens.insertAsync({
|
||||
_id: hash(secret), userId: this.userId, name, createdAt,
|
||||
_id: tokenDigest(secret), userId: this.userId, name, createdAt,
|
||||
expiresAt: input.expiresAt, scope: input.scope, boards,
|
||||
publicId: randomBytes(16).toString('hex'),
|
||||
});
|
||||
|
||||
@@ -26,7 +26,8 @@ import path from 'path';
|
||||
import { DocumentPreviews, indexDocumentText } from '/server/lib/documentGif';
|
||||
import { boundedStreamBuffer, gifCacheKey } from '/server/lib/imageGif';
|
||||
import { convertImageBufferToThumbnail, cachedThumbnail, rememberThumbnail } from '/server/lib/imageThumbnail';
|
||||
const { isThumbnailPath, canThumbnail, THUMBNAIL_TYPE } = require('/models/lib/attachmentThumbnail');
|
||||
import { DOCUMENT_MAX_BYTES, getDocumentThumbnail } from '/server/lib/documentThumbnail';
|
||||
const { isThumbnailPath, canThumbnail, documentThumbnailKind, THUMBNAIL_TYPE } = require('/models/lib/attachmentThumbnail');
|
||||
const { previewPartOf } = require('/models/lib/attachmentPreviewPath');
|
||||
// CacheBleed (GHSA-w3qg-pf27-g68r): files are served after an access check, so never shared-cacheable.
|
||||
const { setPrivateFileCacheHeaders, privateFileCacheHeaders } = require('/models/lib/fileCacheHeaders');
|
||||
@@ -719,7 +720,8 @@ function sendThumbnail(req, res, attachment, key, buffer) {
|
||||
// already been applied, so a thumbnail is readable exactly when the
|
||||
// original is.
|
||||
const wantsThumbnail = isThumbnailPath((req.url || '').replace(/^\/cdn\/storage\/attachments(?=\/)/, ''));
|
||||
if (wantsThumbnail && !canThumbnail(attachment)) {
|
||||
const documentKind = wantsThumbnail && documentThumbnailKind(attachment);
|
||||
if (wantsThumbnail && !documentKind && !canThumbnail(attachment)) {
|
||||
res.writeHead(404);
|
||||
res.end('No thumbnail for this attachment');
|
||||
return;
|
||||
@@ -731,6 +733,23 @@ function sendThumbnail(req, res, attachment, key, buffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (documentKind) {
|
||||
try {
|
||||
if (Number(attachment.size) > DOCUMENT_MAX_BYTES) throw new Error('Document is too large');
|
||||
const openStream = () => attachment.meta?.source === 'legacy'
|
||||
? getOldAttachmentStream(fileId)
|
||||
: attachmentStoreFactory.getFileStrategy(attachment, 'original').getReadStream();
|
||||
const thumbnail = await getDocumentThumbnail(attachment, thumbnailKey, documentKind, openStream,
|
||||
() => Assets.getTextAsync('document-thumbnail-worker.cjs'));
|
||||
rememberThumbnail(thumbnailKey, thumbnail);
|
||||
sendThumbnail(req, res, attachment, thumbnailKey, thumbnail);
|
||||
} catch (error) {
|
||||
res.writeHead(404, { 'Cache-Control': 'no-store' });
|
||||
res.end('No thumbnail for this document');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// #6745: a Range request (a video seek, a resumed download) streams only
|
||||
// the bytes asked for, from the storage backend itself. Legacy
|
||||
// CollectionFS files and thumbnails are always sent whole.
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
# base: core24 (not core26) · no build-base: devel · grade: stable
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: wekan
|
||||
version: '13.39'
|
||||
version: '13.45'
|
||||
base: core24
|
||||
confinement: strict
|
||||
grade: stable
|
||||
@@ -703,18 +703,18 @@ parts:
|
||||
armhf) WEKAN_ARCH="armhf" ;;
|
||||
*) echo "Unsupported architecture: ${CRAFT_ARCH_BUILD_FOR}"; exit 1 ;;
|
||||
esac
|
||||
WEKAN_ZIP="wekan-13.39-${WEKAN_ARCH}.zip"
|
||||
WEKAN_ZIP="wekan-13.45-${WEKAN_ARCH}.zip"
|
||||
echo "Cleaning environment first"
|
||||
rm -rf .build
|
||||
mkdir .build
|
||||
cd .build
|
||||
#wget https://github.com/wekan/wekan/releases/download/v13.39/wekan-13.39-amd64.zip
|
||||
#wget https://github.com/wekan/wekan/releases/download/v13.45/wekan-13.45-amd64.zip
|
||||
# Retry: a release asset can 404 for a short while right after it is
|
||||
# uploaded (CDN/propagation lag), and a plain wget treated that as
|
||||
# fatal. --retry-on-http-error covers the 404/5xx window; a genuinely
|
||||
# missing bundle still fails after the tries are spent.
|
||||
wget --tries=20 --waitretry=20 --retry-on-http-error=404,403,500,502,503 \
|
||||
"https://github.com/wekan/wekan/releases/download/v13.39/${WEKAN_ZIP}"
|
||||
"https://github.com/wekan/wekan/releases/download/v13.45/${WEKAN_ZIP}"
|
||||
unzip "${WEKAN_ZIP}"
|
||||
python3 ../releases/check-telemetry.py --bundle bundle
|
||||
rm "${WEKAN_ZIP}"
|
||||
|
||||
@@ -122,7 +122,7 @@ test('the header bars are glass with dark text; blue is the primary action and t
|
||||
`.${CLASS} input[type=submit].primary`,
|
||||
`.${CLASS} .sidebar .sidebar-content .sidebar-btn`,
|
||||
]) {
|
||||
assert.ok(rule(selector).includes('#2563eb'), `${selector} uses #2563eb`);
|
||||
assert.match(rule(selector), /#1e40af/, `${selector} uses the higher-contrast blue`);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const sharp = require('sharp');
|
||||
const { isThumbnailPath, canThumbnail, thumbnailUrl, THUMBNAIL_EDGE } = require('../models/lib/attachmentThumbnail.js');
|
||||
const { drawing, sampleDxf, sampleDoc, sampleXls, samplePpt } = require('./lib/documentThumbnailFixtures.cjs');
|
||||
const { isThumbnailPath, canThumbnail, documentThumbnailKind, thumbnailUrl, THUMBNAIL_EDGE } = require('../models/lib/attachmentThumbnail.js');
|
||||
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
const read = file => fs.readFileSync(path.join(ROOT, file), 'utf8');
|
||||
@@ -38,6 +39,18 @@ async function main() {
|
||||
assert.equal(thumbnailUrl(''), '');
|
||||
console.log(' ok - thumbnail paths and eligible files');
|
||||
|
||||
assert.equal(documentThumbnailKind({ type: 'application/pdf' }), 'pdf');
|
||||
assert.equal(documentThumbnailKind({ name: 'Report.DOCX', type: 'application/zip' }), 'docx');
|
||||
assert.equal(documentThumbnailKind({ name: 'report.pdf', type: 'text/html' }), null);
|
||||
assert.equal(documentThumbnailKind({ name: 'report.doc' }), 'doc');
|
||||
assert.equal(documentThumbnailKind({ type: 'application/vnd.ms-powerpoint' }), 'ppt');
|
||||
assert.equal(documentThumbnailKind({ name: 'order.XLS', type: 'application/x-ole-storage' }), 'xls');
|
||||
assert.equal(documentThumbnailKind({ type: 'application/dxf' }), 'dxf');
|
||||
assert.equal(documentThumbnailKind({ type: 'image/vnd.dxf', isImage: true }), 'dxf');
|
||||
assert.equal(documentThumbnailKind({ name: 'cut.dxf', type: 'text/plain' }), 'dxf');
|
||||
assert.equal(documentThumbnailKind({ name: 'cut.DXF', type: 'application/octet-stream' }), 'dxf');
|
||||
assert.equal(documentThumbnailKind({ name: 'cut.dwg', type: 'application/octet-stream' }), null);
|
||||
|
||||
// Conversion: a WebP no larger than THUMBNAIL_EDGE, never enlarged.
|
||||
const lib = await loadImageLib();
|
||||
const big = await sharp({ create: { width: 3000, height: 1000, channels: 3, background: '#224488' } }).jpeg().toBuffer();
|
||||
@@ -52,6 +65,122 @@ async function main() {
|
||||
}
|
||||
console.log(' ok - conversion makes a bounded WebP and refuses non-images');
|
||||
|
||||
const { renderDocumentThumbnail, DOCUMENT_MAX_BYTES } = await import('../server/lib/documentThumbnail.js');
|
||||
const source = read('private/document-thumbnail-worker.cjs');
|
||||
const PDFDocument = require('pdfkit');
|
||||
const pdf = await new Promise((resolve, reject) => {
|
||||
const doc = new PDFDocument({ size: [400, 200], compress: false });
|
||||
const chunks = [];
|
||||
doc.on('data', chunk => chunks.push(chunk));
|
||||
doc.on('end', () => resolve(Buffer.concat(chunks)));
|
||||
doc.on('error', reject);
|
||||
doc.rect(0, 0, 400, 200).fill('#3366aa');
|
||||
doc.addPage({ size: [200, 400] }).rect(0, 0, 200, 400).fill('#aa6633');
|
||||
doc.end();
|
||||
});
|
||||
const firstPage = await renderDocumentThumbnail('pdf', pdf, source);
|
||||
const pdfMeta = await sharp(firstPage).metadata();
|
||||
assert.deepEqual([pdfMeta.format, pdfMeta.width, pdfMeta.height], ['webp', 512, 256]);
|
||||
const { r, b } = (await sharp(firstPage).stats()).dominant;
|
||||
assert.ok(b > r, 'the thumbnail shows the blue first page');
|
||||
const { zipSync, strToU8 } = require('fflate');
|
||||
const docx = Buffer.from(zipSync(Object.fromEntries(Object.entries({
|
||||
'[Content_Types].xml': '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/></Types>',
|
||||
'_rels/.rels': '<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/></Relationships>',
|
||||
'word/document.xml': '<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body><w:p><w:r><w:t>Document thumbnail</w:t></w:r></w:p><w:sectPr><w:pgSz w:w="12240" w:h="15840"/></w:sectPr></w:body></w:document>',
|
||||
}).map(([name, text]) => [name, strToU8(text)]))));
|
||||
const odt = Buffer.from(zipSync({
|
||||
'content.xml': strToU8('<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"><office:body><office:text><text:p>OpenDocument thumbnail</text:p></office:text></office:body></office:document-content>'),
|
||||
}));
|
||||
for (const [kind, input] of [['docx', docx], ['odt', odt],
|
||||
['xlsx', fs.readFileSync(path.join(ROOT, 'npm-packages/exceljs/test/data/simple_excel.xlsx'))]]) {
|
||||
const image = await renderDocumentThumbnail(kind, input, source);
|
||||
const info = await sharp(image).metadata();
|
||||
assert.equal(info.format, 'webp', kind);
|
||||
assert.ok(Math.max(info.width, info.height) <= THUMBNAIL_EDGE, kind);
|
||||
const stats = await sharp(image).stats();
|
||||
assert.ok(stats.channels.some(c => c.min < 128), `${kind} thumbnail contains document content`);
|
||||
}
|
||||
const { legacyOfficeThumbnailRows } = await import('../server/lib/legacyOfficeThumbnail.js');
|
||||
const { dxfThumbnailPaths } = await import('../server/lib/dxfThumbnail.js');
|
||||
const [, , , closingEdge, firstHole, secondHole] = dxfThumbnailPaths(sampleDxf());
|
||||
assert.deepEqual(closingEdge, [[0, 50], [0, 0]]);
|
||||
assert.deepEqual(firstHole[0], [33, 25]);
|
||||
assert.deepEqual(secondHole[0], [83, 25]);
|
||||
const curves = dxfThumbnailPaths(drawing(
|
||||
[0, 'LWPOLYLINE', 10, 0, 20, 0, 42, 1, 10, 10, 20, 0],
|
||||
[0, 'ARC', 10, 0, 20, 0, 40, 10, 50, 350, 51, 10],
|
||||
[0, 'ELLIPSE', 10, 0, 20, 0, 11, 10, 21, 0, 40, 0.5],
|
||||
[0, 'SPLINE', 10, 0, 20, 0, 10, 1, 20, 2, 10, 3, 20, 4],
|
||||
[0, 'POLYLINE', 70, 1], [0, 'VERTEX', 10, 0, 20, 0],
|
||||
[0, 'VERTEX', 10, 1, 20, 0], [0, 'SEQEND'],
|
||||
[0, 'LINE', 67, 1, 10, 0, 20, 0, 11, 1000, 21, 1000],
|
||||
));
|
||||
assert.equal(curves.length, 6);
|
||||
assert.ok(Math.abs(curves[0][16][1] + 5) < 1e-8, 'a bulge produces a semicircle');
|
||||
assert.deepEqual(curves[3], [[0, 0], [1, 2], [3, 4]]);
|
||||
const examples = [
|
||||
['doc', sampleDoc(), [['Workshop order'], ['Part 100']]],
|
||||
['xls', sampleXls(), [['Part Å-100', 42, '', '', '', '']]],
|
||||
['ppt', samplePpt(), [['First slide'], ['Workshop']]],
|
||||
];
|
||||
for (const [kind, input, rows] of examples) {
|
||||
assert.deepEqual(await legacyOfficeThumbnailRows(kind, input), rows);
|
||||
await assert.rejects(() => renderDocumentThumbnail(kind, Buffer.from('not an Office file'), source));
|
||||
}
|
||||
for (const [kind, input] of [...examples, ['dxf', sampleDxf()]]) {
|
||||
const image = await renderDocumentThumbnail(kind, input, source);
|
||||
const info = await sharp(image).metadata();
|
||||
assert.equal(info.format, 'webp', kind);
|
||||
assert.deepEqual([info.width, info.height], [512, kind === 'xls' ? 320 : 512]);
|
||||
assert.ok((await sharp(image).stats()).channels[0].min < 100, kind);
|
||||
if (kind === 'dxf') {
|
||||
const { data: pixels, info: { channels, width } } = await sharp(image).raw().toBuffer({ resolveWithObject: true });
|
||||
const red = (x, y) => pixels[(y * width + x) * channels];
|
||||
assert.ok(red(16, 256) < 128, 'the rectangle outline is visible');
|
||||
assert.ok(red(174, 256) < 128 && red(414, 256) < 128, 'both hole outlines are visible');
|
||||
assert.ok(red(136, 256) > 240 && red(376, 256) > 240, 'the holes are white inside');
|
||||
}
|
||||
}
|
||||
await assert.rejects(() => renderDocumentThumbnail('doc', sampleDoc({ encrypted: true }), source));
|
||||
await assert.rejects(() => renderDocumentThumbnail('xls', sampleXls({ encrypted: true }), source));
|
||||
for (const bad of [Buffer.from('AutoCAD Binary DXF\r\n\0'), drawing([0, 'TEXT', 1, 'nothing']),
|
||||
drawing([0, 'LINE', 10, 'NaN', 20, 0, 11, 2, 21, 3]), Buffer.alloc(2 * 1024 * 1024 + 1, 32)]) {
|
||||
await assert.rejects(() => renderDocumentThumbnail('dxf', bad, source));
|
||||
}
|
||||
|
||||
await assert.rejects(() => renderDocumentThumbnail('pdf', Buffer.from('not a PDF'), source));
|
||||
await assert.rejects(() => renderDocumentThumbnail('pdf', Buffer.alloc(DOCUMENT_MAX_BYTES + 1), source),
|
||||
/thumbnail conversion limit/);
|
||||
const embedded = Buffer.from(zipSync({ 'Thumbnails/thumbnail.png': await sharp(big).resize(92, 48).png().toBuffer() }));
|
||||
const embeddedMeta = await sharp(await renderDocumentThumbnail('odp', embedded, source)).metadata();
|
||||
assert.deepEqual([embeddedMeta.width, embeddedMeta.height], [92, 48]);
|
||||
|
||||
const { getDocumentThumbnail } = await import('../server/lib/documentThumbnail.js');
|
||||
const { removePreviews, previewRoot } = require('../server/lib/attachmentPreviewStore.js');
|
||||
const { Readable } = require('node:stream');
|
||||
const folder = fs.mkdtempSync(path.join(require('node:os').tmpdir(), 'wekan-doc-thumb-'));
|
||||
const writable = process.env.WRITABLE_PATH;
|
||||
process.env.WRITABLE_PATH = folder;
|
||||
try {
|
||||
let opens = 0;
|
||||
const fetch = () => getDocumentThumbnail({ _id: 'document-test' }, 'a'.repeat(64), 'pdf', () => {
|
||||
opens += 1;
|
||||
return Readable.from([pdf]);
|
||||
}, () => source);
|
||||
const [one, two] = await Promise.all([fetch(), fetch()]);
|
||||
assert.deepEqual(one, two);
|
||||
assert.deepEqual(await fetch(), one);
|
||||
assert.equal(opens, 1, 'concurrent and subsequent reads share the generated thumbnail');
|
||||
removePreviews('document-test');
|
||||
assert.deepEqual(fs.readdirSync(previewRoot()), [], 'attachment removal also clears its thumbnail');
|
||||
} finally {
|
||||
if (writable === undefined) delete process.env.WRITABLE_PATH;
|
||||
else process.env.WRITABLE_PATH = writable;
|
||||
fs.rmSync(folder, { recursive: true, force: true });
|
||||
}
|
||||
console.log(' ok - first page, Office and OpenDocument thumbnails render actual document content');
|
||||
|
||||
// Cache: bounded by count, least recently used out, keyed by file version.
|
||||
for (let i = 0; i < 510; i += 1) lib.rememberThumbnail(`k${i}`, Buffer.from([i % 256]));
|
||||
assert.equal(lib.cachedThumbnail('k0'), null, 'the oldest entries were evicted');
|
||||
@@ -79,7 +208,7 @@ async function main() {
|
||||
'attachmentDownloadLimits.maxBytes', 'isStorageReadEnabled(storageName)']) {
|
||||
assert.ok(at(check) < thumbnail, `${check} runs before a thumbnail is served`);
|
||||
}
|
||||
assert.match(handler, /if \(wantsThumbnail && !canThumbnail\(attachment\)\) \{\s*res\.writeHead\(404\);/);
|
||||
assert.match(handler, /if \(wantsThumbnail && !documentKind && !canThumbnail\(attachment\)\) \{\s*res\.writeHead\(404\);/);
|
||||
assert.match(handler, /convertImageBufferToThumbnail\(await boundedStreamBuffer\(readStream\)\)/);
|
||||
assert.match(handler, /res\.writeHead\(302, \{ Location: Meteor\.absoluteUrl\(`cdn\/storage\/attachments\/\$\{fileId\}`\)/);
|
||||
// CacheBleed (GHSA-w3qg-pf27-g68r): cached as the original is - private and
|
||||
|
||||
@@ -13,10 +13,10 @@ const sanitizeInput = new Function('require', sanitizerSource
|
||||
.replace(/export /g, '') + '\nreturn sanitizeInput;')(require);
|
||||
const sanitizeTransferValue = new Function(read('models/lib/importExportBoundary.js')
|
||||
.replace(/export \{[^}]+\};/, '') + '\nreturn sanitizeTransferValue;')();
|
||||
const secureTransfer = new Function('sanitizeTransferValue', 'sanitizeInput', 'require',
|
||||
const secureTransfer = new Function('sanitizeTransferValue', 'sanitizeInput', 'randomUUID', 'require',
|
||||
read('server/lib/secureTransfer.js').replace(/^import .*;$/gm, '')
|
||||
.replace('export default secureTransfer;', '').replace(/export /g, '')
|
||||
+ '\nreturn secureTransfer;')(sanitizeTransferValue, sanitizeInput,
|
||||
+ '\nreturn secureTransfer;')(sanitizeTransferValue, sanitizeInput, require('node:crypto').randomUUID,
|
||||
() => ({ record() {} }));
|
||||
const source = read('models/exporter.js');
|
||||
const method = source.slice(source.indexOf(' async buildStream(res) {'), source.indexOf(' async buildCsv('));
|
||||
@@ -140,6 +140,30 @@ function response() {
|
||||
}), [{ description: 'Warning' }]);
|
||||
assert.equal(sanitizeInput('<span style="color:red;position:fixed">One</span><span style="position:fixed">Two</span>',
|
||||
{ allowJiraTextColor: true }), '<span style="color:red">One</span>Two');
|
||||
const inlineMarks = '<u class="discard">Underlined</u> H<sub>2</sub>O x<sup>2</sup> <cite>Handbook</cite>';
|
||||
const cleanMarks = '<u>Underlined</u> H<sub>2</sub>O x<sup>2</sup> ';
|
||||
for (const jiraCloud of [false, true]) {
|
||||
assert.deepEqual(secureTransfer([{ description: inlineMarks, title: inlineMarks }], {
|
||||
direction: 'export', source: 'export:jira-api', jiraCloud,
|
||||
}), [{
|
||||
description: cleanMarks + (jiraCloud ? 'Handbook' : '<cite>Handbook</cite>'),
|
||||
title: 'Underlined H2O x2 Handbook',
|
||||
}]);
|
||||
}
|
||||
const panel = '<!-- jira-panel:title%3DNotes -->\n\n<u>Safe</u>\n\n<!-- /jira-panel -->';
|
||||
for (const jiraCloud of [false, true]) {
|
||||
const [result] = secureTransfer([{ description: panel, title: panel }], {
|
||||
direction: 'export', source: 'export:jira-api', jiraCloud,
|
||||
});
|
||||
assert.equal(result.description, jiraCloud ? '<u>Safe</u>' : panel);
|
||||
assert.equal(result.title, 'Safe');
|
||||
}
|
||||
const cloudPanel = '<div data-jira-panel="info">\n\nText\n\n</div>';
|
||||
const [exportedPanel] = secureTransfer([{
|
||||
description: cloudPanel.replace('<div ', '<div class="discard" '), title: cloudPanel,
|
||||
}], { direction: 'export', source: 'export:jira-api', jiraCloud: true });
|
||||
assert.equal(exportedPanel.description, cloudPanel);
|
||||
assert.equal(exportedPanel.title, 'Text');
|
||||
const highlight = '<span style="background-color:#fedec8">Marked</span>';
|
||||
assert.deepEqual(secureTransfer([{ description: highlight, title: highlight }], {
|
||||
direction: 'export', source: 'export:jira-api', jiraCloud: true,
|
||||
|
||||
@@ -51,16 +51,26 @@ test('hours after the due date before it is overdue; a done card is done whateve
|
||||
});
|
||||
|
||||
test('negative: a threshold that is no number of hours from 0 to a year is no setting', () => {
|
||||
for (const bad of [-1, NaN, Infinity, '24', null, true, MAX_THRESHOLD_HOURS + 1, { valueOf: () => 24 }]) {
|
||||
for (const bad of [-MAX_THRESHOLD_HOURS - 1, NaN, Infinity, '24', null, true, MAX_THRESHOLD_HOURS + 1, { valueOf: () => 24 }]) {
|
||||
assert.equal(validThresholdHours(bad), false, String(bad));
|
||||
assert.deepEqual(dueThresholdsOf({ dueSoonHours: bad, overdueAfterHours: bad }), { soonHours: 48, overdueAfterHours: 0 });
|
||||
// dueDateClass itself takes nothing but a number either.
|
||||
assert.equal(dueDateClass(inHours(30), now, null, { soonHours: bad, overdueAfterHours: bad }), 'due-soon');
|
||||
}
|
||||
assert.equal(validThresholdHours(-1), false);
|
||||
assert.equal(validThresholdHours(0), true);
|
||||
assert.equal(validThresholdHours(1.5), true);
|
||||
});
|
||||
|
||||
test('negative overdue hours turn the due badge red before the deadline', () => {
|
||||
const thresholds = dueThresholdsOf({ dueSoonHours: 48, overdueAfterHours: -24 });
|
||||
assert.equal(thresholds.overdueAfterHours, -24);
|
||||
for (const [hours, expected] of [[49, 'not-due'], [48, 'due-soon'], [24, 'due-soon'], [23.5, 'overdue'], [-1, 'overdue']]) {
|
||||
assert.equal(dueDateClass(inHours(hours), now, null, thresholds), expected);
|
||||
}
|
||||
assert.equal(dueThresholdsOf({ overdueAfterHours: -MAX_THRESHOLD_HOURS }).overdueAfterHours, -MAX_THRESHOLD_HOURS);
|
||||
});
|
||||
|
||||
test('every due date colour reads the board\'s thresholds: no caller left on the fixed 48 hours', () => {
|
||||
const callers = [];
|
||||
const walk = dir => {
|
||||
@@ -90,12 +100,12 @@ test('setBoardDueThresholds: a board admin\'s, a number of hours or null, refuse
|
||||
const src = read('server/models/boards.js');
|
||||
const body = src.slice(src.indexOf('async setBoardDueThresholds('), src.indexOf('async setBoardDateFormat('));
|
||||
assert.match(body, /check\(dueSoonHours, Match\.OneOf\(Number, null\)\)/);
|
||||
assert.match(body, /validThresholdHours\(value\)/);
|
||||
assert.match(body, /validThresholdHours\(overdueAfterHours, -MAX_THRESHOLD_HOURS\)/);
|
||||
assert.match(body, /allowIsBoardAdmin\(this\.userId, board\)/);
|
||||
assert.ok(body.indexOf('invalid-due-threshold') < body.indexOf('updateAsync'), 'refused before anything is written');
|
||||
const schema = read('models/boards.js');
|
||||
assert.match(schema, /dueSoonHours: \{ type: Number, optional: true, min: 0, max: 24 \* 366 \}/);
|
||||
assert.match(schema, /overdueAfterHours: \{ type: Number, optional: true, min: 0, max: 24 \* 366 \}/);
|
||||
assert.match(schema, /overdueAfterHours: \{ type: Number, optional: true, min: -24 \* 366, max: 24 \* 366 \}/);
|
||||
const jade = read('client/components/forms/dateFormatSettings.jade');
|
||||
assert.match(jade, /form\.js-due-thresholds-form/);
|
||||
assert.match(jade, /js-due-soon-hours\(type="number" min="0"/);
|
||||
|
||||
@@ -28,7 +28,7 @@ Module._resolveFilename = function(request, ...rest) {
|
||||
|
||||
const { HEADER_BYTES, ensureTempDir, streamHeaderToTemp, detectedFileMime } =
|
||||
require('../models/lib/fileTypeCorrection.js');
|
||||
const { numberedName } = require('../models/lib/uploadFileName.js');
|
||||
const { numberedName, sanitizeUploadFileName } = require('../models/lib/uploadFileName.js');
|
||||
|
||||
let passed = 0;
|
||||
async function check(name, fn) { await fn(); passed += 1; console.log(' ok -', name); }
|
||||
@@ -104,14 +104,18 @@ async function check(name, fn) { await fn(); passed += 1; console.log(' ok -',
|
||||
const fixtures = [
|
||||
['mail', 'X-Account-Key: account1\r\nX-UIDL: value\r\nX-Mozilla-Status: 0001\r\nFrom: sender@example.org\r\nDate: Tue, 1 Dec 2026 10:50:00 +0000\r\nSubject: Parts\r\n\r\n<html>Order</html>', 'message/rfc822'],
|
||||
['step', 'ISO-10303-21;\nHEADER;\nENDSEC;\nEND-ISO-10303-21;\n', 'model/step'],
|
||||
['dxf', ' 0\nSECTION\n 2\nHEADER\n 0\nENDSEC\n 0\nEOF\n', 'image/vnd.dxf'],
|
||||
['building.ifc', "ISO-10303-21;\nHEADER;\nFILE_SCHEMA(('IFC4'));\nENDSEC;\nDATA;\nENDSEC;\nEND-ISO-10303-21;\n", 'model/step', 'application/x-step'],
|
||||
['dxf', ' 0\nSECTION\n 2\nHEADER\n 0\nENDSEC\n 0\nEOF\n', 'image/vnd.dxf', 'application/x-dxf'],
|
||||
];
|
||||
const base = fs.mkdtempSync(path.join(os.tmpdir(), 'wekan-ft-'));
|
||||
try {
|
||||
for (const [file, contents, type] of fixtures) {
|
||||
for (const [file, contents, ...types] of fixtures) {
|
||||
const fixturePath = path.join(base, file);
|
||||
fs.writeFileSync(fixturePath, contents);
|
||||
assert.strictEqual(await detectedFileMime(fixturePath), type, file);
|
||||
const detected = await detectedFileMime(fixturePath);
|
||||
assert.ok(types.includes(detected), `${file}: ${detected}`);
|
||||
if (file === 'building.ifc') assert.strictEqual(sanitizeUploadFileName(file, detected), file);
|
||||
if (file === 'dxf') assert.strictEqual(sanitizeUploadFileName('part.txt', detected), 'part.dxf');
|
||||
}
|
||||
} finally {
|
||||
fs.rmSync(base, { recursive: true, force: true });
|
||||
|
||||
@@ -139,4 +139,12 @@ test('a text export is made from sanitized values, not sanitized as HTML afterwa
|
||||
assert.doesNotMatch(build, /secureTransfer\(await collect\(/, 'negative: never the collected documents whole');
|
||||
});
|
||||
|
||||
test('a path-specific string budget counts UTF-8 bytes and leaves other fields bounded', () => {
|
||||
const options = { maxString: 3, maxStringForPath: path => path === '/pages/0/body' ? 8 : undefined };
|
||||
assert.deepStrictEqual(boundary.sanitizeTransferValue({ pages: [{ body: 'éééé' }] }, options).value,
|
||||
{ pages: [{ body: 'éééé' }] });
|
||||
assert.throws(() => boundary.sanitizeTransferValue({ pages: [{ body: 'ééééé' }] }, options), /string limit exceeded/);
|
||||
assert.throws(() => boundary.sanitizeTransferValue({ pages: [{ title: 'long' }] }, options), /string limit exceeded/);
|
||||
});
|
||||
|
||||
console.log(`\nimportExportBoundary: ${passed} tests passed`);
|
||||
@@ -353,3 +353,78 @@ test('exports explicitly tagged Jira components without treating ordinary labels
|
||||
return { key: 'PROJ-9', id: '10003' };
|
||||
});
|
||||
});
|
||||
|
||||
test('preserves a three-level hierarchy with verified Jira Cloud issue types', async () => {
|
||||
const { createJiraIssues } = await import('../models/lib/jiraApiExport.js');
|
||||
const credentials = { url: 'https://example.atlassian.net', username: 'name@example.com', token: 'test-token' };
|
||||
const types = [
|
||||
{ id: '11', name: 'Epic', subtask: false, hierarchyLevel: 1 },
|
||||
{ id: '12', name: 'Task', subtask: false, hierarchyLevel: 0 },
|
||||
{ id: '13', name: 'Subtask', subtask: true, hierarchyLevel: -1 },
|
||||
];
|
||||
const cards = [
|
||||
{ cardId: 'leaf', title: 'Leaf', parentId: 'middle' },
|
||||
{ cardId: 'middle', title: 'Middle', parentId: 'root' },
|
||||
{ cardId: 'root', title: 'Root' },
|
||||
];
|
||||
for (const writable of [true, false]) {
|
||||
const issued = [];
|
||||
const result = await createJiraIssues(credentials, 'PROJ', '12', cards, async (url, { method, body }) => {
|
||||
const path = new URL(url).pathname;
|
||||
if (path === '/rest/api/3/project/PROJ') return { key: 'PROJ', issueTypes: types };
|
||||
if (path.endsWith('/issuetypes')) return { startAt: 0, total: types.length, issueTypes: types };
|
||||
if (path.endsWith('/issuetypes/12')) return { startAt: 0, total: 1,
|
||||
fields: [{ fieldId: 'parent', operations: writable ? ['set'] : [] }] };
|
||||
assert.equal(method, 'POST');
|
||||
issued.push([body.fields.summary, body.fields.issuetype.id, body.fields.parent?.key]);
|
||||
return { key: `PROJ-${issued.length}` };
|
||||
}, '13');
|
||||
if (writable) {
|
||||
assert.deepEqual(issued, [['Root', '11', undefined], ['Middle', '12', 'PROJ-1'], ['Leaf', '13', 'PROJ-2']]);
|
||||
assert.equal(result.skippedParents, undefined);
|
||||
} else {
|
||||
assert.equal(result.skippedParents, 1);
|
||||
assert.ok(issued.every(([, type]) => type !== '11'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('exports a four-level Jira hierarchy only with a unique, writable path', async () => {
|
||||
const { createJiraIssues } = await import('../models/lib/jiraApiExport.js');
|
||||
const credentials = { url: 'https://example.atlassian.net', username: 'name@example.com', token: 'test-token' };
|
||||
const supported = [
|
||||
{ id: '10', name: 'Initiative', subtask: false, hierarchyLevel: 2 },
|
||||
{ id: '11', name: 'Epic', subtask: false, hierarchyLevel: 1 },
|
||||
{ id: '12', name: 'Task', subtask: false, hierarchyLevel: 0 },
|
||||
{ id: '13', name: 'Subtask', subtask: true, hierarchyLevel: -1 },
|
||||
];
|
||||
const cards = ['Leaf', 'Task', 'Epic', 'Initiative'].map((title, index, names) => ({
|
||||
cardId: title, title, parentId: names[index + 1],
|
||||
}));
|
||||
for (const mode of ['supported', 'ambiguous', 'read-only']) {
|
||||
const types = mode === 'ambiguous' ? [...supported, { ...supported[1], id: '14' }] : supported;
|
||||
const issued = [];
|
||||
const result = await createJiraIssues(credentials, 'PROJ', '12', cards, async (url, { method, body }) => {
|
||||
const path = new URL(url).pathname;
|
||||
if (path === '/rest/api/3/project/PROJ') return { key: 'PROJ', issueTypes: types };
|
||||
if (path.endsWith('/issuetypes')) return { startAt: 0, total: types.length, issueTypes: types };
|
||||
if (/\/issuetypes\/(11|12)$/.test(path)) {
|
||||
const operations = mode === 'read-only' && path.endsWith('/11') ? [] : ['set'];
|
||||
return { startAt: 0, total: 1, fields: [{ fieldId: 'parent', operations }] };
|
||||
}
|
||||
assert.equal(method, 'POST');
|
||||
issued.push([body.fields.summary, body.fields.issuetype.id, body.fields.parent?.key]);
|
||||
return { key: `PROJ-${issued.length}` };
|
||||
}, '13');
|
||||
if (mode === 'supported') {
|
||||
assert.deepEqual(issued, [
|
||||
['Initiative', '10', undefined], ['Epic', '11', 'PROJ-1'],
|
||||
['Task', '12', 'PROJ-2'], ['Leaf', '13', 'PROJ-3'],
|
||||
]);
|
||||
assert.equal(result.skippedParents, undefined);
|
||||
} else {
|
||||
assert.equal(result.skippedParents, 2);
|
||||
assert.ok(issued.every(([, type]) => type === '12' || type === '13'));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -51,12 +51,13 @@ const load = rel => import(pathToFileURL(path.join(root, rel)).href);
|
||||
assert.equal(md('line one\\\\line two'), 'line one \nline two');
|
||||
assert.equal(md('above\n----\nbelow'), 'above\n---\nbelow');
|
||||
assert.equal(md('{code:java}\nint x = 1 * 2 * 3;\n# not a list\n{code}'), '```java\nint x = 1 * 2 * 3;\n# not a list\n```');
|
||||
assert.equal(md('{code:title=Main.java|borderStyle=solid}\nmain();\n{code}'), '```\nmain();\n```');
|
||||
assert.equal(md('{code:title=Main.java|borderStyle=solid}\nmain();\n{code}'), '```text jira-macro:title%3DMain.java%7CborderStyle%3Dsolid\nmain();\n```');
|
||||
assert.equal(md('{noformat}\n*raw* h1. text\n{noformat}'), '```noformat\n*raw* h1. text\n```');
|
||||
assert.equal(md('||Name||Value||\n|a|1|\n|b|*2*|'), '| Name | Value |\n| --- | --- |\n| a | 1 |\n| b | **2** |');
|
||||
assert.equal(md('|C:\\temp\\|x|'), '| | |\n| --- | --- |\n| C:\\\\temp\\\\ | x |', 'a backslash in a cell cannot end it');
|
||||
assert.equal(md('|no|header|'), '| | |\n| --- | --- |\n| no | header |');
|
||||
assert.equal(md('{panel:title=Note}\nInside\n{panel}'), 'Inside');
|
||||
assert.equal(md('{panel:title=Note}\nInside\n{panel}'),
|
||||
'<!-- jira-panel:title%3DNote -->\n\nInside\n\n<!-- /jira-panel -->');
|
||||
assert.equal(md('line\r\nnext'), 'line\nnext');
|
||||
|
||||
// Negative: what is not wiki markup is left as it is.
|
||||
@@ -769,3 +770,80 @@ require('node:test').test('Jira Cloud table disclosures retain their title, form
|
||||
assert.deepEqual(jiraCloudDescription(markdown, doc), doc);
|
||||
assert.throws(() => jiraCloudDescription(markdown.replace('</details>', ''), doc), /formatting/);
|
||||
});
|
||||
|
||||
require('node:test').test('editing a Jira Cloud disclosure preserves its media blocks', async () => {
|
||||
const { jiraTextToMarkdown } = await import('../models/lib/jiraWikiMarkup.js');
|
||||
const { adfPlainText } = await import('../models/lib/externalParsers.js');
|
||||
const { jiraCloudDescription } = require('../models/lib/jiraDescriptionWriteBack');
|
||||
const media = { type: 'mediaSingle', attrs: { layout: 'center' }, content: [
|
||||
{ type: 'media', attrs: { id: 'existing-media-id', type: 'file', collection: 'jira' } },
|
||||
] };
|
||||
const mediaGroup = { type: 'mediaGroup', content: [
|
||||
{ type: 'media', attrs: { id: 'existing-group-item', type: 'file', collection: 'jira' } },
|
||||
] };
|
||||
const doc = { type: 'doc', version: 1, content: [{ type: 'expand', attrs: { title: 'Checks' }, content: [
|
||||
{ type: 'paragraph', content: [{ type: 'text', text: 'Before' }] }, media,
|
||||
{ type: 'paragraph', content: [{ type: 'text', text: 'After' }] }, mediaGroup,
|
||||
] }] };
|
||||
const markdown = jiraTextToMarkdown(doc, adfPlainText);
|
||||
assert.match(markdown, /\[Jira media 1\]/);
|
||||
assert.deepEqual(jiraCloudDescription(markdown, doc), doc);
|
||||
const updated = jiraCloudDescription(markdown.replace('Before', 'Reviewed'), doc);
|
||||
assert.equal(updated.content[0].content[0].content[0].text, 'Reviewed');
|
||||
assert.deepEqual(updated.content[0].content[1], media);
|
||||
assert.deepEqual(updated.content[0].content[3], mediaGroup);
|
||||
assert.throws(() => jiraCloudDescription(markdown.replace('[Jira media 1]', '[Jira media 2]'), doc), /formatting/);
|
||||
assert.throws(() => jiraCloudDescription(markdown.replace(/`\[Jira media 1\]`/, ''), doc), /formatting/);
|
||||
assert.throws(() => jiraCloudDescription(markdown, null), /formatting/);
|
||||
});
|
||||
|
||||
require('node:test').test('editing a Jira Data Center quote preserves its code and noformat options', async () => {
|
||||
const { jiraWikiToMarkdown } = await import('../models/lib/jiraWikiMarkup.js');
|
||||
const { jiraDataCenterDescription } = require('../models/lib/jiraDescriptionWriteBack');
|
||||
const source = '{quote}\nSteps\n\n{code:js|title=Run|borderStyle=solid|borderWidth=2px|borderColor=#ccc}\nmain();\n{code}\n\n' +
|
||||
'{noformat:borderStyle=dashed|titleBGColor=#F7D6C1|bgColor=#FFFFCE}\nOutput\n{noformat}\n{quote}';
|
||||
const markdown = jiraWikiToMarkdown(source);
|
||||
assert.match(markdown, /js jira-macro:js%7Ctitle%3DRun%7CborderStyle%3Dsolid/);
|
||||
assert.equal(jiraDataCenterDescription(markdown.replace('Steps', 'Steps verified'), source, jiraWikiToMarkdown),
|
||||
source.replace('Steps', 'Steps verified'));
|
||||
assert.throws(() => jiraDataCenterDescription(markdown.replace('%3Dsolid', '%3Ddashed'), source, jiraWikiToMarkdown), /formatting/);
|
||||
assert.throws(() => jiraDataCenterDescription(markdown.replace('%23ccc', 'invalid'), source, jiraWikiToMarkdown), /formatting/);
|
||||
assert.throws(() => jiraDataCenterDescription('New text', source, jiraWikiToMarkdown), /formatting/);
|
||||
});
|
||||
|
||||
require('node:test').test('Jira Data Center preserves panel options and nested literal blocks when editing the body', async () => {
|
||||
const { jiraWikiToMarkdown } = await import('../models/lib/jiraWikiMarkup.js');
|
||||
const { jiraDataCenterDescription, assertEquivalentDescription } = require('../models/lib/jiraDescriptionWriteBack');
|
||||
const previous = '{panel:title=Notes|borderStyle=solid}\nOriginal text\n\n' +
|
||||
'{code:js|title=Example}\nconst ready = true;\n{code}\n\n' +
|
||||
'{noformat:title=Output}\nReady\n{noformat}\n{panel}';
|
||||
const imported = jiraWikiToMarkdown(previous);
|
||||
const updated = imported.replace('Original text', '**Edited** text');
|
||||
const written = jiraDataCenterDescription(updated, previous, jiraWikiToMarkdown);
|
||||
assert.equal(written, previous.replace('Original text', '*Edited* text'));
|
||||
assertEquivalentDescription(updated, jiraWikiToMarkdown(written));
|
||||
assert.throws(() => jiraDataCenterDescription(updated.replace('Notes', 'Other'), previous, jiraWikiToMarkdown),
|
||||
/does not support this formatting/);
|
||||
assert.throws(() => jiraDataCenterDescription(updated.replace('<!-- /jira-panel -->', ''), previous, jiraWikiToMarkdown),
|
||||
/does not support this formatting/);
|
||||
});
|
||||
|
||||
require('node:test').test('Jira Cloud panels retain their type and editable Markdown blocks', async () => {
|
||||
const { jiraTextToMarkdown } = await import('../models/lib/jiraWikiMarkup.js');
|
||||
const { jiraCloudDescription, assertEquivalentDescription } = require('../models/lib/jiraDescriptionWriteBack');
|
||||
const { adfPlainText } = await import('../models/lib/externalParsers.js');
|
||||
const previous = { type: 'doc', version: 1, content: [{ type: 'panel', attrs: { panelType: 'warning' },
|
||||
content: [{ type: 'heading', attrs: { level: 2 }, content: [{ type: 'text', text: 'Read this' }] },
|
||||
{ type: 'paragraph', content: [{ type: 'text', text: 'Before editing', marks: [{ type: 'strong' }] }] }],
|
||||
}] };
|
||||
const imported = jiraTextToMarkdown(previous, adfPlainText);
|
||||
assert.match(imported, /<div data-jira-panel="warning">/);
|
||||
const updated = imported.replace('Before editing', 'After editing');
|
||||
const exported = jiraCloudDescription(updated, previous);
|
||||
assert.equal(exported.content[0].attrs.panelType, 'warning');
|
||||
assert.equal(exported.content[0].content[1].content[0].text, 'After editing');
|
||||
assert.deepEqual(exported.content[0].content[1].content[0].marks, [{ type: 'strong' }]);
|
||||
assertEquivalentDescription(updated, jiraTextToMarkdown(exported, adfPlainText));
|
||||
assert.throws(() => jiraCloudDescription(updated.replace('warning', 'custom'), previous), /does not support/);
|
||||
assert.throws(() => jiraCloudDescription(updated.replace('</div>', ''), previous), /does not support/);
|
||||
});
|
||||
@@ -0,0 +1,111 @@
|
||||
'use strict';
|
||||
|
||||
const { writeCompoundFile } = require('./outlookMsgFixture.cjs');
|
||||
|
||||
const drawing = (...entities) => Buffer.from(['0', 'SECTION', '2', 'ENTITIES',
|
||||
...entities.flat(), '0', 'ENDSEC', '0', 'EOF', ''].join('\r\n'));
|
||||
|
||||
function sampleDxf() {
|
||||
const rectangle = [0, 'LWPOLYLINE', 90, 4, 70, 1, 10, 0, 20, 0,
|
||||
10, 100, 20, 0, 10, 100, 20, 50, 10, 0, 20, 50];
|
||||
const hole = x => [0, 'CIRCLE', 10, x, 20, 25, 40, 8];
|
||||
return drawing(rectangle, hole(25), hole(75));
|
||||
}
|
||||
|
||||
function sampleDoc({ encrypted = false } = {}) {
|
||||
const word = Buffer.alloc(8192);
|
||||
const text = Buffer.from('Workshop order\rPart 100', 'utf16le');
|
||||
word.writeUInt16LE(0xa5ec, 0);
|
||||
word.writeUInt16LE(0x00c1, 2);
|
||||
word.writeUInt16LE(0x0200 | (encrypted ? 0x0100 : 0), 10);
|
||||
word.writeUInt16LE(14, 32);
|
||||
word.writeUInt16LE(22, 62);
|
||||
word.writeUInt32LE(text.length / 2, 76);
|
||||
word.writeUInt16LE(93, 152);
|
||||
word.writeUInt32LE(21, 0x1a6);
|
||||
text.copy(word, 4096);
|
||||
const table = Buffer.alloc(21);
|
||||
table[0] = 2;
|
||||
table.writeUInt32LE(16, 1);
|
||||
table.writeUInt32LE(text.length / 2, 9);
|
||||
table.writeUInt32LE(4096, 15);
|
||||
return Buffer.from(writeCompoundFile({ WordDocument: word, '1Table': table }));
|
||||
}
|
||||
|
||||
function biffRecord(type, body = Buffer.alloc(0)) {
|
||||
const header = Buffer.alloc(4);
|
||||
header.writeUInt16LE(type);
|
||||
header.writeUInt16LE(body.length, 2);
|
||||
return Buffer.concat([header, body]);
|
||||
}
|
||||
|
||||
function biffBof(type) {
|
||||
const body = Buffer.alloc(16);
|
||||
body.writeUInt16LE(0x0600);
|
||||
body.writeUInt16LE(type, 2);
|
||||
return biffRecord(0x0809, body);
|
||||
}
|
||||
|
||||
function sampleXls({ encrypted = false } = {}) {
|
||||
const descriptor = Buffer.alloc(13);
|
||||
descriptor[6] = 5;
|
||||
descriptor.write('Order', 8);
|
||||
const header = Buffer.alloc(11);
|
||||
header.writeUInt32LE(1, 0);
|
||||
header.writeUInt32LE(1, 4);
|
||||
header.writeUInt16LE(10, 8);
|
||||
const globals = () => [
|
||||
biffBof(5), ...(encrypted ? [biffRecord(0x002f, Buffer.alloc(4))] : []),
|
||||
biffRecord(0x0085, descriptor), biffRecord(0x00fc, Buffer.concat([header, Buffer.from('Part ')])),
|
||||
biffRecord(0x003c, Buffer.concat([Buffer.from([1]), Buffer.from('Å-100', 'utf16le')])),
|
||||
biffRecord(0x000a),
|
||||
];
|
||||
descriptor.writeUInt32LE(globals().reduce((length, record) => length + record.length, 0));
|
||||
const quantity = Buffer.alloc(10);
|
||||
quantity.writeUInt16LE(1, 2);
|
||||
quantity.writeInt32LE((42 << 2) | 2, 6);
|
||||
const workbook = Buffer.concat([
|
||||
...globals(), biffBof(0x10), biffRecord(0x00fd, Buffer.alloc(10)),
|
||||
biffRecord(0x027e, quantity), biffRecord(0x000a),
|
||||
]);
|
||||
return Buffer.from(writeCompoundFile({ Workbook: workbook }));
|
||||
}
|
||||
|
||||
function pptRecord(type, body, version = 0, instance = 0) {
|
||||
const header = Buffer.alloc(8);
|
||||
header.writeUInt16LE((instance << 4) | version);
|
||||
header.writeUInt16LE(type, 2);
|
||||
header.writeUInt32LE(body.length, 4);
|
||||
return Buffer.concat([header, body]);
|
||||
}
|
||||
|
||||
function samplePpt() {
|
||||
const persist = id => {
|
||||
const body = Buffer.alloc(20);
|
||||
body.writeUInt32LE(id);
|
||||
return pptRecord(1011, body);
|
||||
};
|
||||
const text = value => pptRecord(4000, Buffer.from(value, 'utf16le'));
|
||||
const list = pptRecord(4080, Buffer.concat([
|
||||
persist(2), text('First slide'), persist(3), text('Second slide'),
|
||||
]), 15);
|
||||
const document = pptRecord(1000, list, 15);
|
||||
const shapeText = pptRecord(0xf00d, text('Workshop'), 0);
|
||||
const slide = pptRecord(1006, shapeText, 15);
|
||||
const directory = Buffer.alloc(12);
|
||||
directory.writeUInt32LE((2 << 20) | 1);
|
||||
directory.writeUInt32LE(document.length, 8);
|
||||
const persistDirectory = pptRecord(6002, directory);
|
||||
const edit = Buffer.alloc(28);
|
||||
edit.writeUInt32LE(document.length + slide.length, 12);
|
||||
edit.writeUInt32LE(1, 16);
|
||||
const currentUser = Buffer.alloc(24);
|
||||
currentUser.writeUInt32LE(0xe391c05f, 4);
|
||||
currentUser.writeUInt32LE(document.length + slide.length + persistDirectory.length, 8);
|
||||
return Buffer.from(writeCompoundFile({
|
||||
'Current User': pptRecord(4086, currentUser),
|
||||
'PowerPoint Document': Buffer.concat([document, slide, persistDirectory, pptRecord(4085, edit)]),
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = { drawing, sampleDxf, sampleDoc, sampleXls, samplePpt };
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const { test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { listEntryOptions, missingListEntryFields } = require('../models/lib/listEntryRequirements');
|
||||
const { listEntryOptions, missingListEntryFields, remapListEntryRequirements } = require('../models/lib/listEntryRequirements');
|
||||
|
||||
test('list entry requires configured values and accepts false and zero', () => {
|
||||
const fields = [{ _id: 'waiting', name: 'Waiting for' }, { _id: 'checked', name: 'Checked' }];
|
||||
@@ -20,3 +20,8 @@ test('lists with no requirements and removed or protected definitions allow entr
|
||||
assert.deepEqual(missingListEntryFields({}, {}, definitions), []);
|
||||
assert.deepEqual(missingListEntryFields({ entryRequirements: ['custom:removed', 'custom:private'] }, {}, definitions), []);
|
||||
});
|
||||
|
||||
test('native imports remap field references, retain dates, and discard missing or invalid values', () => {
|
||||
assert.deepEqual(remapListEntryRequirements(
|
||||
['dueAt', 'custom:old', 'custom:missing', 'dueAt', '__proto__', null], { old: 'new' }), ['dueAt', 'custom:new']);
|
||||
});
|
||||
@@ -39,6 +39,7 @@ const path = require('node:path');
|
||||
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
const { planListMove } = require(path.join(ROOT, 'models', 'lib', 'listMovePlan'));
|
||||
const { listPositionUpdates } = require(path.join(ROOT, 'models', 'lib', 'insertPosition'));
|
||||
|
||||
const listsModel = fs.readFileSync(path.join(ROOT, 'models', 'lists.js'), 'utf8');
|
||||
const serverLists = fs.readFileSync(path.join(ROOT, 'server', 'models', 'lists.js'), 'utf8');
|
||||
@@ -234,4 +235,40 @@ test('an unbound list is still shown in every swimlane, on purpose', () => {
|
||||
assert.match(swimlanesModel, /\{ swimlaneId: '' \}/);
|
||||
});
|
||||
|
||||
test('placing a list between tied siblings preserves their order and unrelated ranks', () => {
|
||||
const siblings = [
|
||||
{ _id: 'Z', sort: 10 }, { _id: 'A', sort: 10 },
|
||||
{ _id: 'C', sort: 100 }, { _id: 'D', sort: 200 },
|
||||
];
|
||||
const { repairs, sort } = listPositionUpdates(siblings, 1);
|
||||
assert.deepEqual(repairs.map(repair => repair.list._id), ['A']);
|
||||
assert.ok(10 < sort && sort < repairs[0].sort && repairs[0].sort < 100);
|
||||
});
|
||||
|
||||
test('inserting near the beginning of a tied group adjusts only the first sibling', () => {
|
||||
const siblings = Array.from({ length: 500 }, (_, _id) => ({ _id, sort: 0 }));
|
||||
const { repairs, sort } = listPositionUpdates(siblings, 1);
|
||||
assert.deepEqual(repairs.map(repair => repair.list._id), [0]);
|
||||
assert.ok(repairs[0].sort < sort && sort < 0);
|
||||
});
|
||||
|
||||
test('inserting into consecutive floating-point ranks avoids probing every window width', () => {
|
||||
const count = 4096;
|
||||
const index = count / 2;
|
||||
const siblings = Array.from({ length: count }, (_, _id) => ({ _id, sort: 1 + _id * Number.EPSILON }));
|
||||
// Count probes of the insertion boundary so this regression is independent of CPU speed.
|
||||
const neighbor = siblings[index - 1];
|
||||
const originalSort = neighbor.sort;
|
||||
let reads = 0;
|
||||
Object.defineProperty(neighbor, 'sort', { get() { reads++; return originalSort; } });
|
||||
|
||||
const { sort, repairs } = listPositionUpdates(siblings, index);
|
||||
assert.ok(reads < 100, `read the same boundary ${reads} times`);
|
||||
assert.equal(repairs.length, count / 2);
|
||||
const ordered = siblings.map(list => list.sort);
|
||||
for (const repair of repairs) ordered[repair.list._id] = repair.sort;
|
||||
ordered.splice(index, 0, sort);
|
||||
assert.ok(ordered.every((rank, i) => Number.isFinite(rank) && (!i || ordered[i - 1] < rank)));
|
||||
});
|
||||
|
||||
console.log(`listMoveSwimlane: ${passed} tests passed`);
|
||||
Loaded 100 of 135 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user