Compare commits

..

3 Commits

Author SHA1 Message Date
mb
c46b3182a7 adding a systemd service conf example 2023-08-22 17:46:22 +02:00
mb
e24a4c2665 adding a LocalSettings example 2023-08-22 17:32:05 +02:00
mb
941c234795 adding a make setup rule 2023-08-21 12:18:12 +02:00
5 changed files with 237 additions and 19 deletions

View File

@ -27,11 +27,8 @@ It saves it as a HTML page, which can be turned into a PDF with Paged.js.
## How to use it? ## How to use it?
1. Change the `wiki` and `pagename` (e.g. `Pdf:Foobar`) variables in `update.py` on line 221 + 222. 1. Change the `wiki` and `pagename` variables in `update.py` on line 221 + 222.
1. Copy paste your CSS into print.css 2. Copy paste your CSS into print.css
1. `python3 -m venv .venv && source .venv/bin/activate` 3. Run `$ python3 update.py`
1. `pip install -r requirements.txt` 4. Run `$ make`
1. Run `import nltk; nltk.download('punkt')` in a `python3` interpreter 5. Open `localhost:8000` in your browser
1. Run `$ python3 update.py`
1. Run `$ make`
1. Open `localhost:8000` in your browser

View File

@ -1,7 +0,0 @@
click==8.1.3
Jinja2==3.1.2
joblib==1.2.0
MarkupSafe==2.1.2
nltk==3.8.1
regex==2023.3.23
tqdm==4.65.0

View File

