@@ -2,33 +2,9 @@ const axios = require("axios");
22const { Octokit } = require ( "@octokit/rest" ) ;
33const path = require ( "path" ) ;
44
5- const COMMIT_MESSAGE = "Sync LeetCode submission" ;
5+ const COMMIT_MESSAGE = '[' ;
66const 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' ,
328} ;
339const BASE_URL = "https://leetcode.com" ;
3410
@@ -109,8 +85,8 @@ async function getInfo(submission, session, csrfToken) {
10985 }
11086 log (
11187 "Error fetching submission info, retrying in " +
112- 3 ** retryCount +
113- " seconds..." ,
88+ 3 ** retryCount +
89+ " seconds..." ,
11490 ) ;
11591 await delay ( 3 ** retryCount * 1000 ) ;
11692 return getInfo ( maxRetries , retryCount + 1 ) ;
@@ -185,7 +161,7 @@ async function commit(params) {
185161 const commitResponse = await octokit . git . createCommit ( {
186162 owner : owner ,
187163 repo : repo ,
188- message : message ,
164+ message : ` ${ COMMIT_MESSAGE } ${ submission . social . difficulty } ] [ ${ submission . tags } ] [ ${ submission . perf . runtimeDisplay } ] [ ${ submission . perf . memoryDisplay } ]` ,
189165 tree : treeResponse . data . sha ,
190166 parents : [ latestCommitSHA ] ,
191167 author : {
@@ -365,8 +341,8 @@ async function sync(inputs) {
365341 }
366342 log (
367343 "Error fetching submissions, retrying in " +
368- 3 ** retryCount +
369- " seconds..." ,
344+ 3 ** retryCount +
345+ " seconds..." ,
370346 ) ;
371347 // There's a rate limit on LeetCode API, so wait with backoff before retrying.
372348 await delay ( 3 ** retryCount * 1000 ) ;
0 commit comments