OpenUserJS / OpenUserJS.org

The home of FOSS user scripts.
https://openuserjs.org/
GNU General Public License v3.0
857 stars 305 forks source link

Webhook doesn't keep script in sync from Organizations. #236

Open vBm opened 10 years ago

vBm commented 10 years ago

I'm using webhook as it's described at https://openuserjs.org/user/add/scripts

I've checked payload that has been delivered and everything seems ok, yet script is not updated.

Version: 2.0.31 uploaded 20h ago

I wonder if maybe cached version is shown on page or hook is somehow delayed.

Martii commented 10 years ago

May apply to #231 with https://github.com/OpenUserJs/OpenUserJS.org/issues/231#issuecomment-47581823 and https://github.com/OpenUserJs/OpenUserJS.org/issues/231#issuecomment-47586697

Unfortunately if it is this I don't have an organization on GH so I can't test this portion out fully but I did just go through some steps on #235 with another user that changed his @name... does anything in there apply/help? I assume that you are on the top level repo here on GH with your web hook e.g. not a fork? What was your status code for the gist you posted?

Refs:

vBm commented 10 years ago

does anything in there apply/help?

I've went thru all the steps and i don't see anything related. Also few days ago I've tried just with adding/removing one semi colon and it also haven't synced after push.

What was your status code for the gist you posted?

2014-07-01_20-35-01 1

Martii commented 10 years ago

Well there might be an issue with #231 then... I'm still the new one to the project here so I'm not going to be able to figure this out just yet. @Zren rewrote the current routine and @sizzlemctwizzle will both be more knowledgeable than I am... I'll mark it as a bug for now... EDIT: An option right now is to manually reimport again until this gets defined and resolved.

Zren commented 10 years ago

An option right now is to manually reimport again until this gets defined and resolved.

Does redelivering the webhook (the button in the github screenshot) 1m after fail work? What about after ~10 minutes? an hour?

vBm commented 10 years ago

Well there might be an issue with #231 then

Yeah, just tested with regular repository (non organization one) and it's working like a charm. As soon as i push the change, script on OUJS is synced. Hopefully organization repos support will be added/fixed soonish.

Edit:

Does redelivering the webhook 1m after fail work? What about after ~10 minutes? an hour?

After redelivering the webhook, sync is not synced even thou status is successful just like it's shown on the screenshot.

To summury:

Sync via webhook is not working for repos that are part of organizations.

Zren commented 10 years ago

I just realized our code does use ghUsername elsewhere. https://github.com/OpenUserJs/OpenUserJS.org/blob/aa845e556015f2014219085cca2bf2ecc9c098de/controllers/scriptStorage.js#L435

So yep, your account won't be sync to the org, which causes it to not notice it.

vBm commented 10 years ago

Good to know that you've found the culprit of the problem :) Thanks for the fix in advance.

PS. Sorry for my bad English :X

thiagobfiorenza commented 8 years ago

I'm having the same problem. How should I proceed?

sizzlemctwizzle commented 8 years ago

It's all about authentication. Without checking the GH username associated with your account against what we receive from the webhook, anyone could push scripts or changes to existing scripts. And since we keep your GH identity private, no one would be the wiser.

I did look into this during the initial implementation, and discovered GH api for orgs. If you were the member of an org, we could let those webhooks work. I didn't pursue this because you'd have to make your membership public (not the default). My own experience with running an org on GH let me know that most people don't go public (the setting is buried). Also there was no way to tell what kind of permissions a member has. You have admin privaleges if you can use the webhook settings on a project. But if @Martii and I went to war today, I'm not sure which one of us would come out with admin privaleges over OUJS. I don't know enough about GH org permissions. I don't if or how they change.

As far as a workaround, I'll get back to you on that.

Martii commented 8 years ago

When the github dependency gets reworked into the source tree it may add some additional clues... it's been going mad with major revisions which is why I haven't touched it.

I have zero way of retesting Organizations, other than blindly (just like the webhook), as I don't have one so the hierarchy of OUJS will always be the Captain @sizzlemctwizzle and his trusty subordinate @Martii . :)

Martii commented 8 years ago

@thiagobfiorenza I should note that GH shows your schema as an individual user (e.g. http://schema.org/Person) not an organization. (e.g. http://schema.org/Organization) When I looked at your account on OUJS it did seem out of sync... so as an individual user to work around your possible sync issue... reimport the script and that should reenable the webhook linkage... provided you followed the instructions on the upload Userscript page for enabling the webhook. Sometimes GH can hiccup and sometimes we might even but at the point you put your comment in I didn't see any OUJS side issues at the time e.g. status quo.