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

Telegram webhook #4227

Merged
merged 41 commits into from Apr 19, 2019

Conversation

@techknowlogick
Copy link
Member

commented Jun 11, 2018

As title

techknowlogick added some commits Jun 11, 2018

@codecov-io

This comment has been minimized.

Copy link

commented Jun 11, 2018

Codecov Report

Merging #4227 into master will decrease coverage by 0.25%.
The diff coverage is 1.98%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4227      +/-   ##
==========================================
- Coverage   41.67%   41.42%   -0.26%     
==========================================
  Files         414      415       +1     
  Lines       55985    56337     +352     
==========================================
+ Hits        23331    23335       +4     
- Misses      29524    29873     +349     
+ Partials     3130     3129       -1
Impacted Files Coverage Δ
models/webhook_telegram.go 0% <0%> (ø)
modules/auth/repo_form.go 42.47% <0%> (-0.77%) ⬇️
routers/repo/webhook.go 1.52% <0%> (-0.22%) ⬇️
modules/setting/webhook.go 100% <100%> (ø) ⬆️
routers/routes/routes.go 82.09% <100%> (+0.09%) ⬆️
models/webhook.go 61.07% <15.38%> (-1.32%) ⬇️
models/unit.go 0% <0%> (-14.29%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6dbd261...14712ec. Read the comment docs.

@bkcsoft bkcsoft added the lgtm/need 2 label Jun 11, 2018

@lafriks lafriks added this to the 1.6.0 milestone Jun 12, 2018

@sapk
Copy link
Member

left a comment

Could you add some tests ?

techknowlogick added some commits Jun 25, 2018

@techknowlogick

This comment has been minimized.

Copy link
Member Author

commented Jun 25, 2018

@sapk updated tests

techknowlogick added some commits Jul 9, 2018

@techknowlogick

This comment has been minimized.

Copy link
Member Author

commented Aug 15, 2018

@sapk / @axifive do you have time for a review of this PR? If not that's ok, no rush.

@lunny

This comment has been minimized.

Copy link
Member

commented Aug 15, 2018

When created an issue, the webhook failed:

{"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Unsupported start tag \"!--\" at byte offset 154"}
@techknowlogick

This comment has been minimized.

Copy link
Member Author

commented Aug 15, 2018

thanks for testing @lunny. Can you post the the request that was made to telegram, I wonder if I need to escape anything.

@lunny

This comment has been minimized.

Copy link
Member

commented Aug 15, 2018

headers

Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Length,Content-Type,Date,Server,Connection
Connection: keep-alive
Content-Length: 129
Content-Type: application/json
Date: Wed, 15 Aug 2018 04:09:49 GMT
Server: nginx/1.12.2

body

{
  "text": "[\u003ca href=\"http://localhost:3000/lunny/git\"\u003elunny/git\u003c/a\u003e] Issue opened: \u003ca href=\"http://localhost:3000/api/v1/repos/lunny/git/issues/4\"\u003e#4 new issue\u003c/a\u003e\n\n\u003c!--\r\n    1. Please speak English, this is the language all of us can speak and write.\r\n    2. Please ask questions or configuration/deploy problems on our Discord \r\n       server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io).\r\n    3. Please take a moment to check that your issue doesn't already exist.\r\n    4. Please give all relevant information below for bug reports, because \r\n       incomplete details will be handled as an invalid report.\r\n--\u003e\r\n",
  "parse_mode": "HTML"
}

@techknowlogick techknowlogick modified the milestones: 1.6.0, 1.7.0 Sep 3, 2018

lunny and others added some commits Oct 18, 2018

techknowlogick added some commits Jan 16, 2019

@techknowlogick

This comment has been minimized.

Copy link
Member Author

commented Jan 16, 2019

Looking at docs the only supported HTML tags are: b, strong, i, em, a, code, and pre. All <,> and & symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (&lt;, &gt;, and &amp; which along with &quot; are the only named HTML entities allowed). All numerical HTML entities are supported.

So I'm going to try to instead send HTML to the API, I will try to transform this into markdown, and send it that way.

Show resolved Hide resolved models/webhook_telegram.go Outdated

techknowlogick added some commits Jan 23, 2019

@techknowlogick techknowlogick modified the milestones: 1.8.0, 1.9.0 Feb 7, 2019

techknowlogick added some commits Mar 28, 2019

@techknowlogick

This comment has been minimized.

Copy link
Member Author

commented Apr 15, 2019

@lunny @jonasfranz I'm now passing all messages through the sanitizer, and messages are successfully sending.

@lunny

lunny approved these changes Apr 16, 2019

@GiteaBot GiteaBot added lgtm/done and removed lgtm/need 1 labels Apr 16, 2019

@sapk

sapk approved these changes Apr 16, 2019

techknowlogick added some commits Apr 16, 2019

@techknowlogick techknowlogick requested a review from jonasfranz Apr 16, 2019

@lafriks

This comment has been minimized.

Copy link
Member

commented Apr 17, 2019

@jonasfranz please review

lunny and others added some commits Apr 18, 2019

fixes in place

@techknowlogick techknowlogick merged commit 56da256 into go-gitea:master Apr 19, 2019

2 checks passed

approvals/lgtm this commit looks good
continuous-integration/drone/pr Build is passing
Details

@techknowlogick techknowlogick deleted the techknowlogick:telegram_webhook branch Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.