Giter Site home page Giter Site logo

nicolassiver / nodebb-plugin-ns-embed Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 18.0 1.09 MB

Embed media and rich content in posts: YouTube, Vimeo, Twitch and more.

Home Page: https://community.nodebb.org/topic/7135/nodebb-plugin-ns-embed-ns-embed/33

License: MIT License

JavaScript 83.51% Smarty 0.30% CSS 1.29% SCSS 14.04% Less 0.86%
embedded-media embedding nodebb nodebb-plugin

nodebb-plugin-ns-embed's People

Contributors

barisusakli avatar dependabot[bot] avatar nicolassiver avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nodebb-plugin-ns-embed's Issues

Not load js in embeded code

Hello NicolasSiver,
Thanks for your embed plugin. I installed in my forum and working fine except the case there is javascript in embeded code.
I load js to calculate stream url to play video by videojs.
My Issue:
Not load javascript in embeded code when open page at the first time, but it will be loaded if I refresh web page.
My Replace code:
`

<script> var player = videojs('video'); player.fluid(true); player.responsive(true); var stream = "$1"; var url = stream+"/index.m3u8"; player.src({ src: url, type: 'application/x-mpegURL' }); </script>
`

.....
Thanks for any advice help me to load js with embeded code.
Navixco

invalid regular expression

i failed on writing regular expresiรณn and know it reload nodebb all time

29/11 22:41 [21315] - error: SyntaxError: Invalid regular expression: /?:https?://)?(?:twitter.com)/([^\/"\s])/statuse?s?/([^\/"\s])(/photo/\d|)".*?>.+?</a>/g/: Nothing to repeat
at new RegExp ()
at /home/9node/NodeBB/node_modules/nodebb-plugin-ns-embed/plugin/rules.js:26:34
at Array.map (native)
at /home/9node/NodeBB/node_modules/nodebb-plugin-ns-embed/plugin/rules.js:24:31
at /home/9node/NodeBB/node_modules/async/lib/async.js:52:16
at /home/9node/NodeBB/node_modules/async/lib/async.js:1204:30
at /home/9node/NodeBB/src/database/mongo/hash.js:53:4
at handleCallback (/home/9node/Nod

Support oEmbed

It would be really great to have support for oEmbed, which would allow for embedded tweets and more.

Compatibility issue with NodeBB 1.14.x

Case A: Fresh install of NodeBB 1.14

The search only offers version 2.1.1 and it's broken. There is no way to add the embed services.

Case B: Upgrading from NodeBB 1.13

So I updated an existing 1.13.2 (with the plugin installed and working in version 4.0.0) to 1.14.2 and now I sort of lost the plugin in the upgrade process and if I'm reinstalling it I only get plugin version 2.1.1 with an upgrade button to 4.0.0.
But if I click on that I get this error message:

Your version of NodeBB (v1.14.2) is only cleared to upgrade to v2.1.1 of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.

In the admin panel search I can still search for embed, and it finds the plugin page, but the page is gone if I click on it.

plugin disappeared in Admin Plugin list

Hello,
Plugin worked fine with Nodebb 1.11 but after upgraded to Nodebb 1.12.0 embeded content appeared twice in website. Removed and reinstalled it, it appeared in Installed and Active plugins but can not see it in Plugin list and ready to use.
Thanks for any advice!

not-in-list-to-use
ns-embed Actived

Youtube embeds are tiny

Everything was fine on NodeBB 2.8.7 and then I upgraded to 3.5.0. Plugin works, just videos are tiny. Using the default rules as I have never tweaked anything.

image

links to youtube channels are being embedded

Sample post content

Conclusion: youtube links to channel sub-links with more than 5 characters are invalid.

https://www.youtube.com/@domegaia/about
https://www.youtube.com/@domegaia
https://www.youtube.com/@domegaia/chann
https://www.youtube.com/@domegaia/12345
https://www.youtube.com/@domegaia/123456
https://www.youtube.com/@domegaia/abouts
https://www.youtube.com/@domegaia/channels
https://www.youtube.com/@domegaia/community
https://www.youtube.com/@domegaia/abc123
https://www.youtube.com/@domegaia/shorts

https://www.youtube.com/@domegaia/featured

https://www.youtube.com/@domegaia/videos

The youtube regex matches the links that have more than 5 characters at the end.

image

I changed the regex and added @ like so (?:<a.*?)?(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?!user|channel|@)\S*(?:(?:\/e(?:mbed))?\/|watch\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})(?:.*?\/a>)?

Not sure if it's the best way or if you want to handle it differently. As far as I can see these are not links to videos so they shouldn't turn into embeds.

The following plugins may not be compatible with your version of NodeBB

