{"action":"created","issue":{"url":"https://api.github.com/repos/dragonjet/KC3Kai/issues/690","labels_url":"https://api.github.com/repos/dragonjet/KC3Kai/issues/690/labels{/name}","comments_url":"https://api.github.com/repos/dragonjet/KC3Kai/issues/690/comments","events_url":"https://api.github.com/repos/dragonjet/KC3Kai/issues/690/events","html_url":"https://github.com/dragonjet/KC3Kai/issues/690","id":102052264,"number":690,"title":"[Feature request] kancolle-db.net integration","user":{"login":"chronomeister","id":13879793,"avatar_url":"https://avatars.githubusercontent.com/u/13879793?v=3","gravatar_id":"","url":"https://api.github.com/users/chronomeister","html_url":"https://github.com/chronomeister","followers_url":"https://api.github.com/users/chronomeister/followers","following_url":"https://api.github.com/users/chronomeister/following{/other_user}","gists_url":"https://api.github.com/users/chronomeister/gists{/gist_id}","starred_url":"https://api.github.com/users/chronomeister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chronomeister/subscriptions","organizations_url":"https://api.github.com/users/chronomeister/orgs","repos_url":"https://api.github.com/users/chronomeister/repos","events_url":"https://api.github.com/users/chronomeister/events{/privacy}","received_events_url":"https://api.github.com/users/chronomeister/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dragonjet/KC3Kai/labels/feature","name":"feature","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2015-08-20T03:25:20Z","updated_at":"2015-08-25T03:05:19Z","closed_at":null,"body":"So I'm noticing more people being interested in kcdb. The people there wrote their own app for KCV and others to proxy chain through and deliver the info to kcdb. The main part of their module can be found here: https://github.com/about518/kanColleDbPost/blob/master/KanColleDbPost/Form1.cs\r\n\r\nBut the code in particular is this:\r\n```\r\n// oSession is, as you can guess, the original request/response from the kc servers.\r\nstring token = textBox2.Text; // token given by kcdb\r\nstring agent = \"\"; //currently unused\r\nstring url = oSession.fullUrl;\r\nstring requestBody = HttpUtility.HtmlDecode(oSession.GetRequestBodyAsString());\r\nrequestBody = Regex.Replace(requestBody, @\"&api(_|%5F)token=[0-9a-f]+|api(_|%5F)token=[0-9a-f]+&?\", \"\");\r\nstring responseBody = oSession.GetResponseBodyAsString();\r\nresponseBody.Replace(\"svdata=\", \"\");\r\n\r\ntry\r\n{\r\n   WebRequest req = WebRequest.Create(\"http://api.kancolle-db.net/2/\");\r\n   req.Method = \"POST\";\r\n   req.ContentType = \"application/x-www-form-urlencoded\";\r\n\r\n   System.Text.Encoding enc = System.Text.Encoding.GetEncoding(\"utf-8\");\r\n   string postdata =\r\n        \"token=\" + HttpUtility.UrlEncode(token) + \"&\"\r\n      + \"agent=\" + HttpUtility.UrlEncode(agent) + \"&\"\r\n      + \"url=\" + HttpUtility.UrlEncode(url) + \"&\"\r\n      + \"requestbody=\" + HttpUtility.UrlEncode(requestBody) + \"&\"\r\n      + \"responsebody=\" + HttpUtility.UrlEncode(responseBody);\r\n   // next part is just how you do web requests in C#\r\n   byte[] postDataBytes = System.Text.Encoding.ASCII.GetBytes(postdata);\r\n   req.ContentLength = postDataBytes.Length;\r\n\r\n   Stream reqStream = req.GetRequestStream();\r\n   reqStream.Write(postDataBytes, 0, postDataBytes.Length);\r\n   reqStream.Close();\r\n}\r\n```\r\n\r\nShould be pretty easy to follow. token is kcdb's token provided when you sign in through twitter. Gets rid of any personally ident api info. Gets rid of the svdata header. Then sends the whole json to them for them to process. Otherwise just change from C# to javascript.\r\n\r\nDoesn't require much in the way of presentation; On setting page just make a label (with a link to either website or explanation), a checkbox to confirm/deny sending data and then a textbox to put your token/key. Everything else is backend."},"comment":{"url":"https://api.github.com/repos/dragonjet/KC3Kai/issues/comments/134460908","html_url":"https://github.com/dragonjet/KC3Kai/issues/690#issuecomment-134460908","issue_url":"https://api.github.com/repos/dragonjet/KC3Kai/issues/690","id":134460908,"user":{"login":"tasetase","id":3721055,"avatar_url":"https://avatars.githubusercontent.com/u/3721055?v=3","gravatar_id":"","url":"https://api.github.com/users/tasetase","html_url":"https://github.com/tasetase","followers_url":"https://api.github.com/users/tasetase/followers","following_url":"https://api.github.com/users/tasetase/following{/other_user}","gists_url":"https://api.github.com/users/tasetase/gists{/gist_id}","starred_url":"https://api.github.com/users/tasetase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tasetase/subscriptions","organizations_url":"https://api.github.com/users/tasetase/orgs","repos_url":"https://api.github.com/users/tasetase/repos","events_url":"https://api.github.com/users/tasetase/events{/privacy}","received_events_url":"https://api.github.com/users/tasetase/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T03:05:19Z","updated_at":"2015-08-25T03:05:19Z","body":"@dragonjet Go ahead, the agent key I'm using is the same one used in KancolleDbPost. Tell me how it goes."}}