Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(auth): replace oauth2 by public token #1

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .env
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
NWS_VERBOSE=true
NWS_VERBOSE=false
NWS_PORT=3000 # by default
NWS_CLIENT_ID=xxx
NWS_CLIENT_SECRET=xxx
[email protected]
NWS_PASSWORD=xxx
NWS_LATITUDE=46.00
NWS_LONGITUDE=6.055555
NWS_LATITUDE=46.2828848
NWS_LONGITUDE=6.043454
NWS_DISTANCE=2
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@

This project is a little NodeJS server exposing public weather datas through a rest api

## Requirement

To use this application, you need to create first a developper account on Netatmo website.

1. Go to [Netatmo DEV website](https://dev.netatmo.com)
1. Create an account
1. Create an application, [in the App section](https://dev.netatmo.com/apps/)
1. Netatmo will provide you a client ID and client Secret
![app infos](https://raw.githubusercontent.com/rtrompier/netatmo-weather-server/main/doc/netatmo.png)


## How to start

### Installation
Expand Down Expand Up @@ -57,10 +46,6 @@ $ netatmo-weather-server --help
You can pass the following params by environment variables :
* **NWS_VERBOSE** Run with verbose mode
* **NWS_PORT** Http server port
* **NWS_CLIENT_ID** Netatmo Client ID
* **NWS_CLIENT_SECRET** Netatmo Client Secret
* **NWS_USERNAME** Netatmo username
* **NWS_PASSWORD** Netatmo password
* **NWS_LATITUDE** Latitude to search nearby
* **NWS_LONGITUDE** Longitude to search nearby
* **NWS_DISTANCE** Distance to search nearby (in KM)
Expand Down
Binary file removed doc/netatmo.png
Binary file not shown.
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ services:
environment:
- NWS_VERBOSE=true
- NWS_PORT=3000 # by default
- NWS_CLIENT_ID=123|456
- NWS_CLIENT_SECRET=qwerty
- [email protected]
- NWS_PASSWORD=your_password
- NWS_LATITUDE=01.0000
- NWS_LONGITUDE=02.0000
- NWS_DISTANCE=2
Expand Down
76 changes: 38 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "netatmo-weather-server",
"version": "1.0.2",
"version": "1.0.3",
"description": "Node server exposing public weather datas through a rest api",
"main": "index.js",
"bin": {
Expand Down
9 changes: 0 additions & 9 deletions spec/datas/auth-response.json

This file was deleted.

134 changes: 134 additions & 0 deletions spec/datas/home.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, maximum-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta http-equiv="Content-Security-Policy" content="
default-src 'self' cdn.jsdelivr.net *.tiles.mapbox.com unpkg.com *.googletagmanager.com *.gstatic.com;
frame-src js-frame *.netatmo.com;
script-src 'self' 'unsafe-eval' cdn.jsdelivr.net *.tiles.mapbox.com unpkg.com www.googletagmanager.com blob: 'nonce-034347eb6506ee2196d9ed9baeb05f355f16e2ddfbe0c1e2ae1d1e5f581cdb61';
style-src 'self' 'unsafe-inline' *.tiles.mapbox.com cdn.jsdelivr.net *.googletagmanager.com *.googleapis.com;
img-src 'self' *.google-analytics.com https://stats.g.doubleclick.net/ *.googletagmanager.com *.gstatic.com data: blob:;
connect-src 'self' *.jawg.io *.netatmo.com *.netatmo.net *.mapbox.com *.abtasty.com *.google-analytics.com;
child-src 'self' blob: *.netatmo.com;
worker-src 'self' blob:;
">
<!-- ########### Remplace manifest for IOs ########### -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="Weathermap Netatmo">

<link rel="apple-touch-icon" href="/images/favicons/[email protected]">
<link rel="apple-touch-startup-image" href="/images/favicons/[email protected]">

<link href="/images/favicons/favicon.ico" rel="icon"/>
<link rel="apple-touch-icon" href="/images/favicons/[email protected]" sizes="57x57">
<!-- non-retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/images/favicons/[email protected]" sizes="72x72">
<!-- non-retina iPad iOS 7 -->
<link rel="apple-touch-icon" href="/images/favicons/[email protected]" sizes="76x76">
<!-- retina iPhone pre iOS 7 -->
<link rel="apple-touch-icon" href="/images/favicons/[email protected]" sizes="114x114">
<!-- retina iPhone iOS 7 -->
<link rel="apple-touch-icon" href="/images/favicons/[email protected]" sizes="120x120">
<!-- retina iPad pre iOS 7 -->
<link rel="apple-touch-icon" href="/images/favicons/[email protected]" sizes="144x144">
<!-- retina iPad iOS 7 -->
<link rel="apple-touch-icon" href="/images/favicons/[email protected]" sizes="152x152">
<meta property="og:type" content="website"/>
<meta property="og:title" content="Netatmo Weathermap"/>
<meta property="og:description" content="Données météo en temps réel depuis la première communauté de stations météo personnelles au monde."/>
<meta property="og:image" content="https://weathermap.netatmo.com/images/weathermap/weathermap.png"/>
<meta property="og:image:secure_url" content="https://weathermap.netatmo.com/images/weathermap/weathermap.png"/>
<meta property="og:image:type" content="image/png"/>

<meta property="twitter:site" content="@netatmo"/>
<meta property="twitter:title" content="Netatmo Weathermap"/>
<meta property="twitter:description" content="Données météo en temps réel depuis la première communauté de stations météo personnelles au monde."/>
<meta property="twitter:card" content="summary_large_image"/>
<meta property="twitter:image" content="https://weathermap.netatmo.com/images/weathermap/weathermap.png"/>

<link rel="shortcut icon" href="/images/favicons/favicon.ico" />

<title>Netatmo Weathermap</title>
<meta name="description" content="Données météo en temps réel depuis la première communauté de stations météo personnelles au monde.">

<link href="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.css" rel="stylesheet" type="text/css" />
<script src="//cdn.jsdelivr.net/chartist.js/latest/chartist.min.js"></script>

<script nonce="034347eb6506ee2196d9ed9baeb05f355f16e2ddfbe0c1e2ae1d1e5f581cdb61">
window.config = {
apiUrl: "https://app.netatmo.net/api/",
accessToken: "52d42bfc1777599b298b456c|90035caa57ecd5dbaab93dddd1fdc775",
cookiePrefix: "netatmocom",
center: {lat: '48.5', lng: '2.2'},
countryCode: "FR",
continentCode: "",
browserLang: "fr-FR",
appEnv: "production",
ACTIVATE_SERVICE_WORKERS: false,
wmUrl: "https://weathermap.netatmo.com/",
myUrl: "https://my.netatmo.com/",
wwwUrl: "https://www.netatmo.com/",
authUrl: "https://auth.netatmo.com/",
loginUrl: "https://auth.netatmo.com/access/checklogin/",
viewUrl: "https://view.netatmo.com/",
};

window.dataLayer = window.dataLayer || [];

function gtag(){
window.dataLayer.push(arguments);
}
window.gtag = gtag;

// Default ad_storage to 'denied'.
gtag('consent', 'default', {
'analytics_storage': 'denied',
'ad_storage': 'denied'
});

window.dataLayer.push({
siteName: 'weathermap',
siteEnvironment: "production",
siteCountry: "FR",
siteLanguage: "fr-FR",
});

</script>

<!-- Google Tag Manager -->
<script async id="gtmScript" data-nonce="034347eb6506ee2196d9ed9baeb05f355f16e2ddfbe0c1e2ae1d1e5f581cdb61" nonce="034347eb6506ee2196d9ed9baeb05f355f16e2ddfbe0c1e2ae1d1e5f581cdb61">(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;var n=d.querySelector('[nonce]');
n&&j.setAttribute('nonce',n.nonce||n.getAttribute('nonce'));f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer', 'GTM-K3NSQW7');</script>

<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.9.1/mapbox-gl.css' rel='stylesheet'/>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.9.1/mapbox-gl.js'></script>
<script src="https://unpkg.com/@mapbox/[email protected]/umd/mapbox-sdk.min.js"></script>

<script src="/dist/js/vendors.d3819c22be25320cdad1.js"></script><script src="/dist/js/app.d3819c22be25320cdad1.js"></script><link rel="stylesheet" href="/dist/css/app.d3819c22be25320cdad1.css"/>
<style>
body { margin:0; padding:0; }
.map { position:absolute; top:0; bottom:0; width:100%; }
</style>

<base href="/">
</head>

<body ng-app="app" ng-strict-di id="ng-app">

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K3NSQW7"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

<div ng-view></div>

<!--Cookie Consent -->
<script nonce="034347eb6506ee2196d9ed9baeb05f355f16e2ddfbe0c1e2ae1d1e5f581cdb61" id="cookie-consent-js" type="text/javascript" data-legals-url="https://legals.netatmo.com/" src="https://legals.netatmo.com/standalone/cookie-consent.js"></script>
</body>
</html>
4 changes: 0 additions & 4 deletions spec/healthcheck-it.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ describe('Healthcheck', () => {
app = new Server({
verbose: false,
port: 0,
clientId: '',
clientSecret: '',
username: '',
password: '',
latitude: 1,
longitude: 2,
distance: 3
Expand Down
Loading