nodebb 1.19.1
nodebb-plugin-ns-embed 5.0
nodebb log: 2022-01-24T09:42:52.711Z [4567/10407] - warn: [plugins/load] The following plugins may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. In the event of an unresponsive NodeBB caused by this plugin, run ./nodebb reset -p PLUGINNAME to disable it.

  • nodebb-plugin-ns-embed

Add Twitch to default rules (rule inside)

Name: twitch
Display Name: Twitch
Watch: (?:<a.*?)?(?:https?:\/\/)?(?:www\.)?twitch\.tv\/([a-zA-Z0-9_-]{4,11})(?:.*?\/a>)?
Replace: <div class='embed-wrapper'><div class='embed-container'><iframe src="http://player.twitch.tv/?channel=$1" allowfullscreen></iframe></div></div>

Can not install plugin V3.0.19 properly with nodeBB V2.6.1

Is there a way to fix errors after plugin activation and make it work ?
My nodeBB V2.6.1, npm V8.19.2, OS Deb10 - plugin version 3.0.19
Plugin installed in NODEBB, looks like active but doesn't work at all. No ACP menu for to set rules.

Log:
2022-12-09T21:02:24.914Z [5217/6503] - warn: [plugins/nodebb-plugin-embed] The plugin.json field "library" is deprecated. Please use the package.json field "main" instead.
2022-12-09T21:02:24.917Z [5217/6503] - warn: [plugins] Unable to load library for: nodebb-plugin-embed
2022-12-09T21:02:24.918Z [5217/6503] - error: TypeError: winston.Logger is not a constructor
at /root/nodebb/node_modules/nodebb-plugin-embed/plugin/logger.js:9:22
at Object. (/root/nodebb/node_modules/nodebb-plugin-embed/plugin/logger.js:23:3)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (/root/nodebb/node_modules/nodebb-plugin-embed/plugin/controller.js:4:18)
at Module._compile (node:internal/modules/cjs/loader:1159:14)

ACP blank Page

Hello

ACP page is blank on nodeBB 2.5.0

image

here the nodeBB log:

image

Images?

Is there a way to make a rule to take any URL that has jpg png gif etc to automatically show?

Compatibility with 1.12.x?

it's stopped parsing when I upgraded from 1.10.x to 1.12.x. In the package.json the semver range is ~1.11.0

How to get current user id to change something in Replace code

Hi,
I have an question need helping for my problem.
I use this plugin to play video, and I need check that user logged in or not to change something in Repace code. Example guests will be litmited watching time on each video.
I ever resolved it by using script in Replace code to check global variable app.user.uid is empty ot not.
But I get another issue that:

  1. this content of the script will be displayed on History of each post, so everyone can see this script code.
  2. And when someone share post link to social network such as Facebook, the script code will be there.

So I find another solution to check current user status (logged or not) to change Rule in plugin.
Anyone can help me know how to get current user ID in this plugin? Ofcourse, Im still out door of Node.js and NodeBB.
Thanks for any suggestion.
Navix

Cannot Access Plugin Settings

Hi, after installing and activating the plugin I cannot access plugin settings. The embed links are not handled by the plugin. I assume that for the plugin to start work I have to press the "Install Default Rules" in the plugin settings.

Steps taken:

  1. install and activate the plugin via NodeBB admin panel
  2. restart NodeBB via admin panel
  3. check the URLs: no embedded iframes
  4. check the "Plugins" dropdown menu in the admin panel: no correspondent menu button
  5. stop NodeBB via Linux console
  6. install the plugin manually via npm
  7. start NodeBB
  8. the same as points 3 & 4.

NodeBB version: 1.16.0

Expectation:

Expected to see the plugin settings:

NodeBB nodebb-plugin-ns-embed plugin settings

Internally uploaded video embeddind as HTML5 player

Would be nice to have default rules to embed videos uploaded to the posts. Here is example working with MP4:

Regex:

<a href="/uploads/files/(.*).mp4">[^<]*</a>

Replacement:

<video id="$1" src="/uploads/files/$1.mp4" controls style="width:800px"></video>
<div><small><a href="/uploads/files/$1.mp4" target="_blank">Download video</a></small></div>

YouTube channel links are inserted as broken videos

Regex needs to be updated to not apply to /channel/ links
(?:<a.*?)?(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/(?!user|channel)\S*(?:(?:\/e(?:mbed))?\/|watch\?(?:\S*?&?v\=))|youtu\.be\/)([a-zA-Z0-9_-]{6,11})(?:.*?\/a>)?

Can't use controlslist in video tag

I write a rule to play video updated, but I don't want anybody to download it.
So I put controlslist="nodownload" in video tag:

<video src="/assets/uploads/files/$1.mp4" controls controlslist="nodownload" width="800px" height="500px"> </video>

but it didn't work.
And I found the keyword controlslist didn't show up in web page element.

Is there any way to use controlslist or forbid users to download video?

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.