Coder Social home page Coder Social logo

moussetc / mattermost-plugin-spoiler Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 2.0 3.82 MB

A Mattermost plugin to add a command for spoiler messages

License: Apache License 2.0

Makefile 12.32% Go 73.41% JavaScript 8.13% TypeScript 6.13%
go mattermost-plugin react-redux

mattermost-plugin-spoiler's Introduction

Mattermost SPOILER Plugin Build CI

Maintainer: @moussetc

This plugin creates a slash command to display spoiler messages in a non-spoiling way.

Usage

Type /spoiler followed by your spoiler, then post your message. (The spoiler can be on more than one line, it can contain emojis, URLs, images, etc. All will be hidden.)

Two display modes are available for spoiler messages:

  • Spoiler button mode:
    Spoiler button demo

  • Redacted mode:
    Redacted spoiler demo
    This mode is not available on native apps like Android. Native apps do not yet support plugin customization, so for now they will use the Spoiler button mode.

Compatibility

Use the following table to find the correct plugin version for each Mattermost server version:

Mattermost server Plugin release Incompatibility
5.39.0 and higher v3.1.x security fixes (upgrading dependencies)
5.14 to 5.25 v3.x.x relative integration URLs
5.3 to 5.13 v2.x.x
below not supported plugins can't create slash commands

Installation and configuration

  1. Download the release package and download the .tar.gz package. Supported platforms are: Linux x64, Windows x64, Darwin x64, FreeBSD x64.
  2. Use the Mattermost System Console > Plugins > Management page to upload the .tar.gz package
  3. Activate the plugin in the System Console > Plugins > Management page
  4. Choose the display mode: go to the System Console > Plugins > Spoiler Command, select the mode and save the plugin's settings.
    Plugin settings

Configuration Notes in HA

If you are running Mattermost v5.11 or earlier in High Availability mode, please review the following:

  1. To install the plugin, use these documented steps
  2. Then, modify the config.json using the standard doc steps to the following
 "PluginSettings": {
        // [...]
        "PluginStates": {
            // [...]
            "com.github.moussetc.mattermost.plugin.spoiler": {
                "Enable": true,
		        "SpoilerMode": "button"
            },
        }
    }

Development

To avoid having to manually install your plugin, build and deploy your plugin using one of the following options.

Deploying with Local Mode

If your Mattermost server is running locally, you can enable local mode to streamline deploying your plugin. Edit your server configuration as follows:

{
    "ServiceSettings": {
        ...
        "EnableLocalMode": true,
        "LocalModeSocketLocation": "/var/tmp/mattermost_local.socket"
    }
}

and then deploy your plugin:

make deploy

You may also customize the Unix socket path:

export MM_LOCALSOCKETPATH=/var/tmp/alternate_local.socket
make deploy

If developing a plugin with a webapp, watch for changes and deploy those automatically:

export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
make watch

Deploying with credentials

Alternatively, you can authenticate with the server's API with credentials:

export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_USERNAME=admin
export MM_ADMIN_PASSWORD=password
make deploy

or with a personal access token:

export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
make deploy

How do I share feedback on this plugin?

Feel free to create a GitHub issue or to contact me at @cmousset on the community Mattermost instance to discuss.

mattermost-plugin-spoiler's People

Contributors

clarfonthey avatar dependabot[bot] avatar lieut-data avatar moussetc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fossabot thetagml

mattermost-plugin-spoiler's Issues

Vesion 3.1 listed in the master readme is not available

Describe the bug
The version 3.1 that should include security fixes is not available under the releases

To Reproduce
Steps to reproduce the behavior:

  1. Check releases page

Expected behavior
Expected to see release 3.1 to download

Mattermost information

  • server version: 5.39.2
  • client version: Desktop 4.71
  • plugin version: v 3.0.0

CORS problem

