diff --git a/PatchBase.php b/PatchBase.php index 2fbfdbd..5269e37 100644 --- a/PatchBase.php +++ b/PatchBase.php @@ -125,11 +125,6 @@ abstract class PatchBase { $this->data = $str; } } - protected function str_extract(int $n) { - $lines = explode("\r\n", $this->data); - if (count($lines) > $n) - $this->data = $lines[$n]; - } private function curl(string $url, array $opts) { if ($ch = curl_init()) { curl_setopt($ch, CURLOPT_URL, $url); diff --git a/modules/Freeplane.php b/modules/Freeplane.php index 1be5739..9181e5f 100644 --- a/modules/Freeplane.php +++ b/modules/Freeplane.php @@ -5,10 +5,8 @@ class Freeplane extends PatchBase { parent::__construct('Freeplane Team', 'Freeplane', 'https://docs.freeplane.org/'); } function check() : bool { - if ($this->fetch('https://www.freeplane.org/info/history/history_en.txt')) { - $this->str_extract(1); - return $this->parse('/^([\d\.]+)/m'); - } + if ($this->fetch_json('https://sourceforge.net/projects/freeplane/best_release.json')) + return $this->parse_json('filename', '/-([\d\.]+[u\d]*)\.[a-z]+$/'); return false; } } diff --git a/modules/NAPS2.php b/modules/NAPS2.php deleted file mode 100644 index 9ad67ae..0000000 --- a/modules/NAPS2.php +++ /dev/null @@ -1,14 +0,0 @@ -fetch_json('https://api.github.com/repos/cyanfish/naps2/releases/latest')) - return $this->parse_json('tag_name'); - return false; - } -} - -?> diff --git a/modules/TeamViewer.php b/modules/TeamViewer.php index b27d896..f9198a7 100644 --- a/modules/TeamViewer.php +++ b/modules/TeamViewer.php @@ -5,7 +5,7 @@ class TeamViewer extends PatchBase { parent::__construct('TeamViewer', 'TeamViewer', 'https://www.teamviewer.com/en/download/windows/'); } function check() : bool { - if ($this->fetch('https://www.teamviewer.com/en/download/portal/windows/')) + if ($this->fetch('https://www.teamviewer.com/en/download/windows/')) return $this->parse('/([\d\.]+)<\/span>/'); return false; }