nextcloud / weather

⛅️ Weather app for Nextcloud
GNU Affero General Public License v3.0
47 stars 27 forks source link

Cannnot add a city and Fatal Error occurs #40

Closed Hummingfrogs closed 7 years ago

Hummingfrogs commented 7 years ago
### Steps to reproduce 1.Click Weather App in user page 2.Click "Add a city ..." button , fill the city name and click "Add" button 3.Then issue occurs ### Expected behaviour The city will be saved and added properly. ### Actual behaviour At adding city-name field, "Fatal Error:please check your owncloud.log and send a bug report here: https://github.com/nextcloud/weather/issues" will be displayed. And also in a "Admin > Logging" view, error is reported such like "Undefined index: openweathermap_api_key at /var/www/nextcloud/apps/weather/templates/admin.php#6" ### Server configuration **Operating system:** Ubuntu 16.04 LTS **Web server:** apache2 Server version: Apache/2.4.18 (Ubuntu) Server built: 2017-06-26T11:58:04 **Database:** mysql 5.7.18-0ubuntu0.16.04.1 **PHP version:** PHP 7.0.18-0ubuntu0.16.04.1 **Nextcloud version:** 12.0.0 **Updated from an older Nextcloud/ownCloud or fresh install:** once fresh install Nextcloud 12 and migrate config.php and data from ownCloud 10. **Where did you install Nextcloud from:** zipped package from Nextcloud site. **Signing status:**
Signing status Login as admin user into your Nextcloud and access http://example.com/index.php/settings/integrity/failed paste the results here. "No errors have been found."
**List of activated apps:**
App list Enabled: - activity: 2.5.2 - admin_notifications: 1.0.0 - audioplayer: 2.0.21.0.6 - bruteforcesettings: 1.0.2 - comments: 1.2.01.0.0 - dav: 1.3.0: 1.2.0 - drawio: 0.8.81.2.0 - federatedfilesharing: 1.2.0 - federation: 1.2.0 - files: 1.7.2.0 - files_markdown: 1.0.1: 1.1.1 - files_pdfviewer: 1.1.1 - files_reader: 1.0.4 1.2.0 - files_sharing: 1.4.0 - files_texteditor: 2.4.1 - files_trashbin: 1.2.0 - files_versions: 1.5.0 - files_videoplayer: 1.1.0 - firstrunwizard: 2.1 - gallery: 17.0.0 - logreader: 2.0.0 - lookup_server_connector: 1.0.0 - news: 11.0.5 - nextcloud_announcements: 1.1 - notifications: 2.0.0 - oauth2: 1.0.5 - password_policy: 1.2.2 - previewgenerator: 1.0.6 - provisioning_api: 1.2.0 - quota_warning: 1.0.0 - serverinfo: 1.2.0 - sharebymail: 1.2.0 - survey_client: 1.0.0 - systemtags: 1.2.0 - theming: 1.3.0 - twofactor_backupcodes: 1.1.1 - twofactor_totp: 1.3.0 - updatenotification: 1.2.0 - weather: 1.4.2 - workflowengine: 1.2.0 Disabled: - admin_audit - encryption - files_external - user_external - user_ldap
**Nextcloud configuration:**
Config report { "system": { "instanceid": "ocibprihprl6", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "nextcloud.nabecyan.dyndns.org" ], "datadirectory": "\/var\/www\/nextcloud\/data", "overwrite.cli.url": "https:\/\/MYPRIVATEDOMAIN", "dbtype": "mysql", "version": "12.0.0.29", "dbname": "nextcloud", "dbhost": "localhost", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "loglevel": 3 } }
**Are you using external storage, if yes which one:** local storage only **Are you using encryption:** no **Are you using an external user-backend, if yes which one:** No ### Client configuration **Browser:** Safari 10.1.1, Chrome 58.0.3029.110 (64-bit) **Operating system:** macOS Sierra 10.12.5 ### Logs #### Web server error log
Web server error log 49.135.XXX.XXX - - [28/Jun/2017:18:46:56 +0900] "POST /index.php/apps/weather/city/add HTTP/1.1" 401 1025 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.1.1 Safari/603.2.4" 49.135.70.127 - - [28/Jun/2017:18:46:58 +0900] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 1377 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" 211.16.242.200 - hideki [28/Jun/2017:18:46:59 +0900] "PROPFIND /remote.php/dav/files/USERNAME/ HTTP/1.1" 207 1591 "-" "Mozilla/5.0 (Windows) mirall/2.3.1 (build 8) (Nextcloud)"
#### Nextcloud log (data/nextcloud.log)
Nextcloud log {"reqId":"ztIIj0fGINFQ7mvZsBbp","level":3,"time":"2017-06-28T09:51:59+00:00","remoteAddr":"49.135.70.127","user":"USERNAME","app":"PHP","method":"GET","url":"\/index.php\/settings\/admin\/additional","message":"Undefined index: openweathermap_api_key at \/var\/www\/nextcloud\/apps\/weather\/templates\/admin.php#6","userAgent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit\/603.2.4 (KHTML, like Gecko) Version\/10.1.1 Safari\/603.2.4","version":"12.0.0.29"}
#### Browser log
Browser log At Admin>Logging ,reported as below.
Error PHP Undefined index: openweathermap_api_key at /var/www/nextcloud/apps/weather/templates/admin.php#6
henrikp commented 7 years ago

Have you entered your OpenWeatherMap API key in the settings?

Hummingfrogs commented 7 years ago

Hi, I added OpenWeatherMap API into "Admin > Additional settings > Weather" and clicked Save button, it seems to be saved once, but after leaving admin page and when return to this page, API Key disappears (remain in blank). Then after this I tried to add a city, and failed. I don't think this is a bug, but I don't figure out what or how to to add a city correctly. Thanks,

henrikp commented 7 years ago

Just tried it myself, it doesn't indeed save the key - a bug there? I added the key from the app itself (cog in the left bottom corner)

Hummingfrogs commented 7 years ago

Wow! By adding API key into App's Settings text field, succeeded to add a city! Thanks! By the way , there're two options for adding a API key both Admin panel and App panel itself, isn't it confusing for user ?

henrikp commented 7 years ago

In my opinion, when the app is opened, it should default to settings when no key is present and forbid any city adding at all at that moment.

nerzhul commented 7 years ago

Sorry for being long to change this feature... i was very busy on many projects. Don't hesitate to propose a PR to define settings in admin part

nerzhul commented 7 years ago

Fixed by 2a693ed1611f5203a27ef71d828b2245e774dab6