@@ -40,7 +40,7 @@ import Locale, {
40
40
} from "../locales" ;
41
41
import { copyToClipboard } from "../utils" ;
42
42
import Link from "next/link" ;
43
- import { Path , UPDATE_URL } from "../constant" ;
43
+ import { Path , RELEASE_URL , UPDATE_URL } from "../constant" ;
44
44
import { Prompt , SearchService , usePromptStore } from "../store/prompt" ;
45
45
import { ErrorBoundary } from "./error" ;
46
46
import { InputRange } from "./input-range" ;
@@ -310,19 +310,6 @@ function SyncItems() {
310
310
) ;
311
311
}
312
312
313
- function formatVersionDate ( t : string ) {
314
- const d = new Date ( + t ) ;
315
- const year = d . getUTCFullYear ( ) ;
316
- const month = d . getUTCMonth ( ) + 1 ;
317
- const day = d . getUTCDate ( ) ;
318
-
319
- return [
320
- year . toString ( ) ,
321
- month . toString ( ) . padStart ( 2 , "0" ) ,
322
- day . toString ( ) . padStart ( 2 , "0" ) ,
323
- ] . join ( "" ) ;
324
- }
325
-
326
313
export function Settings ( ) {
327
314
const navigate = useNavigate ( ) ;
328
315
const [ showEmojiPicker , setShowEmojiPicker ] = useState ( false ) ;
@@ -332,24 +319,19 @@ export function Settings() {
332
319
333
320
const updateStore = useUpdateStore ( ) ;
334
321
const [ checkingUpdate , setCheckingUpdate ] = useState ( false ) ;
335
- const currentVersion = formatVersionDate ( updateStore . version ) ;
336
- const remoteId = formatVersionDate ( updateStore . remoteVersion ) ;
322
+ const currentVersion = updateStore . formatVersion ( updateStore . version ) ;
323
+ const remoteId = updateStore . formatVersion ( updateStore . remoteVersion ) ;
337
324
const hasNewVersion = currentVersion !== remoteId ;
325
+ const updateUrl = getClientConfig ( ) ?. isApp ? RELEASE_URL : UPDATE_URL ;
338
326
339
327
function checkUpdate ( force = false ) {
340
328
setCheckingUpdate ( true ) ;
341
329
updateStore . getLatestVersion ( force ) . then ( ( ) => {
342
330
setCheckingUpdate ( false ) ;
343
331
} ) ;
344
332
345
- console . log (
346
- "[Update] local version " ,
347
- new Date ( + updateStore . version ) . toLocaleString ( ) ,
348
- ) ;
349
- console . log (
350
- "[Update] remote version " ,
351
- new Date ( + updateStore . remoteVersion ) . toLocaleString ( ) ,
352
- ) ;
333
+ console . log ( "[Update] local version " , updateStore . version ) ;
334
+ console . log ( "[Update] remote version " , updateStore . remoteVersion ) ;
353
335
}
354
336
355
337
const usage = {
@@ -460,7 +442,7 @@ export function Settings() {
460
442
{ checkingUpdate ? (
461
443
< LoadingIcon />
462
444
) : hasNewVersion ? (
463
- < Link href = { UPDATE_URL } target = "_blank" className = "link" >
445
+ < Link href = { updateUrl } target = "_blank" className = "link" >
464
446
{ Locale . Settings . Update . GoToUpdate }
465
447
</ Link >
466
448
) : (
0 commit comments