Commit Graph

765 Commits

Author SHA1 Message Date
splitbrain cc47c50fe3 🤖 Rector and PHPCS fixes 2024-02-02 14:08:33 +00:00
Andreas Gohr e6380ba37d replace LESS library. fixes #4088
This replaces the abandoned fork with my own fork at splitbrain/lesserphp

That fork has been cleaned up somewhat and the issues in #4088 should be
fixed.
2024-02-02 15:03:49 +01:00
Andreas Gohr d48c2b252a API: code style fixes 2024-01-07 13:41:20 +01:00
Andreas Gohr 7625c9953d OpenAPI docs: fix error code deduplication 2024-01-07 13:41:19 +01:00
Andreas Gohr d3856637cf API: clean up error codes
Error codes are now extracted from API core and printed on the OpenAPI
overview page. This makes it easier to see what is in use.

Error messages have been cleaned up, some new codes have been assigned.

Some errors have been removed. Eg. it is fine to iterate a media
namespace you don't have read access to. The result will either be empty
or contain files from lower namespaces that you *do* have access to.
2024-01-07 13:41:19 +01:00
Andreas Gohr e4e3d43949 moved OpenAPI generator to correct namespace
added missing doc blocks
2024-01-07 13:41:19 +01:00
Andreas Gohr cd0c7c3ac3 add title to api explorer 2024-01-07 13:41:19 +01:00
Andreas Gohr 0c6e917818 OpenAPI Explorer basically works 2024-01-07 13:41:19 +01:00
Andreas Gohr 5ee967131b attempt to model the JSON-RPC API as openapi spec
Failed because positional parameters are not really possible to model.
Named parameter could be introduces when our minimum requirement is
switched to PHP8+
2024-01-07 13:41:19 +01:00
Andreas Gohr f0319d45ca
Merge pull request #4113 from dokuwiki/jsonrpc-conformity
JSONRPC Standards
2023-11-29 16:09:34 +01:00
Andreas Gohr 6f8e03f5bc implement support for JSON-RPC 1.0, 1.1 and 2.0
This implements the slightly more standardized JSON-RPC standard as an
alternative to my home-grown version. The same server handled all formats
including my own simpler variant.
2023-11-28 17:00:15 +01:00
splitbrain cf927d0791 🤖 Rector and PHPCS fixes 2023-11-28 13:37:14 +00:00
Andreas Gohr a70eeb2fdf
Merge pull request #3961 from dokuwiki/jsonrpc
Add JSON based alternative to XMLRPC
2023-11-28 14:21:04 +01:00
fiwswe 1b2deed915 Use str_starts_with/str_ends_with 2023-09-15 16:29:00 +02:00
Andreas Gohr 257be26ca1 code style: multi statements 2023-08-31 22:47:18 +02:00
Andreas Gohr d4f83172d9 code style: line breaks 2023-08-31 22:44:40 +02:00
Andreas Gohr 26dfc2323f Rector to rename print to echo calls 2023-08-31 22:00:27 +02:00
Andreas Gohr 177d6836e2 coding style: control flow whitespaces 2023-08-31 14:22:35 +02:00
Gerrit Uitslag 5a5ec05346 reformat /lib/exe/ folder 2023-08-31 00:44:29 +02:00
Gerrit Uitslag 62b265e622 reformat lib/exe/mediamanager.php 2023-08-31 00:28:43 +02:00
Andreas Gohr ba8f83490b manual code style fix 2023-08-30 18:47:01 +02:00
Andreas Gohr 316e3ee67c codestyle adjustments: EOF new lines 2023-08-30 17:10:30 +02:00
Andreas Gohr d868eb89f1 codestyle adjustments: function declaration braces/spaces 2023-08-30 17:09:14 +02:00
Andreas Gohr 8c7c53b032 codestyle adjustments: class declaration braces 2023-08-30 17:05:28 +02:00
Andreas Gohr c1482d1c08 codestyle adjustments: function argument spacing 2023-08-30 17:03:06 +02:00
Andreas Gohr 3f3d97d375 codestyle fixes 2023-08-30 12:03:45 +02:00
Andreas Gohr e3c3abf1eb Apply rector fixes to lib/exe 2023-08-29 20:13:06 +02:00
Andreas Gohr f657e5d050 Add JSON based alternative to XMLRPC
XMLRPC is a rather outdated and old-fashioned protocol not much in use
anymore. Developers prefer simpler, JSON based APIs.

