-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Roll20 as a Discord Activity #1109
Support Roll20 as a Discord Activity #1109
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a staging build of the new activity to use for testing?
I guess a bit of new documentation to tackle as well, so I can kill two kobolds with one stone this weekend
}, | ||
{ | ||
"matches": [ | ||
"*://1199271093882589195.discordsays.com/*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming discord activity IDs static/reserved (or at least reasonably so):
Are there other proxies that the activity might be served through? eg geolocal/app-specific/mweb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the Discord Activity IDs are static and I'm not aware of any other URLs where the activity will be served from.
@jtbg There is an internal Beta going on right now that I can get you access to, if you let me know your Roll20 account email. You can just email me at riley@roll20.net. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
(done) static code review
-
(done) test build and extension load
- Chromium
- firefox
-
(done) regression test existing the Roll20 Web support
- Chromium
- firefox
-
(pending) test the new integration Roll20 Discord support
product surface testing status:
DDB in Chromium | DDB in Firefox | |
---|---|---|
Discord Win app | out of scope | out of scope |
Discord Mac app | out of scope | out of scope |
Discord web | ||
Discord Linux app | out of scope | out of scope |
(@rileydutton is my understanding correct that the content port would still be out of band from the perspective of the standalone electron apps?)
Have given @jtbg's build a test, does not seem to be sending Rolls to the Discord activity, either to the app or via browser |
Hi @rileydutton! Thanks for sending this PR, I saw the announcement a few days ago on your blog and was excited by the idea. I think the discord activity is a great feature and I can't wait to give it a try. I'll send you an email to get beta access so I can test this out. I've had a quick look at the code, it looks good, I have a couple of suggestions that I want to try (and see if they're viable) before I do a PR review. What we've implemented instead is the ability to prompt the user at runtime for optional permissions as needed, so I think for this instance, it's going to be better to do a user prompt with an optional permission so it doesn't disable the extension, so I want to add that alternative way instead for the discord activity. |
Hey all, Thanks for taking the time to look at this! Appreciated. Really however you all want to handle it re: the permissions is fine, that makes sense. I did notice there is a part of the options dialog that shows up if it detects that permissions don't exist for the current domain, but that was detecting "discord.com" instead of the "1199271093882589195.discordsays.com" (again due to the whole nested iframes issue). But if there's a way to prompt for permissions on the correct domain the first time you launch the Activity (or however you want to do it) that should work fine! Really I just wanted to get this process started and at least attempt to provide some working code, but as you all get in and check it out I'm sure you know better than me what changes need to be made :-) But let me know if I can help. |
Update: Note that would also allow us to have the popup settings work if we can have the discord.com content script act as roll20 basically, when the iframe is there. Will see how we can solve that. I'll take a stab at getting that to work soon (hopefully 🤞) |
if there is something i can help with this let me know |
Thank you very much for volunteering to help. Where I got stuck last time was with the giving of permissions. The idea would be to add the permissions dynamically instead of having it in the manifest file. We can do it by adding:
to the chrome.permissions.contains({origins: [url]}, (hasPermission) => {
if (hasPermission) return;
chrome.permissions.request({origins: [url]}, (response) => {
if (response) {
console.log("Permission was granted");
alertify.success(`Beyond20 will now load automatically on ${url}`);
} else {
console.log("Permission was refused");
alertify.error(`Error requesting permission for ${url}`);
}
});
}); Ideally, also storing in a config if the user rejects it so we don't prompt them every time they open the page, and also allow them to re-permit it from a button in the advanced settings, in case they mistakenly reject it but then later want to authorize it. Humm... I'd probably put an entry in advanced settings for "Support Roll20 Discord Activity" with a checkbox, if the value is undefined, then replace the checkbox with a "Authorize" button, if the user got prompted once before and they approved or rejected, then the setting will store true/false and the setting becomes that... I've pushed my changes here: https://github.com/kakaroto/Beyond20/tree/roll20-discord-activity |
thank you for the update, i will try to merge all the code and get my head around it, i got it to work when you are on web discord but i have not been able to get it to work on the discord application yet. I will have a try and let you know |
Awesome! And yes, it will only work with web discord, I don't think it's doable with the discord app, since that counts as a separate program and beyond20 can only run within the browser (unless there's a way to install extensions into the discord app and have the D&D Beyond pages open inside the discord app too.... so yeah, that won't work!) Let me know when you've pushed a working branch. Thanks! |
By adding the discord activity url to the manifest, it forces new permissions which would disable the extension for everyone, instead, we use dynamic request for optional permissions, and we use webNavigation to be able to inject the roll20 scripts into the iframe inside of discord.com This should fix and close #1166 and #1109 And fixes #1157
Thank you @rileydutton for the contribution. I had to rewrite the permissions system so we could request permissions dynamically and inject beyond20 into the iframe of the discord activity and it's working quite well now. |
That’s great! Glad to help. Looking forward to it.
On September 22, 2024, Justin Bassett-Green ***@***.***> wrote:
Thank you @rileydutton <https://github.com/rileydutton> for the
contribution. I had to rewrite the permissions system so we could
request permissions dynamically and inject beyond20 into the iframe of
the discord activity and it's working quite well now.
I've merged it via the PR #1166
<#1166>, it will be available
in the next release which I plan on releasing tonight.
—
Reply to this email directly, view it on GitHub
<#1109 (comment)-
2367137202>, or unsubscribe
<https://github.com/notifications/unsubscribe-
auth/AADA4WHL25MKZHICPK2DHSDZX55LVAVCNFSM6AAAAABGZD7BN6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRXGEZTOMRQGI>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hey there!
Roll20 is coming to Discord as an Activity. As part of that we are taking a look at popular extensions that Roll20 users install and seeing what needs to be done to support the Activity version. In particular, it doesn't seem possible to use the messaging feature to send messages between tabs since the Activity runs as a nested iFrame in a different domain from the parent tab (this is a Discord security feature and applies to all Activities).
Therefore, I put together this quick PR that adds support for using a content port to communicate with the Discord Activity version. It only uses this method if the extension detects that it's running in an Activity, otherwise it uses the current message passing method.
The one drawback to this is the "filter to a specific tab" feature really isn't supported for the Activity (if you pick a specific tab it just won't work), but I think that's an acceptable tradeoff to get this working.
Let me know if this makes sense or if I can help work on a different approach that would work well for the extension. And thanks for providing this resource to the tabletop gaming community!