Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ jobs:
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
BUILD_DIR: release/${{ inputs.version }}
ASSETS_DIR: .wporg
ASSETS_DIR: .wporg/assets
VERSION: ${{ inputs.version }}
34 changes: 34 additions & 0 deletions .wporg/assets/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"landingPage": "/chatrix-regular-mode/",
"preferredVersions": {
"php": "8.0",
"wp": "latest"
},
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "setSiteOptions",
"options": {
"permalink_structure": "/%year%/%monthnum%/%day%/%postname%/"
}
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "chatrix"
}
},
{
"step": "runPHP",
"code": "<?php\n\nrequire_once 'wordpress/wp-load.php';\n\n$chatrix_block_simple = '<!-- wp:paragraph --> <p>Below you can see \"Chatrix\" block in action. You can add it anywhere using either <code>/chatrix</code> or by looking up chatrix when choosing which block to insert.</p> <!-- /wp:paragraph --> <!-- wp:automattic/chatrix {\"enableServiceWorker\":false,\"instanceId\":\"2530674218113325\",\"defaultHomeserver\":\"matrix.org\"} /--> <!-- wp:paragraph --> <p>Chatrix can also run in <a href=\"/chatrix-single-room-mode/\">single room mode</a>.</p> <!-- /wp:paragraph -->';\n\n$chatrix_block_2col = <<<CHATRIXBLOCK2COLUMNS\n<!-- wp:paragraph -->\n<p>Below you can see “Chatrix” block in action. You can add it anywhere using either&nbsp;<code>/chatrix</code>&nbsp;or by looking up chatrix when choosing which block to insert.</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:columns -->\n<div class=\"wp-block-columns\">\n<!-- wp:column {\"width\":\"33.33%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:33.33%\">\n<!-- wp:paragraph -->\n<p><a href=\"/wp-admin/post.php?post=3&action=edit\">Edit this page</a> to specify what room should Chatrix run in as, single-room mode. By default, it loads up:</p>\n<!-- /wp:paragraph -->\n<!-- wp:preformatted -->\n<pre class=\"wp-block-preformatted\">#matrix:matrix.org</pre>\n<!-- /wp:preformatted -->\n<!-- wp:paragraph -->\n<p>You would need to select Chatrix block to reveal its settings on the right side panel.</p>\n<!-- /wp:paragraph -->\n</div>\n<!-- /wp:column -->\n<!-- wp:column {\"width\":\"66.66%\"} -->\n<div class=\"wp-block-column\" style=\"flex-basis:66.66%\">\n<!-- wp:automattic/chatrix {\"enableServiceWorker\":false,\"instanceId\":\"4986644425212020\",\"roomId\":\"#matrix:matrix.org\",\"defaultHomeserver\":\"matrix.org\"} /-->\n</div>\n<!-- /wp:column -->\n</div>\n<!-- /wp:columns -->\nCHATRIXBLOCK2COLUMNS;\n\n$sample_page_post_id = 2;\n\nwp_update_post( array(\n 'ID' => $sample_page_post_id,\n 'post_title' => 'Chatrix [Regular]',\n 'post_name' => 'chatrix-regular-mode',\n 'post_content' => $chatrix_block_simple\n) );\n\nwp_insert_post( array(\n 'ID' => 3,\n 'post_title' => 'Chatrix [Single Room Mode]',\n 'post_name' => 'chatrix-single-room-mode',\n 'post_type' => 'page',\n 'post_status' => 'publish',\n 'post_content' => $chatrix_block_2col\n) );\n\nwp_insert_post( array(\n 'ID' => 4,\n 'post_title' => 'Chatrix [Popup]',\n 'post_name' => 'chatrix-in-popup-mode',\n 'post_type' => 'page',\n 'post_status' => 'publish',\n 'post_content' => '<!-- wp:paragraph --> <p>On this page, you can see the popup widget at the bottom right of your screen. Click on it to show Chatrix.</p> <!-- /wp:paragraph -->'\n) );\n\nupdate_option( 'chatrix_settings', array(\n 'homeserver' => 'matrix.org',\n 'room' => '#matrix:matrix.org',\n 'show_on' => 'specific',\n 'pages' => array(\n 0 => '4'\n )\n) );",
"progress": {
"caption": "Setting Chatrix instances"
}
}
]
}
3 changes: 3 additions & 0 deletions .wporg/assets/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Run `update_blueprint.sh` after making changes in `blueprint_runphp_step_code.php` so that `.wporg/assets/blueprints/blueprint.json` is updated.

[See blueprint in action on playground](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/automattic/chatrix/main/.wporg/assets/blueprints/blueprint.json)
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
70 changes: 70 additions & 0 deletions .wporg/blueprint_runphp_step_code.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

require_once 'wordpress/wp-load.php';