I'm having an issue that I haven't been able to figure out when I enable this plugin. I'm not sure if something is breaking entirely, but in Firefox I'm seeing this error for the plugin:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://plugins/com.github.moussetc.mattermost.plugin.spoiler/config. (Reason: CORS request did not succeed).

Now obviously it shouldn't be pointing to "https://plugins" but rather "https://domain.com/plugins" but I can't find anywhere to change this behavior. Any advice?

[ANNOUNCEMENT] Please vote for Mattermost to implement spoilers officially

With a plugin, it's not possible to have a full implementation of spoiler support, for example we technically can't spoiler image attachments, and we can't have the Redacted spoiler look on the Mattermost mobile apps...

So if you wan't to write spoiler in Mattermost, you can take 2 minutes to register to the Mattermost Uservoice and simply cast votes in favour of the request to have Mattermost implement spoiler support officially :)

Same behavior for Desktop App and Mobile?

Hi

Cool plugin 👍

Would it not be more consistent when the Desktop App and Mobile App experience would be the same? I like the way of the Mobile App behavior.

Best regards

JtheBAB

400 bad request when clicking on "Show spoiler"

Hey moussetc!

We're having a bug when we've installed the latest build.

When clicking the spoiler button an HTTP POST is made:

https://mattermost.<our website>/api/v4/posts/<post_id>/actions/<action_id>

The response is a 400 Bad Request:

{"id":"api.post.do_action.action_integration.app_error","message":"Action integration error","detailed_error":"","request_id":"<request id>","status_code":400}

Do we maybe not have specific features enabled for the api? Or our installation was incorrect?

Spoiler Description

Just a low-priority request, but I'd love to see the ability to have a way of also including a description of what a spoiler is. I've used a similar plugin back when we used Slack and it let you do something like:
/spoiler "context" "spoiler text"
so people knew what they were risking by opening the spoiler up. Currently the only thing people can do is to make sure to describe it in a separate message. It's minor but it's a nice touch I think.

Spoilers are inaccessible to screen reader users

I am a blind user using a screen reader. When the spoiler slash command is used, I can find no way of unspoiling the message. I can only read underscore characters, and simulating clicking on the message does nothing. My screen reader reports the spoilt message to be an attachment, which I believe is incorrect. It would be great if this could be addressed. Perhaps an option could be added to the usual message menu that would allow the message to be unspoiled?
I would be very pleased to discuss further.

Can’t you use <details> tag?

The <details> tag is designed for the spoiler use case. It would be very simple to use, don’t you think.

Beside that, #15 would be very simple to solve by using <details>.

Example:

See? No spoiler (The text is even translated by the browser!)

<details>
    <p>See? No spoiler (The text is even translated by the browser!)</p>
</details>
Custom text. Click on it!

No spoiler

<details>
  <summary>Custom text. Click on it!</summary>
  <p>No spoiler</p>
</details>

Screen blanks when enabling redacted mode

When I enable Redacted mode, the screen blanks out (looks like the loading screen but with out the three dots). I'm on Mattermost 5.10, Ubuntu 18.04, Nginx and MariaDB, if it's relevant.

Doesn't work in threads

Hi,

Thanks for this plugin, it's great!
There's just one problem we're encountering: It doesn't seem to work in threads. When using the reply feature, it makes a new message out of the thread.

Do you know how we could make it work?
(I'm willing to help if you know how to do it but don't have time.)

Thanks in advance!

Fails on chrome-- Array.join is not a function

Going to fix this and submit a PR.

Essentially, whenever you have a spoiler button in a chat, the entire app crashes in Chrome. Presumably this also affects the desktop app, which uses Electron (and hence Chromium).

Unable to Start Plugin on MM version 6.3

Server Logs.
{"timestamp":"2022-02-04 10:18:29.797 -05:00","level":"error","msg":"Unable to activate plugin","caller":"app/plugin.go:142","plugin_id":"com.github.moussetc.mattermost.plugin.spoiler","error":"unable to start plugin: com.github.moussetc.mattermost.plugin.spoiler: Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol."}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.