nothumanallowed 13.5.177 → 13.5.178

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "13.5.177",
3
+ "version": "13.5.178",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -696,7 +696,7 @@ export async function cmdUI(args) {
696
696
 
697
697
  // GET /api/weather?location=<city> — live weather via wttr.in (no API key)
698
698
  if (method === 'GET' && pathname === '/api/weather') {
699
- const loc = (urlObj.searchParams.get('location') || config.location || '').trim();
699
+ const loc = (url.searchParams.get('location') || config.location || '').trim();
700
700
  if (!loc) { sendJSON(res, 400, { error: 'location required' }); return; }
701
701
  try {
702
702
  const wttrRes = await fetch(`https://wttr.in/${encodeURIComponent(loc)}?format=j1`, {
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '13.5.177';
8
+ export const VERSION = '13.5.178';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -287,33 +287,36 @@ function apiPatch(p){return fetch(API+p,{method:'PATCH'}).then(function(r){retur
287
287
 
288
288
  // ---- LOAD DATA ----
289
289
  function loadWeather(){
290
- // Try browser geolocation first, fall back to IP geolocation, then saved config
291
290
  var savedLoc=localStorage.getItem('nha_weather_location');
292
291
  function fetchWeather(loc){
293
292
  apiGet('/api/weather?location='+encodeURIComponent(loc)).then(function(r){
294
293
  if(r&&r.tempC){dash.weather=r;dashLoaded.weather=true;if(currentView==='dashboard')render();}
295
- }).catch(function(){});
294
+ else{dashLoaded.weather=true;if(currentView==='dashboard')render();}
295
+ }).catch(function(){dashLoaded.weather=true;if(currentView==='dashboard')render();});
296
+ }
297
+ function ipFallback(){
298
+ fetch('https://ipapi.co/json/').then(function(r){return r.json();}).then(function(d){
299
+ var city=d.city||'';
300
+ if(city){localStorage.setItem('nha_weather_location',city);fetchWeather(city);}
301
+ else{dashLoaded.weather=true;render();}
302
+ }).catch(function(){dashLoaded.weather=true;render();});
296
303
  }
304
+ // If location already known, use it directly
297
305
  if(savedLoc){fetchWeather(savedLoc);return;}
306
+ // Try browser geolocation — pass lat,lng directly to wttr.in (no reverse geocoding needed)
298
307
  if(navigator.geolocation){
299
308
  navigator.geolocation.getCurrentPosition(function(pos){
300
- // Reverse geocode via nominatim (free, no key)
301
- fetch('https://nominatim.openstreetmap.org/reverse?lat='+pos.coords.latitude+'&lon='+pos.coords.longitude+'&format=json',{headers:{'User-Agent':'nha-cli/1.0'}})
302
- .then(function(r){return r.json();})
303
- .then(function(d){
309
+ var latLng=pos.coords.latitude.toFixed(4)+','+pos.coords.longitude.toFixed(4);
310
+ fetchWeather(latLng);
311
+ // Also resolve city name for display — save for next time
312
+ fetch('https://nominatim.openstreetmap.org/reverse?lat='+pos.coords.latitude+'&lon='+pos.coords.longitude+'&format=json&accept-language=en')
313
+ .then(function(r){return r.json();}).then(function(d){
304
314
  var city=d.address&&(d.address.city||d.address.town||d.address.village||d.address.county||'');
305
- if(city){localStorage.setItem('nha_weather_location',city);fetchWeather(city);}
315
+ if(city)localStorage.setItem('nha_weather_location',city);
306
316
  }).catch(function(){});
307
- },function(){
308
- // Geoloc denied — IP fallback
309
- fetch('https://ipapi.co/json/').then(function(r){return r.json();}).then(function(d){
310
- var city=d.city||'';if(city){localStorage.setItem('nha_weather_location',city);fetchWeather(city);}
311
- }).catch(function(){});
312
- },{timeout:5000});
317
+ },function(){ipFallback();},{timeout:6000,maximumAge:300000});
313
318
  } else {
314
- fetch('https://ipapi.co/json/').then(function(r){return r.json();}).then(function(d){
315
- var city=d.city||'';if(city){localStorage.setItem('nha_weather_location',city);fetchWeather(city);}
316
- }).catch(function(){});
319
+ ipFallback();
317
320
  }
318
321
  }
319
322