@@ -2,33 +2,9 @@ const axios = require("axios");
2
2
const { Octokit } = require ( "@octokit/rest" ) ;
3
3
const path = require ( "path" ) ;
4
4
5
- const COMMIT_MESSAGE = "Sync LeetCode submission" ;
5
+ const COMMIT_MESSAGE = '[' ;
6
6
const LANG_TO_EXTENSION = {
7
- bash : "sh" ,
8
- c : "c" ,
9
- cpp : "cpp" ,
10
- csharp : "cs" ,
11
- dart : "dart" ,
12
- elixir : "ex" ,
13
- erlang : "erl" ,
14
- golang : "go" ,
15
- java : "java" ,
16
- javascript : "js" ,
17
- kotlin : "kt" ,
18
- mssql : "sql" ,
19
- mysql : "sql" ,
20
- oraclesql : "sql" ,
21
- php : "php" ,
22
- python : "py" ,
23
- python3 : "py" ,
24
- pythondata : "py" ,
25
- postgresql : "sql" ,
26
- racket : "rkt" ,
27
- ruby : "rb" ,
28
- rust : "rs" ,
29
- scala : "scala" ,
30
- swift : "swift" ,
31
- typescript : "ts" ,
7
+ 'golang' : 'go' ,
32
8
} ;
33
9
const BASE_URL = "https://leetcode.com" ;
34
10
@@ -109,8 +85,8 @@ async function getInfo(submission, session, csrfToken) {
109
85
}
110
86
log (
111
87
"Error fetching submission info, retrying in " +
112
- 3 ** retryCount +
113
- " seconds..." ,
88
+ 3 ** retryCount +
89
+ " seconds..." ,
114
90
) ;
115
91
await delay ( 3 ** retryCount * 1000 ) ;
116
92
return getInfo ( maxRetries , retryCount + 1 ) ;
@@ -185,7 +161,7 @@ async function commit(params) {
185
161
const commitResponse = await octokit . git . createCommit ( {
186
162
owner : owner ,
187
163
repo : repo ,
188
- message : message ,
164
+ message : ` ${ COMMIT_MESSAGE } ${ submission . social . difficulty } ] [ ${ submission . tags } ] [ ${ submission . perf . runtimeDisplay } ] [ ${ submission . perf . memoryDisplay } ]` ,
189
165
tree : treeResponse . data . sha ,
190
166
parents : [ latestCommitSHA ] ,
191
167
author : {
@@ -365,8 +341,8 @@ async function sync(inputs) {
365
341
}
366
342
log (
367
343
"Error fetching submissions, retrying in " +
368
- 3 ** retryCount +
369
- " seconds..." ,
344
+ 3 ** retryCount +
345
+ " seconds..." ,
370
346
) ;
371
347
// There's a rate limit on LeetCode API, so wait with backoff before retrying.
372
348
await delay ( 3 ** retryCount * 1000 ) ;
0 commit comments