Jump to content




Bug Reporting


  • You cannot reply to this topic
24 replies to this topic

#1 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 31 August 2014 - 03:37 AM

Hey there, Just wondering how to auto send bug reports

I have implemented a log file system which writes to a log file, But in the event of an error I would like the system to send the log file to an email or something similar, I thought maybe pastebin but I wont know what IDs they are, Is there a way of using githubs issue section here through a computer script???

-Thanks - Harry

#2 natedogith1

  • Members
  • 110 posts

Posted 31 August 2014 - 04:18 AM

I'd recommend seeing what you can do with the gmail and/or github apis.

#3 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 31 August 2014 - 04:35 AM

I had a look and I dont know how to implement them into CC could someone write an example script that I could implement into the system? Doesnt need to have working variables, just explaining the concept of how to add them to GitHub, Ive seen this done before, A couple of times including oeed, I saw he had an alternate account that appeared to be auto posting issues in the issue section of GitHub... Maybe ill ask him for assistance if we cant figure it out.

#4 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 31 August 2014 - 04:57 AM

I think what im stuck on is how to use and install the Github API for computercraft... If thats possible, Like I said ive seen this done before, oeeds script seems to use pastebin aswell, But id rather use GitHub as I use it more often

#5 natedogith1

  • Members
  • 110 posts

Posted 31 August 2014 - 05:41 AM

