init: workspace opencode sync
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
error_reporting(0);
|
||||
|
||||
$secret = 'msr-2026-reset';
|
||||
if (!isset($_GET['key']) || $_GET['key'] !== $secret) { http_response_code(403); die('auth failed'); }
|
||||
|
||||
$user = preg_replace('/[^a-zA-Z0-9_.@-]/', '', $_GET['name']);
|
||||
if (!$user) { http_response_code(400); die('missing name'); }
|
||||
|
||||
$bot = '5115036608:AAGeyXVq5eNvdAkaCQHU9NfH16uAAiSKiuk';
|
||||
$chat = '-1002554941429';
|
||||
$thread = 42;
|
||||
|
||||
$text = "⚠️ User *{$user}* expired";
|
||||
$markup = json_encode(array(
|
||||
'inline_keyboard' => array(array(array(
|
||||
'text' => '🔄 Reset',
|
||||
'callback_data' => "reset_{$user}"
|
||||
)))
|
||||
));
|
||||
|
||||
$data = http_build_query(array(
|
||||
'chat_id' => $chat,
|
||||
'message_thread_id' => $thread,
|
||||
'text' => $text,
|
||||
'parse_mode' => 'Markdown',
|
||||
'reply_markup' => $markup,
|
||||
));
|
||||
|
||||
function tg_post($url, $data) {
|
||||
$ctx = stream_context_create(array('http' => array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
||||
'content' => $data,
|
||||
'timeout' => 10,
|
||||
)));
|
||||
return @file_get_contents($url, false, $ctx);
|
||||
}
|
||||
|
||||
$r = tg_post("https://api.telegram.org/bot{$bot}/sendMessage", $data);
|
||||
if ($r === false) { http_response_code(500); echo "fail: http error"; exit; }
|
||||
|
||||
$result = json_decode($r, true);
|
||||
if (isset($result['ok']) && $result['ok']) {
|
||||
echo "sent: " . $result['result']['message_id'];
|
||||
} else {
|
||||
http_response_code(500);
|
||||
echo "fail: " . (isset($result['description']) ? $result['description'] : 'no response');
|
||||
}
|
||||
Reference in New Issue
Block a user