Skip to content
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

[FacebookBridge] Handle mobile links and standardise host validation #1789

Merged
merged 3 commits into from
Oct 15, 2020

Conversation

SpangleLabs
Copy link
Contributor

@SpangleLabs SpangleLabs commented Oct 10, 2020

A simple little change to standardise host validation between user and group links, and allow mobile links, which should close #1782 and avoid issues like that again in the future.

I'm not sure whether this is enough to justify a hacktoberfest-accepted label, but I would be quite happy if it did. I've had my eye on some things here for hacktoberfest this year, but more than I expected are blocked by #1170

@em92
Copy link
Contributor

em92 commented Oct 12, 2020

Hi, @joshcoales !

I'm not sure whether this is enough to justify a hacktoberfest-accepted label, but I would be quite happy if it did.

I will add this label after accepting PR.

Copy link
Contributor

@em92 em92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea about unifying checks.

Instead of using if statement for checking validity of host, I suggest validateHost to raise client error (returnClientError) instead of returning true/false. Also you would not need to duplicate error message.

@em92
Copy link
Contributor

em92 commented Oct 12, 2020

Also make sure that

phpcs bridges/FacebookBridge.php --standard=phpcs.xml --warning-severity=0 --extensions=php -p

does not return errors.

@SpangleLabs
Copy link
Contributor Author

SpangleLabs commented Oct 12, 2020

Instead of using if statement for checking validity of host, I suggest validateHost to raise client error (returnClientError) instead of returning true/false. Also you would not need to duplicate error message.

Sounds good, I've pushed that now!

phpcs bridges/FacebookBridge.php --standard=phpcs.xml --warning-severity=0 --extensions=php -p

Ah, whoops, had spaces instead of tabs.
Also my IDE does raise a few warnings, so I was wondering about whether to clean up the whole thing, or just to keep the scope of the PR narrow. I can clean up other stuff in there if you want

@SpangleLabs
Copy link
Contributor Author

SpangleLabs commented Oct 12, 2020

Here's a commit with the whole FacebookBridge class neatened up, which shushes all the phpcs warnings. Shall I put that on this branch too?
I'm a little rusty on PHP, so some of it might not be ideal

Also, would it be helpful if I made another PR, adding type hints and neatening stuff up more generally?

EDIT: Helps if I actually link it:
SpangleLabs@9900f52

@em92
Copy link
Contributor

em92 commented Oct 15, 2020

@joshcoales, please rebase your PR in order for Travis CI to check your commit.

Also, would it be helpful if I made another PR, adding type hints and neatening stuff up more generally?

Checked that commit. In general, all changes must be discussed individually, if not covered by linting. It can take a lot of time. So I suggest not to discuss it at all.

@SpangleLabs
Copy link
Contributor Author

Checked that commit. In general, all changes must be discussed individually, if not covered by linting. It can take a lot of time. So I suggest not to discuss it at all.

That makes sense to me. Any other changes needed on this PR?

@em92
Copy link
Contributor

em92 commented Oct 15, 2020

Any other changes needed on this PR?

As I mentioned above - rebase your PR

@SpangleLabs SpangleLabs force-pushed the facebook-mobile-links branch from 8dd7ec7 to 84bfdb9 Compare October 15, 2020 08:37
@SpangleLabs
Copy link
Contributor Author

SpangleLabs commented Oct 15, 2020

As I mentioned above - rebase your PR

Sorry about that, I missed that somehow.

I have rebased this branch now.

EDIT: Looks like Travis has jammed though? Spawned two builds, but both link to the same place, which has passed.

@em92 em92 merged commit 45e2f38 into RSS-Bridge:master Oct 15, 2020
@em92
Copy link
Contributor

em92 commented Oct 15, 2020

Thanks for contribution. You can check other facebook issues to fix. At the moment, facebook groups don't seem to be working.

@SpangleLabs
Copy link
Contributor Author

Sounds like a plan! I've got a few other things here I've got an eye on too. (A few fixes I would like to make, but also some PRs, like #1758 )

How would you feel about automated external integration tests?
Like, would it be helpful if I wrote up a test that can be ran daily or weekly, to ensure the bridge still works?

@em92
Copy link
Contributor

em92 commented Oct 15, 2020

Like, would it be helpful if I wrote up a test that can be ran daily or weekly, to ensure the bridge still works?

If some bridge does stops working, its user will open issue here. So, there is no need for those integration tests

@SpangleLabs
Copy link
Contributor Author

At the moment, facebook groups don't seem to be working.
Looks like facebook has gone fully javascript on that, and the page only returns the first post until javascript requests start being made.
However, it looks like touch.facebook.com can be used, like FB2Bridge uses.

It seems like switching to that mechanism would be the best way to make things work. Would that deprecate FB2Bridge?

@em92
Copy link
Contributor

em92 commented Oct 19, 2020

Actually I don't know why FB2 bridge exists as separate bridge for Facebook.

@teromene, hi! Do you have and idea why it was made like this?

@teromene
Copy link
Member

The existence of FB2 is purely done because of historical reasons:
When the first Facebook bridge was released, it had an excellent HTML parsing.
Rapidly, we had the captcha problem, but only on few users.
We found that using another Facebook website worked for these users, but parsing was way harder, and the result worse.
We therefore decided to create two distinct bridges to cater to everyone's need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Facebook Bridge | Main Site failed with error 400
3 participants