Compare commits

..

3 commits

Author SHA1 Message Date
fef3a414b5 Freeplane: parse changelog file 2025-05-11 14:03:30 +02:00
fe0303bcbb Add NAPS2 2025-05-11 14:02:41 +02:00
e7e0804d1c TeamViewer: update url 2025-05-11 14:02:26 +02:00
4 changed files with 24 additions and 3 deletions

View file

@ -125,6 +125,11 @@ abstract class PatchBase {
$this->data = $str; $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) { private function curl(string $url, array $opts) {
if ($ch = curl_init()) { if ($ch = curl_init()) {
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);

View file

@ -5,8 +5,10 @@ class Freeplane extends PatchBase {
parent::__construct('Freeplane Team', 'Freeplane', 'https://docs.freeplane.org/'); parent::__construct('Freeplane Team', 'Freeplane', 'https://docs.freeplane.org/');
} }
function check() : bool { function check() : bool {
if ($this->fetch_json('https://sourceforge.net/projects/freeplane/best_release.json')) if ($this->fetch('https://www.freeplane.org/info/history/history_en.txt')) {
return $this->parse_json('filename', '/-([\d\.]+[u\d]*)\.[a-z]+$/'); $this->str_extract(1);
return $this->parse('/^([\d\.]+)/m');
}
return false; return false;
} }
} }

14
modules/NAPS2.php Normal file
View file

@ -0,0 +1,14 @@
<?php
class NAPS2 extends PatchBase {
function __construct() {
parent::__construct('NAPS2 Contributors', 'NAPS2', 'https://www.naps2.com/download');
}
function check() : bool {
if ($this->fetch_json('https://api.github.com/repos/cyanfish/naps2/releases/latest'))
return $this->parse_json('tag_name');
return false;
}
}
?>

View file

@ -5,7 +5,7 @@ class TeamViewer extends PatchBase {
parent::__construct('TeamViewer', 'TeamViewer', 'https://www.teamviewer.com/en/download/windows/'); parent::__construct('TeamViewer', 'TeamViewer', 'https://www.teamviewer.com/en/download/windows/');
} }
function check() : bool { function check() : bool {
if ($this->fetch('https://www.teamviewer.com/en/download/windows/')) if ($this->fetch('https://www.teamviewer.com/en/download/portal/windows/'))
return $this->parse('/<span data-dl-version-label>([\d\.]+)<\/span>/'); return $this->parse('/<span data-dl-version-label>([\d\.]+)<\/span>/');
return false; return false;
} }