This adds a new "JSONRPC" API. Basically it exposes exactly the same
method calls as the XMLRPC API but using JSON instead of XML. It's not a
classical REST API, but should be just as easy to use for developers.

Here is an example call using CURL:

  curl http://localhost/dokuwiki/lib/exe/jsonrpc.phs \
     -H 'Content-Type: application/json' \
     -H "Authorization: Bearer $token" \
     -d '["wiki"]'

Please note that the above uses the token auth implemented in #2432.
Authentication via basic auth or cookies would work as well.
2023-04-27 08:15:37 +02:00
Moritz Raguschat b4af56dc7c Do not reminify minified plugin scripts
Adresses point 5) of #3645
2023-03-29 10:49:53 +02:00
Andreas Gohr af28745a55 extracted JS compressor into its own library
This moves our JavaScript compressor into its own composer dependency.
2023-03-29 10:49:45 +02:00
Andreas Gohr d5fce4941e Merge branch 'pr/3908'
* pr/3908:
  JPEGMeta: clean up exception handling
  Fix: Do not garbage collect the JpegMeta object after reading a tag
  Replace check for null with cast to string
  Fix: Rework error handling in JpegMeta marker reading
  Replace is_null() check with count()
  Fix: Padding in _getFixedString, log the path of damaged images
  Fix: PHP8-related JpegMeta.php fixes
  Backwards Compatibility: Don't error if finishSectionEdit is called without first startSectionEdit
  Fix: 'E_WARNING: Uninitialized string offset -1' on some templates
  Fix: 'E_WARNING: Undefined array key "_data"'
2023-03-11 14:27:47 +01:00
asivery a46a7ce307 Fix: Do not garbage collect the JpegMeta object after reading a tag 2023-03-10 22:47:55 +01:00
Andreas Gohr b43a139518 MediaManager: remove check for removed option
The refshow option has been removed in
3e7e027794 and should not have been
checked anymore. This fixes a warning on PHP8 when deleting a media
file.

Replaces #3912
2023-03-10 15:33:13 +01:00
Andreas Gohr 36300e6044 opening up CSP headers for fetch.php resources
This drops the sandbox attribute as discussed in #3710 to re-enable
inline display of PDFs in Safari again.

Dropping the sandbox attribute should also help with using navigational
links within SVG files as discussed in
https://forum.dokuwiki.org/d/20420-how-to-embed-svg-with-links-the-proper-way

It also allows the loading of fonts from within SVG files. This
currently does not allow font loading from google fonts as asked for
in #3709 though. I'm not sure if we should favor any font provider here.
2022-09-09 14:59:01 +02:00
Benjamin BERNARD 2ab593053f
🐛 Fixes #3738 , default value for mediamanger in fullscreen mode 2022-08-07 21:19:23 +02:00
Andreas Gohr 8e9d8d552b minor SVG improvements
* never try to use slika to resize SVGs - let the browser do it
* use object-fit:cover for all images - this properly crops inside the
  browser if the backend didn't (like for SVGs). currently dokuwiki
  template only - might be worth moving to default styles
* show previews for SVGs in media manager
2022-06-24 19:42:21 +02:00
Andreas Gohr 4b867325b0 Fix #3619 and correctly handle exceptions in XMLRPC
This ensures that any exception happening during XMLRPC processing is
signalled correctly to the client as XML encoded error message.
2022-02-04 19:46:41 +01:00
Andreas Gohr 4ef5d38db5 use correct SVG interwiki fallback icon. #3611 2022-01-27 20:26:07 +01:00
Andreas Gohr 1e519eb533 SVG for interwiki links
This continues the quest to make more use of SVG in the DokuWiki
iconography. Interwiki links are now preferred in SVG, the existing
icons have been replaces by SVGs. This also adjusts the default icons
for external, mail and UNC links.