@ -0,0 +1,211 @@
<?php
# This file was automatically generated by the MediaWiki 1.38.4
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See docs/Configuration.md for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# https://www.mediawiki.org/wiki/Manual:Configuration_settings
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgSitename = "creative crowd wiki";
$wgMetaNamespace = "CC";
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## https://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/wiki";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
## The protocol and server name to use in fully-qualified URLs
$wgServer = "http://cc.vvvvvvaria.org";
## The URL path to static resources (images, scripts, etc.)
$wgResourceBasePath = $wgScriptPath;
## The URL paths to the logo. Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
$wgLogos = [
'1x' => "/creative-crowds.svg"
];
## UPO means: this is also a user preference option
$wgEnableEmail = false;
$wgEnableUserEmail = true; # UPO
$wgEmergencyContact = "apache@🌻.invalid";
$wgPasswordSender = "apache@🌻.invalid";
$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;
## Database settings
$wgDBtype = "mysql";
$wgDBserver = "localhost";
$wgDBname = "wikidb";
$wgDBuser = "wiki";
$wgDBpassword = "XXX";
# MySQL specific settings
$wgDBprefix = "";
# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
# Shared database table
# This has no effect unless $wgSharedDB is also set.
$wgSharedTables[] = "actor";
## Shared memory settings
$wgMainCacheType = CACHE_NONE;
$wgMemCachedServers = [];
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'doc',
'xls', 'mpp', 'pdf', 'ppt', 'tiff', 'bmp', 'docx', 'xlsx',
'pptx', 'ps', 'odt', 'ods', 'odp', 'odg', 'svg'
);
$wgUploadSizeWarning = 5242880;
$wgMaxUploadSize = 5242880;
# InstantCommons allows wiki to use images from https://commons.wikimedia.org
$wgUseInstantCommons = false;
# Periodically send a pingback to https://www.mediawiki.org/ with basic data
# about this MediaWiki instance. The Wikimedia Foundation shares this data
# with MediaWiki developers to help guide future development efforts.
$wgPingback = true;
# Site language code, should be one of the list in ./languages/data/Names.php
$wgLanguageCode = "en";
# Time zone
$wgLocaltimezone = "UTC";
## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publicly accessible from the web.
#$wgCacheDirectory = "$IP/cache";
$wgSecretKey = "XXX";
# Changing this will log out all existing sessions.
$wgAuthenticationTokenVersion = "1";
# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = "XXX";
## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "https://www.gnu.org/copyleft/fdl.html";
$wgRightsText = "GNU Free Documentation License 1.3 or later";
$wgRightsIcon = "$wgResourceBasePath/resources/assets/licenses/gnu-fdl.png";
# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3";
# The following permissions were set based on your choice in the installer
$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['edit'] = false;
# We need to give the group users write permission to the API for the visual editor to work
$wgGroupPermissions['user']['writeapi'] = true;
# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtension( 'ExtensionName' );
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
# wfLoadExtension( 'CodeEditor' );
wfLoadExtension( 'VisualEditor' );
wfLoadExtension( 'WikiEditor' );
wfLoadExtension( 'CategoryTree' );
wfLoadExtension( 'Cite' );
# Using ConfirmEdit for captcha at account creation
wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/QuestyCaptcha' ]);
$wgCaptchaQuestions = [
'In which city is the Varia server hosted? (only lowercase)' => 'rotterdam'
];
$wgMainCacheType = CACHE_ANYTHING;
$wgCaptchaTriggers['edit'] = false;
$wgCaptchaTriggers['create'] = false;
$wgCaptchaTriggers['createtalk'] = false;
$wgCaptchaTriggers['addurl'] = false;
$wgCaptchaTriggers['createaccount'] = true;
$wgCaptchaTriggers['badlogin'] = false;
# Using CreatePage
wfLoadExtension( 'CreatePage' );
$wgCreatePageEditExisting = true;
#$wgCreatePageUseVisualEditor = true;
# Embed etherpads
wfLoadExtension( 'EtherpadLite' );
$wgEtherpadLiteDefaultPadUrl = "https://cc.vvvvvvaria.org/pad/p/";
$wgEtherpadLiteUrlWhitelist = array($wgEtherpadLiteDefaultPadUrl);
##$wgEtherpadLiteDefaultWidth = "calc(100% - 4px)";
##$wgEtherpadLiteDefaultHeight = "500px";
$wgEtherpadLiteDefaultWidth = "400px";
$wgEtherpadLiteDefaultHeight = "700px";
# Custom publishing namespace
define("NS_Pdf", 3000);
define("NS_PdfCSS", 3001);
$wgExtraNamespaces[NS_Pdf] = "Pdf";
$wgExtraNamespaces[NS_PdfCSS] = "PdfCSS";
$wgNamespacesWithSubpages[NS_Pdf] = true;
$wgNamespacesWithSubpages[NS_PdfCSS] = true;
# We change the content model of the CSS namespace from the default WIKITEXT.
# The forces the CodeEditor to replace the VisualEditor for better legibility.
$wgNamespaceContentModels[NS_PdfCSS] = CONTENT_MODEL_CSS;
# We need to force the VisualEditor to exist in our Pdf namespace.
$wgVisualEditorAvailableNamespaces = [
'Toward_a_Minor_Tech' => true
];
## Default skin: you can change the default skin. Use the internal symbolic
## names, e.g. 'vector' or 'monobook':
$wgDefaultSkin = 'vector';
# Enabled skins.
# The following skins were automatically enabled:
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );
wfLoadSkin( 'Citizen' );
# Custom settings
$wgAllowImageTag = true;
$wgAllowExternalImages = true;
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
# Running jobs instantly (not making a queue)
$wgJobRunRate = 1;

View File

@ -0,0 +1,12 @@
[Unit]
Description=wiki-to-print
After=network.target
[Service]
User=www-data
WorkingDirectory=/var/www/wiki-to-print/wiki-to-print/
ExecStart=/usr/bin/make server
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -1,9 +1,14 @@
all: local all: local
setup:
@echo "Running: python3 -m venv .venv"
@python3 -m venv .venv
@echo "Running: .venv/bin/pip3 install -r requirements.txt\n"
@.venv/bin/pip3 install -r requirements.txt
@echo "\nDone!\nNow you can configure wiki-to-print by editing: config.json"
local: local:
./venv/bin/python3 web-interface.py .venv/bin/python3 web-interface.py
server: server:
@SCRIPT_NAME=/wiki-to-print venv/bin/gunicorn -b localhost:5522 --reload web-interface:APP @SCRIPT_NAME=/wiki-to-print .venv/bin/gunicorn -b localhost:5522 --reload web-interface:APP