-
-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option to list disabled subscriptions at the bottom
feat: notification for wallos version updates
- Loading branch information
Showing
34 changed files
with
670 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
require_once '../../includes/connect_endpoint.php'; | ||
|
||
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { | ||
die(json_encode([ | ||
"success" => false, | ||
"message" => translate('session_expired', $i18n) | ||
])); | ||
} | ||
|
||
// Check that user is an admin | ||
if ($userId !== 1) { | ||
die(json_encode([ | ||
"success" => false, | ||
"message" => translate('error', $i18n) | ||
])); | ||
} | ||
|
||
if ($_SERVER["REQUEST_METHOD"] === "POST") { | ||
|
||
$postData = file_get_contents("php://input"); | ||
$data = json_decode($postData, true); | ||
|
||
$updateNotification = $data['notificationEnabled']; | ||
|
||
// Save settings | ||
$stmt = $db->prepare('UPDATE admin SET update_notification = :update_notification'); | ||
$stmt->bindValue(':update_notification', $updateNotification, SQLITE3_INTEGER); | ||
$result = $stmt->execute(); | ||
|
||
if ($result) { | ||
die(json_encode([ | ||
"success" => true, | ||
"message" => translate('success', $i18n) | ||
])); | ||
} else { | ||
die(json_encode([ | ||
"success" => false, | ||
"message" => translate('error', $i18n) | ||
])); | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php'; | ||
|
||
$options = [ | ||
'http' => [ | ||
'header' => "User-Agent: MyApp\r\n" | ||
] | ||
]; | ||
|
||
$repository = 'ellite/Wallos'; // Change this to your repository if you fork Wallos | ||
$url = "https://api.github.com/repos/$repository/releases/latest"; | ||
|
||
$context = stream_context_create($options); | ||
$fetch = file_get_contents($url, false, $context); | ||
|
||
if ($fetch === false) { | ||
die('Error fetching data from GitHub API'); | ||
} | ||
|
||
$latestVersion = json_decode($fetch, true)['tag_name']; | ||
|
||
// Check that $latestVersion is a valid version number | ||
if (!preg_match('/^v\d+\.\d+\.\d+$/', $latestVersion)) { | ||
die('Error: Invalid version number from GitHub API'); | ||
} | ||
|
||
$db->exec("UPDATE admin SET latest_version = '$latestVersion'"); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
require_once '../../includes/connect_endpoint.php'; | ||
|
||
if (!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !== true) { | ||
die(json_encode([ | ||
"success" => false, | ||
"message" => translate('session_expired', $i18n) | ||
])); | ||
} | ||
|
||
if ($_SERVER["REQUEST_METHOD"] === "POST") { | ||
$postData = file_get_contents("php://input"); | ||
$data = json_decode($postData, true); | ||
|
||
$disabled_to_bottom = $data['value']; | ||
|
||
$stmt = $db->prepare('UPDATE settings SET disabled_to_bottom = :disabled_to_bottom WHERE user_id = :userId'); | ||
$stmt->bindParam(':disabled_to_bottom', $disabled_to_bottom, SQLITE3_INTEGER); | ||
$stmt->bindParam(':userId', $userId, SQLITE3_INTEGER); | ||
|
||
if ($stmt->execute()) { | ||
die(json_encode([ | ||
"success" => true, | ||
"message" => translate("success", $i18n) | ||
])); | ||
} else { | ||
die(json_encode([ | ||
"success" => false, | ||
"message" => translate("error", $i18n) | ||
])); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.