You might not be able to just install one, as it might not exist. But if you can understand their http api (which is what's described on the api page) you can implement it yourself using CC's http api.

#6 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 31 August 2014 - 05:52 AM

View Postnatedogith1, on 31 August 2014 - 05:41 AM, said:

You might not be able to just install one, as it might not exist. But if you can understand their http api (which is what's described on the api page) you can implement it yourself using CC's http api.

My problem is I have zero understanding of whats discussed in the links you gave me, Mainly because im a little stupid :P

#7 natedogith1

  • Members
  • 110 posts

Posted 31 August 2014 - 06:05 PM

So I have an example of what should work, but I haven't actually tested it out yet so...
--local base64Credentials = "" -- TO_BASE_64(USERNAME .. ":" .. PASSWORD)
--local auth = "Basic " .. base64Credentials -- could also be "token " .. OAUTH_TOKEN
-- above probably shouldn't be used, rather insecure
local oauthToken = "" -- your oauth token
local auth = "token " .. oauthToken -- value for Authroization header

local headers={ -- headers sent with every http request to github api
Authorization=auth, -- for authorization
Accept="application/vnd.github.v3+json", -- make sure we get correct version
["User-Agent"]="" -- set to something unique, should probably include username (see https://developer.github.com/v3/#user-agent-required)
}

local owner = "" -- owner of repository
local repo = "" -- repository

local title = "" -- title of issue
title = title:gsub("\\", "\\\\"):gsub("\"", "\\\"") -- make JSON string
local body = "" -- body of issue
body = body:gsub("\\", "\\\\"):gsub("\"", "\\\"") -- make JSON string
local jsonObject=[[
{
"title" : "]] .. title .. [[",
"body" : "]] .. body .. [[",
}]]
http.post("https://api.github.com/repos/" .. owner .. "/" .. repo .. "/issues", jsonObject, headers)
--if headers aren't avaliable try this instead
--http.post("https://api.github.com/repos/" .. owner .. "/" .. repo .. "/issues?access_token=" .. oauthToken, jsonObject)


#8 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 31 August 2014 - 06:14 PM

View Postnatedogith1, on 31 August 2014 - 06:05 PM, said:

So I have an example of what should work, but I haven't actually tested it out yet so...
--#local base64Credentials = "" -- TO_BASE_64(USERNAME .. ":" .. PASSWORD)
--#local auth = "Basic " .. base64Credentials -- could also be "token " .. OAUTH_TOKEN
--#above probably shouldn't be used, rather insecure
local oauthToken = "" --#your oauth token
local auth = "token " .. oauthToken --#value for Authroization header

local headers={ --#headers sent with every http request to github api
Authorization=auth, --#for authorization
Accept="application/vnd.github.v3+json", --#make sure we get correct version
["User-Agent"]="" --#set to something unique, should probably include username (see https://developer.github.com/v3/#user-agent-required)
}

local owner = "" --#owner of repository
local repo = "" --#repository

local title = "" --#title of issue
title = title:gsub("\\", "\\\\"):gsub("\"", "\\\"") --#make JSON string
local body = "" --#body of issue
body = body:gsub("\\", "\\\\"):gsub("\"", "\\\"") --#make JSON string
local jsonObject=[[
{
"title" : "]] .. title .. [[",
"body" : "]] .. body .. [[",
}]]
http.post("https://api.github.com/repos/" .. owner .. "/" .. repo .. "/issues", jsonObject, headers)
--#if headers aren't avaliable try this instead
--#http.post("https://api.github.com/repos/" .. owner .. "/" .. repo .. "/issues?access_token=" .. oauthToken, jsonObject)

Tip: Use --# for comments, since the forum parses # as a comment, and lua interprets -- as a comment. It looks good when posting, and still works fine in game.

#9 natedogith1

  • Members
  • 110 posts

Posted 31 August 2014 - 06:28 PM

View PostKingofGamesYami, on 31 August 2014 - 06:14 PM, said:

-- snip --
Tip: Use --# for comments, since the forum parses # as a comment, and lua interprets -- as a comment. It looks good when posting, and still works fine in game.
Thanks, I was wondering why people were formatting like that.

#10 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 31 August 2014 - 08:43 PM

View Postnatedogith1, on 31 August 2014 - 06:05 PM, said:

So I have an example of what should work, but I haven't actually tested it out yet so...
--local base64Credentials = "" -- TO_BASE_64(USERNAME .. ":" .. PASSWORD)
--local auth = "Basic " .. base64Credentials -- could also be "token " .. OAUTH_TOKEN
-- above probably shouldn't be used, rather insecure
local oauthToken = "" -- your oauth token
local auth = "token " .. oauthToken -- value for Authroization header

local headers={ -- headers sent with every http request to github api
Authorization=auth, -- for authorization
Accept="application/vnd.github.v3+json", -- make sure we get correct version
["User-Agent"]="" -- set to something unique, should probably include username (see https://developer.github.com/v3/#user-agent-required)
}

local owner = "" -- owner of repository
local repo = "" -- repository

local title = "" -- title of issue
title = title:gsub("\\", "\\\\"):gsub("\"", "\\\"") -- make JSON string
local body = "" -- body of issue
body = body:gsub("\\", "\\\\"):gsub("\"", "\\\"") -- make JSON string
local jsonObject=[[
{
"title" : "]] .. title .. [[",
"body" : "]] .. body .. [[",
}]]
http.post("https://api.github.com/repos/" .. owner .. "/" .. repo .. "/issues", jsonObject, headers)
--if headers aren't avaliable try this instead
--http.post("https://api.github.com/repos/" .. owner .. "/" .. repo .. "/issues?access_token=" .. oauthToken, jsonObject)

Sorry, but when you say the above shouldn't be used, what else do I put there, or is it not necessary, as you can see I'm very much new to Internet Apis etc within computer craft, I've only ever done GitHub downloading, I hope I can get your code to work, just for classification, what is the auth and oauth etc...

Like you said, the first part is very insecure, I don't want people knowing my password to GitHub, whether it is a seperate account or not, it would still have push access etc...

#11 natedogith1

  • Members
  • 110 posts

Posted 31 August 2014 - 08:49 PM

View PostHbomb_79, on 31 August 2014 - 08:43 PM, said:

-- snip --

Sorry, but when you say the above shouldn't be used, what else do I put there, or is it not necessary, as you can see I'm very much new to Internet Apis etc within computer craft, I've only ever done GitHub downloading, I hope I can get your code to work, just for classification, what is the auth and oauth etc...

Like you said, the first part is very insecure, I don't want people knowing my password to GitHub, whether it is a seperate account or not, it would still have push access etc...

You'd just leave that part blank, that's why it's commented out. Instead you'd just fill in the oauthToken part with the value of your token. Though according to the github api documentation, you don't actually need push access to make an issue, you only need pull access.

#12 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 31 August 2014 - 10:15 PM

So, what is my authToken, etc... Where do I find this.

If someone knows my auto token can they access my account?

So basically is this secure or insecure like the first section.

#13 natedogith1

  • Members
  • 110 posts

Posted 31 August 2014 - 10:26 PM

if you go to https://github.com/settings/tokens/new you can create a token for yourself, and since you can set the scope you can severely limit what someone with the token can do.

#14 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 31 August 2014 - 10:38 PM

I registered my Security Suite as a program in GitHub, it gave me a client secret and a client ID, I can't show you the ID because I'm on my iPad.

Is the client ID my oAuth token?

EDIT: I replied as you posted, I'm following your instruction now and I deleted what I did...

EDIT 2: None of the scopes seem to mention issue posting, I don't want the token granting access to any of my code... Just the issue section

-Harry

Edited by Hbomb_79, 31 August 2014 - 10:52 PM.


#15 natedogith1

  • Members
  • 110 posts

Posted 31 August 2014 - 11:07 PM

The scope you need is the one that gives read access to a repository, no idea which one that is though.

#16 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 31 August 2014 - 11:28 PM

View Postnatedogith1, on 31 August 2014 - 11:07 PM, said:

The scope you need is the one that gives read access to a repository, no idea which one that is though.

Won't it need write access to create an issue

#17 natedogith1

  • Members
  • 110 posts

Posted 01 September 2014 - 12:25 AM

According to the documentation, it only needs pull access, so I'd go with no. It makes sense when you think about the issues section as bug reports, you'd generally like to be able to have testers that can't just modify the official sources however they wish.

#18 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 01 September 2014 - 12:54 AM

So, is read only or no scope going to work.... This is more complicated than I thought, non of the scopes talk about pull or push so I have no idea which scopes to select

#19 natedogith1

  • Members
  • 110 posts

Posted 01 September 2014 - 02:06 AM

Yeah, scopes tend to confuse me a bit as well. I'd personally probably just check if it works if I let it do everything first, then try to cut back on the scopes.

#20 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 01 September 2014 - 04:15 AM

So with your code, I would set the body to my Log Report... And then the token to the one created by that page and give the token all the default options and slowly remove them to the bare minimum... I still dont want people being able to edit source code, as you said thats pretty bad if you cant have testers that cant edit the code, I dont want people being able to edit it freely.

P.S: You've been so helpful, Thank you so much for your help

Edited by Hbomb_79, 01 September 2014 - 04:23 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users