|
2 | 2 | // Licensed under the MIT license.
|
3 | 3 |
|
4 | 4 | import{commands,ViewColumn}from"vscode";
|
5 |
| -import{IProblem}from"../shared"; |
| 5 | +import{getLeetCodeEndpoint}from"../commands/plugin"; |
| 6 | +import{Endpoint,IProblem}from"../shared"; |
6 | 7 | import{ILeetCodeWebviewOption,LeetCodeWebview}from"./LeetCodeWebview";
|
7 | 8 | import{markdownEngine}from"./markdownEngine";
|
8 | 9 |
|
@@ -180,21 +181,18 @@ class LeetCodePreviewProvider extends LeetCodeWebview {
|
180 | 181 | }
|
181 | 182 |
|
182 | 183 | privategetDiscussionLink(url:string):string{
|
183 |
| -if(url.includes("leetcode-cn.com")){ |
| 184 | +constendPoint:string=getLeetCodeEndpoint(); |
| 185 | +if(endPoint===Endpoint.LeetCodeCN){ |
184 | 186 | returnurl.replace("/description/","/comments/");
|
185 |
| -}elseif(url.includes("leetcode.com")){ |
| 187 | +}elseif(endPoint===Endpoint.LeetCode){ |
186 | 188 | returnurl.replace("/description/","/discuss/?currentPage=1&orderBy=most_votes&query=");
|
187 | 189 | }
|
188 | 190 |
|
189 | 191 | return"https://leetcode.com";
|
190 | 192 | }
|
191 | 193 |
|
192 | 194 | privategetSolutionLink(url:string):string{
|
193 |
| -if(url.includes("leetcode-cn.com")||url.includes("leetcode.com")){ |
194 |
| -returnurl.replace("/description/","/solution/"); |
195 |
| -} |
196 |
| - |
197 |
| -return"https://leetcode.com"; |
| 195 | +returnurl.replace("/description/","/solution/"); |
198 | 196 | }
|
199 | 197 | }
|
200 | 198 |
|
|