Icons come from https://materialdesignicons.com/ and
https://github.com/edent/SuperTinyIcons

I kept the old default icons because they might be used by plugins and
templates. They might be deleted later

The DokuWiki interwiki icon huge in filesize compared to all others and
doesn't look good. Would be good to have a simplified version there.
2021-07-19 09:02:36 +02:00
Sam e2c6ce95f2
manifest: add NOSESSION to not require auth
Authentication shouldn't be required for a manifest file.
2021-07-05 23:55:00 -04:00
Jeff a5be6e80a8 Fix to issue #3470 2021-04-09 17:41:33 +02:00
Andreas Gohr dfe72b68b7 Merge branch 'master' into phpunit8
* master:
  dwpage: output meta data as JSON
  dwpage: rename gmeta into getmeta
  translation update
  Make it easier to remove h1 around logo
  fix: better max-width for images in tables
  dwpage.php: add an option to get metadata
  rename namespace Media to File
  use SVG icons for media file links
  readded $jump mechanism, removed unused functions
  fix use of $rev parameter
  fix entity definition
  reenable the option to display a relative namespace for media files
  simplified the media_searchlist tests
  make use of the new media file classes
  SVG based file icons
  first go a refactoring the media manager
  lazy load images
2021-02-16 22:55:26 +01:00
Damien Regad 012c7cdc1e Fix Constant DOKU_MEDIADETAIL already defined
This error only occurs when PHPUnit runs both the `testScripts` and the
`test_Validity` suites [1], because all tests are running in the same
PHP process.

Adding an `if(!defined` check to avoid the problem.

[1]: ./phpunit.phar --filter 'testScripts|test_Validity'
2021-02-06 01:41:36 +01:00
Andreas Gohr 1eadd9e86a fix global access on detail.php and avoid null loading
Another problem surfaced in the tests
2021-02-04 21:51:22 +01:00
Andreas Gohr 24115d4272 use SVG icons for media file links
The dokuwiki template should probably be adjusted a bit. Old png files
are not yet removed as they may be used elsewhere still.
2021-01-07 11:17:25 +01:00
Andreas Gohr 01648efd47 Media CSP: omit script-src and add frame-ancestors
See comments for details:

https://github.com/splitbrain/dokuwiki/pull/3310#discussion_r506909727
https://github.com/splitbrain/dokuwiki/pull/3310#discussion_r506913304
2020-11-19 15:17:42 +01:00
Andreas Gohr 6cda96e3cf Restrictive Content-Security-Policy for media #1045
This adds a CSP header for all media delivered through our fetch.php
dispatcher. This should revent any scripts etc. to be executed when
scriptable media, like SVG is used.

Suggestions on finetuning the policy are welcome.

The policy is added to the MEDIA_SENDFILE event, so plugins can easily
influence it. The way it is passed as an array should make it easier to
modify from plugins as well.

I put the mechanism to send the header into it's own class in the HTTP
namespace. Additional methods from inc/httputils could be moved here
later. The method might also be interesting for #2198 and #1676.
2020-10-14 15:10:47 +02:00
Andreas Gohr a7e2efd2e2 replace deprecated function calls #3266 2020-10-13 15:29:48 +02:00
Andreas Gohr 0c5897cdc0
Merge pull request #3046 from takuy/media_resize_event
add new "MEDIA_RESIZE" event
2020-06-30 10:19:39 +02:00
Andreas Gohr 85b0dd7dc5 readd lib/exe/indexer.php for now. fixes #3137
This ensures backward compability (especially for testing purposes)
2020-06-04 13:29:53 +02:00