$chatrix_block_simple = '<!-- wp:paragraph --> <p>Below you can see "Chatrix" block in action. You can add it anywhere using either <code>/chatrix</code> or by looking up chatrix when choosing which block to insert.</p> <!-- /wp:paragraph --> <!-- wp:automattic/chatrix {"enableServiceWorker":false,"instanceId":"2530674218113325","defaultHomeserver":"matrix.org"} /--> <!-- wp:paragraph --> <p>Chatrix can also run in <a href="/chatrix-single-room-mode/">single room mode</a>.</p> <!-- /wp:paragraph -->';

$chatrix_block_2col = <<<CHATRIXBLOCK2COLUMNS
<!-- wp:paragraph -->
<p>Below you can see “Chatrix” block in action. You can add it anywhere using either&nbsp;<code>/chatrix</code>&nbsp;or by looking up chatrix when choosing which block to insert.</p>
<!-- /wp:paragraph -->

<!-- wp:columns -->
<div class="wp-block-columns">
<!-- wp:column {"width":"33.33%"} -->
<div class="wp-block-column" style="flex-basis:33.33%">
<!-- wp:paragraph -->
<p><a href="/wp-admin/post.php?post=3&action=edit">Edit this page</a> to specify what room should Chatrix run in as, single-room mode. By default, it loads up:</p>
<!-- /wp:paragraph -->
<!-- wp:preformatted -->
<pre class="wp-block-preformatted">#matrix:matrix.org</pre>
<!-- /wp:preformatted -->
<!-- wp:paragraph -->
<p>You would need to select Chatrix block to reveal its settings on the right side panel.</p>
<!-- /wp:paragraph -->
</div>
<!-- /wp:column -->
<!-- wp:column {"width":"66.66%"} -->
<div class="wp-block-column" style="flex-basis:66.66%">
<!-- wp:automattic/chatrix {"enableServiceWorker":false,"instanceId":"4986644425212020","roomId":"#matrix:matrix.org","defaultHomeserver":"matrix.org"} /-->
</div>
<!-- /wp:column -->
</div>
<!-- /wp:columns -->
CHATRIXBLOCK2COLUMNS;

$sample_page_post_id = 2;

wp_update_post( array(
'ID' => $sample_page_post_id,
'post_title' => 'Chatrix [Regular]',
'post_name' => 'chatrix-regular-mode',
'post_content' => $chatrix_block_simple
) );

wp_insert_post( array(
'ID' => 3,
'post_title' => 'Chatrix [Single Room Mode]',
'post_name' => 'chatrix-single-room-mode',
'post_type' => 'page',
'post_status' => 'publish',
'post_content' => $chatrix_block_2col
) );

wp_insert_post( array(
'ID' => 4,
'post_title' => 'Chatrix [Popup]',
'post_name' => 'chatrix-in-popup-mode',
'post_type' => 'page',
'post_status' => 'publish',
'post_content' => '<!-- wp:paragraph --> <p>On this page, you can see the popup widget at the bottom right of your screen. Click on it to show Chatrix.</p> <!-- /wp:paragraph -->'
) );

update_option( 'chatrix_settings', array(
'homeserver' => 'matrix.org',
'room' => '#matrix:matrix.org',
'show_on' => 'specific',
'pages' => array(
0 => '4'
)
) );
16 changes: 16 additions & 0 deletions .wporg/update_blueprint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

if ! command -v jq &> /dev/null ; then
echo "jq is not installed. Please install jq (https://jqlang.github.io/jq/) before running this script."
fi

# Get the directory of the script
script_dir="$(dirname "$(readlink -f "$0")")"

blueprint_location="$script_dir/assets/blueprints/blueprint.json"
phpsrc_location="$script_dir/blueprint_runphp_step_code.php"

jq --arg newCode "$(cat $phpsrc_location)" '.steps[] |= if .step == "runPHP" then .code = $newCode else . end' $blueprint_location > updated_blueprint.json

rm $blueprint_location
mv updated_blueprint.json $blueprint_location
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ Easily add a [Matrix](https://matrix.org) client to WordPress pages, either thro
If you have any feedback or questions about Chatrix, please do talk to plugin maintainers at [#chatrix:matrix.org](https://matrix.to/#/#chatrix:matrix.org).

## Screenshots
![Block - Login](.wporg/screenshot-1.png)
![Block - Room List](.wporg/screenshot-2.png)
![Block - Timeline](.wporg/screenshot-3.png)
![Popup - Settings](.wporg/screenshot-4.png)
![Popup - Timeline](.wporg/screenshot-5.png)
![Block - Login](.wporg/assets/screenshot-1.png)
![Block - Room List](.wporg/assets/screenshot-2.png)
![Block - Timeline](.wporg/assets/screenshot-3.png)
![Popup - Settings](.wporg/assets/screenshot-4.png)
![Popup - Timeline](.wporg/assets/screenshot-5.png)

## Frequently Asked Questions
### How can I install this plugin on my site?
Expand Down