Upgrading pagedjs: Difference between revisions

From Creative Crowds wiki
Jump to navigation Jump to search
Created page with "Up until today (February 21st, 2026), the version of pagedjs that Octomode depends on is 0.1.43. From today, we will upgrade the version to the latest stable version, 0.4.3. Octomode depends on two files that should be changed with the upgrade. * /opt/octomode/static/pagedjs.polyfill.js (v0.1.43) * /opt/octomode/static/pagedjs.css (v0.2.0) These should be upgraded to * /opt/octomode/static/pagedjs.polyfill.js (v0.4.3) * /opt/octomode/static/interface.css (v0.4) Th..."
 
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
Up until today (February 21st, 2026), the version of pagedjs that Octomode depends on is 0.1.43.
Up until today (February 21st, 2026), the version of pagedjs that Octomode depends on is 0.1.43.


From today, we will upgrade the version to the latest stable version, 0.4.3.
From today, we will upgrade to the latest stable version, 0.4.3.


Octomode depends on two files that should be changed with the upgrade.
Octomode depends on two files that should be changed with the upgrade.


* /opt/octomode/static/pagedjs.polyfill.js (v0.1.43)
* /opt/octomode/static/paged.polyfill.js (v0.1.43)
* /opt/octomode/static/pagedjs.css (v0.2.0)
* /opt/octomode/static/pagedjs.css (v0.2.0)


These should be upgraded to  
These should be upgraded to  


* /opt/octomode/static/pagedjs.polyfill.js (v0.4.3)
* /opt/octomode/static/paged.polyfill.js (v0.4.3)
* /opt/octomode/static/interface.css (v0.4)
* /opt/octomode/static/interface.css (v0.4)


The file <code>pagedjs.polyfill.js</code> can be overwritten, but as the CSS has a different filename, we should also update any templates that are being used by Octomode:
The file <code>paged.polyfill.js</code> can be overwritten, but as the CSS has a different filename, we should also update any templates with the old filename that are still being used by Octomode:


* /opt/octomode/static/templates/pagedjs.html
* /opt/octomode/static/templates/pagedjs.html
Line 19: Line 19:
== Method ==
== Method ==


inside <code>/opt/octomode/static/</code>
1. go inside <code>/opt/octomode/static/</code> and download the files (make backups first)


$ curl https://app.unpkg.com/pagedjs@0.4.3/files/dist/paged.polyfill.js > pagedjs.polyfill.js
$ curl https://unpkg.com/pagedjs@0.4.3/dist/paged.polyfill.js > paged.polyfill.js
$ curl https://gitlab.coko.foundation/pagedjs/interface-polyfill/-/raw/master/interface.css?ref_type=heads > interface.css
$ curl https://gitlab.coko.foundation/pagedjs/interface-polyfill/-/raw/master/interface.css?ref_type=heads > interface.css


inside <code>/opt/octomode/static/templates</code>
2. change ownership to the www-data user


$ sudo nano pagedjs.html
$ chown www-data:www-data paged.polyfill.js
$ chown www-data:www-data interface.css


Replace the text "pagedjs.css" with "interface.css". Changing it from:
3. go inside <code>/opt/octomode/static/templates</code> and edit the template <code>pagedjs.html</code>


<code>
$ sudo nano pagedjs.html
 
4. Replace the text "pagedjs.css" with "interface.css". Changing it from:
 
<syntaxhighlight lang="html" line>
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="{{ lang }}">
<html lang="{{ lang }}">
Line 46: Line 51:
</body>
</body>
</html>
</html>
</code>
</syntaxhighlight>


to
to


<code>
<syntaxhighlight lang="html" line>
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="{{ lang }}">
<html lang="{{ lang }}">
Line 66: Line 71:
</body>
</body>
</html>
</html>
</code>
</syntaxhighlight>


TODO: upgrade pagedjs for wiki-to-print, which is a separate installation of pagedjs.
TODO: upgrade pagedjs for wiki-to-print, which is a separate installation of pagedjs.
[[Category:Sysadmin]]

Latest revision as of 16:57, 22 February 2026

Up until today (February 21st, 2026), the version of pagedjs that Octomode depends on is 0.1.43.

From today, we will upgrade to the latest stable version, 0.4.3.

Octomode depends on two files that should be changed with the upgrade.

  • /opt/octomode/static/paged.polyfill.js (v0.1.43)
  • /opt/octomode/static/pagedjs.css (v0.2.0)

These should be upgraded to

  • /opt/octomode/static/paged.polyfill.js (v0.4.3)
  • /opt/octomode/static/interface.css (v0.4)

The file paged.polyfill.js can be overwritten, but as the CSS has a different filename, we should also update any templates with the old filename that are still being used by Octomode:

  • /opt/octomode/static/templates/pagedjs.html

Method

1. go inside /opt/octomode/static/ and download the files (make backups first)

$ curl https://unpkg.com/pagedjs@0.4.3/dist/paged.polyfill.js > paged.polyfill.js
$ curl https://gitlab.coko.foundation/pagedjs/interface-polyfill/-/raw/master/interface.css?ref_type=heads > interface.css

2. change ownership to the www-data user

$ chown www-data:www-data paged.polyfill.js
$ chown www-data:www-data interface.css

3. go inside /opt/octomode/static/templates and edit the template pagedjs.html

$ sudo nano pagedjs.html

4. Replace the text "pagedjs.css" with "interface.css". Changing it from:

<!DOCTYPE html>
<html lang="{{ lang }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="{{ url_for('static', filename='paged.polyfill.js') }}" type="text/javascript"></script>
    <link href="{{ url_for('static', filename='pagedjs.css') }}" rel="stylesheet" type="text/css" media="screen">
    <!-- [LOCAL HACK] mb: added /octomode/ below to make the stylesheet link work again. -->
    <link href="/octomode/{{ name }}/stylesheet.css" rel="stylesheet" type="text/css" media="print">
    <title>{{ title }}</title>
</head>
<body>
    {{ pad_content }}
</body>
</html>

to

<!DOCTYPE html>
<html lang="{{ lang }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="{{ url_for('static', filename='paged.polyfill.js') }}" type="text/javascript"></script>
    <link href="{{ url_for('static', filename='interface.css') }}" rel="stylesheet" type="text/css" media="screen">
    <!-- [LOCAL HACK] mb: added /octomode/ below to make the stylesheet link work again. -->
    <link href="/octomode/{{ name }}/stylesheet.css" rel="stylesheet" type="text/css" media="print">
    <title>{{ title }}</title>
</head>
<body>
    {{ pad_content }}
</body>
</html>

TODO: upgrade pagedjs for wiki-to-print, which is a separate installation of pagedjs.