Add PDF rendering via PDFObject (#24086)

Use [PDFObject](https://pdfobject.com/) to embed PDFs, replacing our
outdated PDF.js copy we vendor (the last non-webpack vendoring).

[Commit
1](673e0263da)
is the PDFObject integration
[Commit
2](9336f5769d)
is the removal of PDF.js

<img width="1251" alt="Screenshot 2023-05-27 at 09 57 52"
src="https://github.com/go-gitea/gitea/assets/115237/169ce50c-bd1d-4bb0-86e5-1710bd0400a9">
<img width="1257" alt="Screenshot 2023-05-27 at 10 12 50"
src="https://github.com/go-gitea/gitea/assets/115237/318f7ee9-fb11-4093-83e7-17475aa70629">


Fallback for unsupporting browsers (most mobile ones, except Firefox
Mobile):

<img width="358" alt="Screenshot 2023-05-27 at 09 43 34"
src="https://github.com/go-gitea/gitea/assets/115237/8c12d7ba-57d6-4228-89a0-5fef9fad0cbb">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
pull/24507/head^2
silverwind 2 years ago committed by GitHub
parent 35ce7ca25b
commit e4e98979ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      .gitattributes
  2. 1
      .ignore
  3. 6
      package-lock.json
  4. 1
      package.json
  5. 177
      public/vendor/plugins/pdfjs/LICENSE
  6. 23599
      public/vendor/plugins/pdfjs/build/pdf.js
  7. 1
      public/vendor/plugins/pdfjs/build/pdf.js.map
  8. 55370
      public/vendor/plugins/pdfjs/build/pdf.worker.js
  9. 1
      public/vendor/plugins/pdfjs/build/pdf.worker.js.map
  10. BIN
      public/vendor/plugins/pdfjs/web/cmaps/78-EUC-H.bcmap
  11. BIN
      public/vendor/plugins/pdfjs/web/cmaps/78-EUC-V.bcmap
  12. BIN
      public/vendor/plugins/pdfjs/web/cmaps/78-H.bcmap
  13. BIN
      public/vendor/plugins/pdfjs/web/cmaps/78-RKSJ-H.bcmap
  14. BIN
      public/vendor/plugins/pdfjs/web/cmaps/78-RKSJ-V.bcmap
  15. BIN
      public/vendor/plugins/pdfjs/web/cmaps/78-V.bcmap
  16. BIN
      public/vendor/plugins/pdfjs/web/cmaps/78ms-RKSJ-H.bcmap
  17. BIN
      public/vendor/plugins/pdfjs/web/cmaps/78ms-RKSJ-V.bcmap
  18. BIN
      public/vendor/plugins/pdfjs/web/cmaps/83pv-RKSJ-H.bcmap
  19. BIN
      public/vendor/plugins/pdfjs/web/cmaps/90ms-RKSJ-H.bcmap
  20. BIN
      public/vendor/plugins/pdfjs/web/cmaps/90ms-RKSJ-V.bcmap
  21. BIN
      public/vendor/plugins/pdfjs/web/cmaps/90msp-RKSJ-H.bcmap
  22. BIN
      public/vendor/plugins/pdfjs/web/cmaps/90msp-RKSJ-V.bcmap
  23. BIN
      public/vendor/plugins/pdfjs/web/cmaps/90pv-RKSJ-H.bcmap
  24. BIN
      public/vendor/plugins/pdfjs/web/cmaps/90pv-RKSJ-V.bcmap
  25. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Add-H.bcmap
  26. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Add-RKSJ-H.bcmap
  27. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Add-RKSJ-V.bcmap
  28. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Add-V.bcmap
  29. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-CNS1-0.bcmap
  30. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-CNS1-1.bcmap
  31. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-CNS1-2.bcmap
  32. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-CNS1-3.bcmap
  33. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-CNS1-4.bcmap
  34. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-CNS1-5.bcmap
  35. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-CNS1-6.bcmap
  36. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-CNS1-UCS2.bcmap
  37. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-GB1-0.bcmap
  38. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-GB1-1.bcmap
  39. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-GB1-2.bcmap
  40. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-GB1-3.bcmap
  41. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-GB1-4.bcmap
  42. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-GB1-5.bcmap
  43. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-GB1-UCS2.bcmap
  44. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Japan1-0.bcmap
  45. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Japan1-1.bcmap
  46. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Japan1-2.bcmap
  47. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Japan1-3.bcmap
  48. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Japan1-4.bcmap
  49. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Japan1-5.bcmap
  50. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Japan1-6.bcmap
  51. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Japan1-UCS2.bcmap
  52. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Korea1-0.bcmap
  53. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Korea1-1.bcmap
  54. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Korea1-2.bcmap
  55. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Adobe-Korea1-UCS2.bcmap
  56. BIN
      public/vendor/plugins/pdfjs/web/cmaps/B5-H.bcmap
  57. BIN
      public/vendor/plugins/pdfjs/web/cmaps/B5-V.bcmap
  58. BIN
      public/vendor/plugins/pdfjs/web/cmaps/B5pc-H.bcmap
  59. BIN
      public/vendor/plugins/pdfjs/web/cmaps/B5pc-V.bcmap
  60. BIN
      public/vendor/plugins/pdfjs/web/cmaps/CNS-EUC-H.bcmap
  61. BIN
      public/vendor/plugins/pdfjs/web/cmaps/CNS-EUC-V.bcmap
  62. BIN
      public/vendor/plugins/pdfjs/web/cmaps/CNS1-H.bcmap
  63. BIN
      public/vendor/plugins/pdfjs/web/cmaps/CNS1-V.bcmap
  64. BIN
      public/vendor/plugins/pdfjs/web/cmaps/CNS2-H.bcmap
  65. 3
      public/vendor/plugins/pdfjs/web/cmaps/CNS2-V.bcmap
  66. BIN
      public/vendor/plugins/pdfjs/web/cmaps/ETHK-B5-H.bcmap
  67. BIN
      public/vendor/plugins/pdfjs/web/cmaps/ETHK-B5-V.bcmap
  68. BIN
      public/vendor/plugins/pdfjs/web/cmaps/ETen-B5-H.bcmap
  69. BIN
      public/vendor/plugins/pdfjs/web/cmaps/ETen-B5-V.bcmap
  70. 3
      public/vendor/plugins/pdfjs/web/cmaps/ETenms-B5-H.bcmap
  71. BIN
      public/vendor/plugins/pdfjs/web/cmaps/ETenms-B5-V.bcmap
  72. BIN
      public/vendor/plugins/pdfjs/web/cmaps/EUC-H.bcmap
  73. BIN
      public/vendor/plugins/pdfjs/web/cmaps/EUC-V.bcmap
  74. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Ext-H.bcmap
  75. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Ext-RKSJ-H.bcmap
  76. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Ext-RKSJ-V.bcmap
  77. BIN
      public/vendor/plugins/pdfjs/web/cmaps/Ext-V.bcmap
  78. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GB-EUC-H.bcmap
  79. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GB-EUC-V.bcmap
  80. 4
      public/vendor/plugins/pdfjs/web/cmaps/GB-H.bcmap
  81. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GB-V.bcmap
  82. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBK-EUC-H.bcmap
  83. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBK-EUC-V.bcmap
  84. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBK2K-H.bcmap
  85. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBK2K-V.bcmap
  86. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBKp-EUC-H.bcmap
  87. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBKp-EUC-V.bcmap
  88. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBT-EUC-H.bcmap
  89. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBT-EUC-V.bcmap
  90. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBT-H.bcmap
  91. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBT-V.bcmap
  92. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBTpc-EUC-H.bcmap
  93. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBTpc-EUC-V.bcmap
  94. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBpc-EUC-H.bcmap
  95. BIN
      public/vendor/plugins/pdfjs/web/cmaps/GBpc-EUC-V.bcmap
  96. BIN
      public/vendor/plugins/pdfjs/web/cmaps/H.bcmap
  97. BIN
      public/vendor/plugins/pdfjs/web/cmaps/HKdla-B5-H.bcmap
  98. BIN
      public/vendor/plugins/pdfjs/web/cmaps/HKdla-B5-V.bcmap
  99. BIN
      public/vendor/plugins/pdfjs/web/cmaps/HKdlb-B5-H.bcmap
  100. BIN
      public/vendor/plugins/pdfjs/web/cmaps/HKdlb-B5-V.bcmap
  101. Some files were not shown because too many files have changed in this diff Show More

1
.gitattributes vendored

@ -2,7 +2,6 @@
*.tmpl linguist-language=Handlebars
/assets/*.json linguist-generated
/public/img/svg/*.svg linguist-generated
/public/vendor/** -text -eol linguist-vendored
/templates/swagger/v1_json.tmpl linguist-generated
/vendor/** -text -eol linguist-vendored
/web_src/fomantic/build/** linguist-generated

@ -3,6 +3,5 @@
/modules/options/bindata.go
/modules/public/bindata.go
/modules/templates/bindata.go
/public/vendor/plugins
/vendor
node_modules

6
package-lock.json generated

@ -37,6 +37,7 @@
"minimatch": "9.0.1",
"monaco-editor": "0.38.0",
"monaco-editor-webpack-plugin": "7.0.1",
"pdfobject": "2.2.11",
"pretty-ms": "8.0.0",
"sortablejs": "1.15.0",
"swagger-ui-dist": "4.19.0",
@ -8234,6 +8235,11 @@
"node": "*"
}
},
"node_modules/pdfobject": {
"version": "2.2.11",
"resolved": "https://registry.npmjs.org/pdfobject/-/pdfobject-2.2.11.tgz",
"integrity": "sha512-vGHG1+APo9+FQnnQsf36oHnpL7orJDkt8V3jRTQdvuajgJXBs1PbjA+gKsoiU1BOSNe9aSQubYWnW1LhNqurGw=="
},
"node_modules/picocolors": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",

@ -37,6 +37,7 @@
"minimatch": "9.0.1",
"monaco-editor": "0.38.0",
"monaco-editor-webpack-plugin": "7.0.1",
"pdfobject": "2.2.11",
"pretty-ms": "8.0.0",
"sortablejs": "1.15.0",
"swagger-ui-dist": "4.19.0",

@ -1,177 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -1,3 +0,0 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEáCNS2-H

@ -1,3 +0,0 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSEá ETen-B5-H` ^

@ -1,4 +0,0 @@
àRCopyright 1990-2009 Adobe Systems Incorporated.
All rights reserved.
See ./LICENSE!!<EFBFBD>º]aX!!]`<EFBFBD>21<EFBFBD>> <EFBFBD>p <EFBFBD>z<EFBFBD>$]‚<EFBFBD>"R‚d<EFBFBD>-Uƒ7<EFBFBD>*4„%<EFBFBD>+ „Z „{<EFBFBD>/%…<<EFBFBD>9K…b<EFBFBD>1]†.<EFBFBD>" ‰`]‡,<EFBFBD>"]ˆ
<EFBFBD>"]ˆh<EFBFBD>"]‰F<EFBFBD>"]Š$<EFBFBD>"]‹<EFBFBD>"]‹`<EFBFBD>"]Œ><EFBFBD>"]<EFBFBD><EFBFBD>"]<EFBFBD>z<EFBFBD>"]ŽX<EFBFBD>"]<EFBFBD>6<EFBFBD>"]<EFBFBD><EFBFBD>"]<EFBFBD>r<EFBFBD>"]‘P<EFBFBD>"]’.<EFBFBD>"]“ <EFBFBD>"]“j<EFBFBD>"]”H<EFBFBD>"]•&<EFBFBD>"]–<EFBFBD>"]–b<EFBFBD>"]—@<EFBFBD>"]˜<EFBFBD>"]˜|<EFBFBD>"]™Z<EFBFBD>"]š8<EFBFBD>"]›<EFBFBD>"]›t<EFBFBD>"]œR<EFBFBD>"]<EFBFBD>0<EFBFBD>"]ž<EFBFBD>"]žl<EFBFBD>"]ŸJ<EFBFBD>"] (<EFBFBD>"]¡<EFBFBD>"]¡d<EFBFBD>"]¢B<EFBFBD>"]£ <EFBFBD>"X£~<EFBFBD>']¤W<EFBFBD>"]¥5<EFBFBD>"]¦<EFBFBD>"]¦q<EFBFBD>"]§O<EFBFBD>"]¨-<EFBFBD>"]© <EFBFBD>"]©i<EFBFBD>"]ªG<EFBFBD>"]«%<EFBFBD>"]¬<EFBFBD>"]¬a<EFBFBD>"]­?<EFBFBD>"]®<EFBFBD>"]®{<EFBFBD>"]¯Y<EFBFBD>"]°7<EFBFBD>"]±<EFBFBD>"]±s<EFBFBD>"]²Q<EFBFBD>"]³/<EFBFBD>"]´ <EFBFBD>"]´k<EFBFBD>"]µI<EFBFBD>"]¶'<EFBFBD>"]·<EFBFBD>"]·c<EFBFBD>"]¸A<EFBFBD>"]¹<EFBFBD>"]¹}<EFBFBD>"]º[<EFBFBD>"]»9

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save