nothumanallowed 13.5.177 → 13.5.179

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.179",
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`, {
@@ -715,8 +715,12 @@ export async function cmdUI(args) {
715
715
  desc: d.hourly?.[4]?.weatherDesc?.[0]?.value || '',
716
716
  rain: d.hourly?.[4]?.chanceofrain || '0',
717
717
  }));
718
+ // Use the user-provided location as display name — wttr.in nearest_area
719
+ // often resolves to a nearby suburb (e.g. "Modena" → "Sant'Agnese") which
720
+ // is confusing. The weather data itself is correct regardless.
721
+ const displayCity = loc.includes(',') ? loc.split(',')[0].trim() : loc;
718
722
  sendJSON(res, 200, {
719
- city: area?.areaName?.[0]?.value || loc,
723
+ city: displayCity,
720
724
  country: area?.country?.[0]?.value || '',
721
725
  tempC: cur.temp_C,
722
726
  feelsC: cur.FeelsLikeC,
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.179';
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,37 @@ 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){
304
- 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);}
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&zoom=10')
313
+ .then(function(r){return r.json();}).then(function(d){
314
+ // zoom=10 = city level — avoids resolving to suburbs/villages
315
+ var city=d.address&&(d.address.city||d.address.town||d.address.county||'');
316
+ if(city)localStorage.setItem('nha_weather_location',city);
306
317
  }).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});
318
+ },function(){ipFallback();},{timeout:6000,maximumAge:300000});
313
319
  } 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(){});
320
+ ipFallback();
317
321
  }
318
322
  }
319
323