Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit d6a1b30

Browse files
Merge branch 'master' into docs/authentication
2 parents c0b8b3c + ef2b7cc commit d6a1b30

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

octorun/src/api.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ var config = require("./configuration");
22
var octokitWrapper = require("./octokit");
33

44
function ApiWrapper() {
5-
this.octokit = octokitWrapper.createOctokit();
5+
if (!config.appName) {
6+
throw "appName missing";
7+
}
68

79
if (!config.user || !config.token) {
810
throw "user and/or token missing";
911
}
1012

11-
if (!config.appName) {
12-
throw "appName missing";
13-
}
13+
this.octokit = octokitWrapper.createOctokit(config.appName);
1414

1515
this.octokit.authenticate({
1616
type: "oauth",

octorun/src/authentication.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var handleAuthentication = function (username, password, onSuccess, onFailure, t
1515
throw "appName missing";
1616
}
1717

18-
var octokit = octokitWrapper.createOctokit();
18+
var octokit = octokitWrapper.createOctokit(config.appName);
1919

2020
octokit.authenticate({
2121
type: "basic",
@@ -27,7 +27,6 @@ var handleAuthentication = function (username, password, onSuccess, onFailure, t
2727
if (twoFactor) {
2828
headers = {
2929
"X-GitHub-OTP": twoFactor,
30-
"user-agent": config.appName
3130
};
3231
}
3332

octorun/src/octokit.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
var Octokit = require('octokit-rest-for-node-v0.12');
22

3-
var createOctokit = function () {
3+
var createOctokit = function (appName) {
44
return Octokit({
55
timeout: 0,
66
requestMedia: 'application/vnd.github.v3+json',
77
headers: {
8-
'user-agent': 'octokit/rest.js v1.2.3'
8+
'user-agent': appName
99
}
10-
11-
// change for custom GitHub Enterprise URL
12-
//host: 'api.github.com',
13-
//pathPrefix: '',
14-
//protocol: 'https',
15-
//port: 443
1610
});
1711
};
1812

src/GitHub.Api/Application/ApplicationInfo.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ static partial class ApplicationInfo
66
#if DEBUG
77
public const string ApplicationName = "GitHub for Unity Debug";
88
public const string ApplicationProvider = "GitHub";
9+
public const string ApplicationSafeName = "GitHubUnity-dev";
910
#else
1011
public const string ApplicationName = "GitHubUnity";
1112
public const string ApplicationProvider = "GitHub";
12-
#endif
1313
public const string ApplicationSafeName = "GitHubUnity";
14+
#endif
1415
public const string ApplicationDescription = "GitHub for Unity";
1516

1617
internal static string ClientId { get; private set; } = "";

src/GitHub.Api/Tasks/ProcessTask.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void Run()
106106
gotOutput.Set();
107107
if (e.Data != null)
108108
{
109-
var line = Encoding.UTF8.GetString(Encoding.Default.GetBytes(e.Data));
109+
var line = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(e.Data));
110110
errors.Add(line.TrimEnd('\r', '\n'));
111111
Logger.Trace(line);
112112
}
@@ -121,7 +121,7 @@ public void Run()
121121
gotOutput.Set();
122122
if (e.Data != null)
123123
{
124-
var line = Encoding.UTF8.GetString(Encoding.Default.GetBytes(e.Data));
124+
var line = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(e.Data));
125125
outputProcessor.LineReceived(line.TrimEnd('\r','\n'));
126126
}
127127
else

0 commit comments

Comments
 (0)