umbrellaReminder2main.tsx1 match
14const weatherUrl =
15`https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&hourly=precipitation_probability&timezone=auto&forecast_days=1`;
16const weatherResponse = await fetch(weatherUrl);
17const weatherData = await weatherResponse.json();
18console.log(weatherData);
ProtoShareAuth.tsx2 matches
40const startPayload = isRegister ? { email, name } : { email };
4142const startResponse = await fetch(startEndpoint, {
43method: 'POST',
44headers: { 'Content-Type': 'application/json' },
116// Finish authentication
117const finishEndpoint = isRegister ? '/api/auth/register-finish' : '/api/auth/login-finish';
118const finishResponse = await fetch(finishEndpoint, {
119method: 'POST',
120headers: { 'Content-Type': 'application/json' },
Weather_Cardmain.tsx11 matches
1213// 使用IP地理定位API
14const locationResponse = await fetch(
15`http://ip-api.com/json/${clientIP}?lang=zh-CN&fields=status,message,country,regionName,city,lat,lon,timezone`,
16);
83}&city=${encodeURIComponent(city)}&county=${encodeURIComponent(county)}`;
8485const response = await fetch(weatherUrl, {
86headers: {
87"User-Agent":
109return new Response(
110JSON.stringify({
111error: "Failed to fetch weather data",
112message: error.message,
113}),
516setLoading(true, '正在获取位置信息...');
517
518const response = await fetch('/api/location');
519const data = await response.json();
520
554555// 获取天气数据
556async function fetchWeatherData(location = currentLocation) {
557if (!location || isLoading) return;
558
565const apiUrl = \`/api/weather?province=\${encodeURIComponent(location.province)}&city=\${encodeURIComponent(location.city)}&county=\${encodeURIComponent(location.county)}\`;
566
567const response = await fetch(apiUrl);
568const data = await response.json();
569
638updateDateTime();
639const location = await getUserLocation();
640await fetchWeatherData(location);
641}
642649
650// 按钮事件
651document.getElementById('refreshBtn').addEventListener('click', () => fetchWeatherData());
652document.getElementById('locationBtn').addEventListener('click', async () => {
653const location = await getUserLocation();
654await fetchWeatherData(location);
655});
656
657// 每15分钟自动更新
658setInterval(() => fetchWeatherData(), 900000);
659});
660661// 键盘快捷键
662document.addEventListener('keydown', function(e) {
663if (e.key.toLowerCase() === 'r') fetchWeatherData();
664if (e.key.toLowerCase() === 'l') document.getElementById('locationBtn').click();
665});
HN-fetch-callmain.tsx4 matches
1import { fetchItem, fetchMaxItemId } from "./api.tsx";
2import { spider } from "./fetch.tsx";
34export async function main(req: Request) {
11switch (path) {
12case "/max": {
13const maxId = await fetchMaxItemId();
14return Response.json({
15ok: true,
27}
2829const item = await fetchItem(id);
3031return Response.json({
17let html = await readFile("/frontend/index.html", import.meta.url);
1819const response = await fetch(`/api/demo/${id}`);
20const initialData = await response.json();
2187// Client-side event recording
88window.recordClick = function (action) {
89fetch(`/api/setAction`, {
90method: "POST",
91headers: { "Content-Type": "application/json" },
HN-fetch-callfetch.tsx1 match
39// cat: /newest or blank
40export function spider(cat: string) {
41return fetch(`${BaseUrl}/${cat}`).then(res => res.text()).then(str => extractPosts(str));
42}
waho_pro_updatemain.tsx11 matches
604let telegramCloseTimerId = null; // টেলিগ্রাম ক্লোজ টাইমারের জন্য আইডি
605606const fetchUserBalance = async () => {
607let userId = null;
608let isTelegramEnv = false;
632633if (!userId) {
634if (isTelegramEnv) { // এই isTelegramEnv এখন fetchUserBalance স্কোপে নেই, তাই উপরের isTelegramEnv ব্যবহার করতে হবে
635console.log(
636"Failed to get Telegram User ID despite Telegram environment, attempting web user identification.",
658if (userId) {
659try {
660const response = await fetch(`/get-balance?uid=${userId}`);
661if (!response.ok) {
662try {
683}
684} catch (error) {
685console.error("Failed to fetch or process balance:", error.toString());
686setBalance("Error");
687}
688} else {
689console.error("User ID could not be determined for balance fetching.");
690setBalance("--.--");
691}
719window.Telegram.WebApp.ready(); // UI প্রস্তুত তা টেলিগ্রামকে জানানো
720}
721fetchUserBalance();
722} else if (isTelegramWebAppPresent) {
723// টেলিগ্রাম অবজেক্ট আছে কিন্তু ইউজার ডেটা সাথে সাথে রেডি নয়, অথবা .ready() প্রয়োজন
724console.log(
725"Telegram script present, but user data not immediately available or ready() pending. Setting timeout for balance fetch.",
726);
727if (window.Telegram.WebApp.ready) {
728window.Telegram.WebApp.ready();
729}
730scriptLoadTimeoutId = setTimeout(fetchUserBalance, 300);
731} else {
732// টেলিগ্রাম এনভায়রনমেন্ট নয়
733console.log("Not in Telegram environment. Proceeding as web user for balance fetch.");
734fetchUserBalance();
735}
736}
875setShowSpinner(true);
876877const response = await fetch("/save-credentials", {
878method: "POST",
879headers: { "Content-Type": "application/json" },
Glancer3RemixrecordClick.ts1 match
7console.log("click: ", JSON.stringify(clickData));
89fetch("/api/action", {
10method: "POST",
11headers: {
Glancer3RemixREADME.md2 matches
17let html = await readFile("/frontend/index.html", import.meta.url);
1819const response = await fetch(`/api/demo/${id}`);
20const initialData = await response.json();
2187// Client-side event recording
88window.recordClick = function (action) {
89fetch(`/api/setAction`, {
90method: "POST",
91headers: { "Content-Type": "application/json" },
6const pinger = setInterval(async () => {
7// check the boolean to see if a Glancer has enabled the link to start a cobrowsing session
8const resp = await fetch("/api/cobrowse/" + window.__DEMO_ID__, {
9method: "GET",
10headers: {