@@ -10,24 +10,36 @@ import { appInfo } from "../../common/modules/client";
10
10
* Generates a link to new GitHub issue, based on `bug_report.md`
11
11
* and current hardware / software configuration. This makes it
12
12
* easy to aquire needed details (except screenshot, because of
13
- * the lack of the GitHub support to do that via the CDN or using
14
- * ' base64' images).
13
+ * the lack of the GitHub support to do that ~~ via the CDN or~~ using
14
+ * ` base64` encoded images).
15
15
*
16
16
* @property reason – A bug description (app failure reason).
17
17
* @todo Parse (commented) values to be compatible with the template.
18
+ * @todo Check GitHub API to actually use their CDN if possible.
18
19
*/
19
20
export async function createGithubIssue ( reason ?: string ) : Promise < void > {
20
21
/** An URL to the new GitHub issue, based on YAML forms. */
21
22
const githubIssueUrl = new URL (
22
- "https://github.com/" + appInfo . repository . name + "/issues/new" +
23
- "?assignees=SpacingBat3" + "&labels=bug" + "&template=bug.yml" +
24
- //'&platform='
25
- //'&architecture='
26
- "&electron_version=" + encodeURIComponent ( process . versions . electron ) +
27
- "&app_version=" + encodeURIComponent ( app . getVersion ( ) ) +
28
- "&additional=" + encodeURIComponent ( "**Notice:** This issue was automatically generated by " + app . getName ( ) + "." ) +
29
- ( reason ? "&description=" + encodeURIComponent ( reason ) : "" )
23
+ appInfo . repository . name + "/issues/new" ,
24
+ "https://github.com"
30
25
) ;
26
+ /** A set of URL parameters appended to the {@link githubIssueUrl}. */
27
+ const githubIssueUrlParams = new URLSearchParams ( {
28
+ assignees : "SpacingBat3" ,
29
+ labels : "bug" ,
30
+ template : "bug.yml" ,
31
+ //platform: "N/A",
32
+ //architecture: "N/A",
33
+ electron_version : process . versions . electron ,
34
+ app_version : app . getVersion ( ) ,
35
+ additional : "**Notice:** This issue was automatically generated by " + app . getName ( ) + "."
36
+ } ) ;
37
+
38
+ githubIssueUrlParams
39
+ . forEach ( ( value , key ) => githubIssueUrl . searchParams . append ( key , value ) ) ;
40
+
41
+ if ( reason )
42
+ githubIssueUrl . searchParams . append ( "description" , reason ) ;
31
43
32
44
/* Verify origin and open URL in default browser. */
33
45
0 commit comments