Keldos commited on
Commit
9b74535
1 Parent(s): fe3346f

fix: 修复即使在最新版仍提示存在更新的问题

Browse files
Files changed (2) hide show
  1. assets/custom.js +1 -2
  2. modules/utils.py +1 -2
assets/custom.js CHANGED
@@ -539,7 +539,6 @@ async function updateLatestVersion() {
539
  const currentVersion = currentVersionElement.textContent;
540
  const versionTime = document.getElementById('version-time').innerText;
541
  const localVersionTime = versionTime !== "unknown" ? (new Date(versionTime)).getTime() : 0;
542
- // const currentVersion = '20230619'; // for debugging
543
  updateInfoGotten = true; //无论成功与否都只执行一次,否则容易api超限...
544
  try {
545
  const data = await getLatestRelease();
@@ -548,7 +547,7 @@ async function updateLatestVersion() {
548
  releaseNoteElement.innerHTML = marked.parse(releaseNote);
549
  }
550
  const latestVersion = data.tag_name;
551
- const latestVersionTime = (new Date(data.published_at)).getTime();
552
  if (latestVersionTime) {
553
  if (localVersionTime < latestVersionTime) {
554
  latestVersionElement.textContent = latestVersion;
 
539
  const currentVersion = currentVersionElement.textContent;
540
  const versionTime = document.getElementById('version-time').innerText;
541
  const localVersionTime = versionTime !== "unknown" ? (new Date(versionTime)).getTime() : 0;
 
542
  updateInfoGotten = true; //无论成功与否都只执行一次,否则容易api超限...
543
  try {
544
  const data = await getLatestRelease();
 
547
  releaseNoteElement.innerHTML = marked.parse(releaseNote);
548
  }
549
  const latestVersion = data.tag_name;
550
+ const latestVersionTime = (new Date(data.created_at)).getTime();
551
  if (latestVersionTime) {
552
  if (localVersionTime < latestVersionTime) {
553
  latestVersionElement.textContent = latestVersion;
modules/utils.py CHANGED
@@ -583,8 +583,7 @@ def versions_html():
583
  def version_time():
584
  git = os.environ.get('GIT', "git")
585
  try:
586
- commit_time = run(f"{git} log -1 --format=%cd --date=iso-strict").strip()
587
- commit_time = datetime.datetime.fromisoformat(commit_time).replace(tzinfo=timezone.utc).astimezone().strftime('%Y-%m-%dT%H:%M:%SZ')
588
  except Exception:
589
  commit_time = "unknown"
590
  return commit_time
 
583
  def version_time():
584
  git = os.environ.get('GIT', "git")
585
  try:
586
+ commit_time = run(f"TZ=UTC {git} log -1 --format=%cd --date='format-local:%Y-%m-%dT%H:%M:%SZ'").strip()
 
587
  except Exception:
588
  commit_time = "unknown"
589
  return commit_time