Browse Source

Use {version} placeholder in version_check.php

Antony Male 9 năm trước cách đây
mục cha
commit
2d779d00f4
1 tập tin đã thay đổi với 9 bổ sung6 xóa
  1. 9 6
      server/version_check.php

+ 9 - 6
server/version_check.php

@@ -68,18 +68,18 @@ $versions = [
    '1.1.5' => [
       'installed' => [
          'direct_download_url' => [
-            'x64' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.1.5/SyncTrayzorSetup-x64.exe',
-            'x86' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.1.5/SyncTrayzorSetup-x86.exe',
+            'x64' => 'https://github.com/canton7/SyncTrayzor/releases/download/v{version}/SyncTrayzorSetup-x64.exe',
+            'x86' => 'https://github.com/canton7/SyncTrayzor/releases/download/v{version}/SyncTrayzorSetup-x86.exe',
          ],
       ],
       // 'portable' => [
       //    'direct_download_url' => [
-      //       'x64' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.1.5/SyncTrayzorPortable-x64.zip',
-      //       'x86' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.1.5/SyncTrayzorPortable-x86.zip',
+      //       'x64' => 'https://github.com/canton7/SyncTrayzor/releases/download/v{version}/SyncTrayzorPortable-x64.zip',
+      //       'x86' => 'https://github.com/canton7/SyncTrayzor/releases/download/v{version}/SyncTrayzorPortable-x86.zip',
       //    ],
       // ],     
-      'sha1sum_download_url' => 'https://github.com/canton7/SyncTrayzor/releases/download/v1.1.5/sha1sum.txt.asc',
-      'release_page_url' => 'https://github.com/canton7/SyncTrayzor/releases/tag/v1.1.5',
+      'sha1sum_download_url' => 'https://github.com/canton7/SyncTrayzor/releases/download/v{version}/sha1sum.txt.asc',
+      'release_page_url' => 'https://github.com/canton7/SyncTrayzor/releases/tag/v{version}',
       'release_notes' => "- Disable devices which connect over a metered network (#167)\n- Don't report conflict files in the .stversions folder (#203)\n- Add a 'Browse' button (which opens a folder browser) to Syncthing's 'Add folder' dialog (#78)\n- Fix a race condition in the alerts system (#208)\n- Log file transfers to a CSV file in the logs directly (#205)\n- Upgrade the embedded browser: may fix issues with Syncthing's UI not loading at first, and adds support for touch-screen devices (#129)\n- Create chocolatey package (#189)\n- Clarify some wording in Settings and the Conflict Resolver (#204, #209)\n- Handle two instances of SyncTrayzor saving their config at the same time (#185)",
    ]
 ];
@@ -201,6 +201,9 @@ try
          $to_version = array_keys($versions)[0];
       $formatter = $response_formatters[$upgrades[$version]['formatter']];
       $overrides = isset($upgrades[$version]['overrides']) ? $upgrades[$version]['overrides'] : [];
+      array_walk_recursive($versions[$to_version], function(&$value, $key) use ($to_version) {
+         $value = str_replace('{version}', $to_version, $value);
+      });
       $to_version_info = $versions[$to_version];
 
       $data = $formatter($arch, $variant, $to_version, $to_version_info, $overrides);