From 75b14e6f380c393823067881007a0524aaabc5e3 Mon Sep 17 00:00:00 2001 From: Andreas Sumerauer Date: Mon, 3 Dec 2018 11:16:23 +0100 Subject: [PATCH 1/5] a dedicated file for the api key --- lib/api/api_key.dart | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 lib/api/api_key.dart diff --git a/lib/api/api_key.dart b/lib/api/api_key.dart new file mode 100644 index 0000000..87d4cae --- /dev/null +++ b/lib/api/api_key.dart @@ -0,0 +1,6 @@ +const String myTmdbApiKey = 'put your api key here'; + +// the api read access token is not required for this app to run. +// I am including it anyway because it is delivered together with the key +// and might be of use later on. +const String myTmdbApiReadAccessToken ='put the api read acces token here'; \ No newline at end of file From d0bdaeec4bfa3b1358f33a4784d849413f6bdd52 Mon Sep 17 00:00:00 2001 From: Andreas Sumerauer Date: Mon, 3 Dec 2018 11:20:47 +0100 Subject: [PATCH 2/5] a dedicated file for the api key --- lib/api/tmdb_api.dart | 8 +++++--- lib/api/{api_key.dart => tmdb_api_key.dart} | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) rename lib/api/{api_key.dart => tmdb_api_key.dart} (57%) diff --git a/lib/api/tmdb_api.dart b/lib/api/tmdb_api.dart index 5d5c20e..5b5c396 100644 --- a/lib/api/tmdb_api.dart +++ b/lib/api/tmdb_api.dart @@ -1,7 +1,10 @@ + + import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:movies_streams/api/tmdb_api_key.dart'; import 'package:movies_streams/models/movie_genres_list.dart'; import 'package:movies_streams/models/movie_page_result.dart'; @@ -12,7 +15,6 @@ import 'package:movies_streams/models/movie_page_result.dart'; /// class TmdbApi { - static const String TMDB_API_KEY = "PUT YOUR KEY, HERE"; static const String baseUrl = 'api.themoviedb.org'; final String imageBaseUrl = 'http://image.tmdb.org/t/p/w185/'; final _httpClient = new HttpClient(); @@ -29,7 +31,7 @@ class TmdbApi { baseUrl, '3/discover/$type', { - 'api_key': TMDB_API_KEY, + 'api_key': tmdbApiKey, 'language': 'en-US', 'sort_by': 'popularity.desc', 'include_adult': 'false', @@ -58,7 +60,7 @@ class TmdbApi { baseUrl, '3/genre/$type/list', { - 'api_key': TMDB_API_KEY, + 'api_key': tmdbApiKey, 'language': 'en-US', }, ); diff --git a/lib/api/api_key.dart b/lib/api/tmdb_api_key.dart similarity index 57% rename from lib/api/api_key.dart rename to lib/api/tmdb_api_key.dart index 87d4cae..0a0deb1 100644 --- a/lib/api/api_key.dart +++ b/lib/api/tmdb_api_key.dart @@ -1,6 +1,6 @@ -const String myTmdbApiKey = 'put your api key here'; +const String tmdbApiKey = 'put your api key here'; // the api read access token is not required for this app to run. // I am including it anyway because it is delivered together with the key // and might be of use later on. -const String myTmdbApiReadAccessToken ='put the api read acces token here'; \ No newline at end of file +const String tmdbApiReadAccessToken ='put the api read acces token here'; \ No newline at end of file From a561dc71e68e9209d315d7d4b75fa26902bf486b Mon Sep 17 00:00:00 2001 From: Andreas Sumerauer Date: Mon, 3 Dec 2018 11:22:33 +0100 Subject: [PATCH 3/5] updated gradle and build sdk --- android/app/build.gradle | 4 ++-- android/build.gradle | 2 +- android/gradle/wrapper/gradle-wrapper.properties | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5ab2655..e5b3e5f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -15,7 +15,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 27 + compileSdkVersion 28 lintOptions { disable 'InvalidPackage' @@ -25,7 +25,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.moviesstreams" minSdkVersion 16 - targetSdkVersion 27 + targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/android/build.gradle b/android/build.gradle index 4476887..bb8a303 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.2.1' } } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index aa901e1..bae5290 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip From 9925c15890b4a301bc5784bd1a42faa41eccab6e Mon Sep 17 00:00:00 2001 From: Andreas Sumerauer Date: Mon, 3 Dec 2018 11:46:21 +0100 Subject: [PATCH 4/5] Update tmdb_api_key.dart --- lib/api/tmdb_api_key.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/api/tmdb_api_key.dart b/lib/api/tmdb_api_key.dart index 0a0deb1..471231a 100644 --- a/lib/api/tmdb_api_key.dart +++ b/lib/api/tmdb_api_key.dart @@ -1,6 +1,13 @@ +// If you a hosting a fork of the app repository on any public server +// you are advised to remove this file from the repository after +// adding the secret key. +// to do this run: +// git rm --cached lib/api/tmdb_api_key.dart +// git commit -m 'removed secret api key from repository' -o lib/api/tmdb_api_key.dart + const String tmdbApiKey = 'put your api key here'; // the api read access token is not required for this app to run. // I am including it anyway because it is delivered together with the key // and might be of use later on. -const String tmdbApiReadAccessToken ='put the api read acces token here'; \ No newline at end of file +const String tmdbApiReadAccessToken ='put the api read acces token here'; From 862bc746f59b7d3f567937ec951c528d4a9f01b2 Mon Sep 17 00:00:00 2001 From: Andreas Sumerauer Date: Mon, 3 Dec 2018 11:49:45 +0100 Subject: [PATCH 5/5] improved security recommandation --- lib/api/tmdb_api_key.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/api/tmdb_api_key.dart b/lib/api/tmdb_api_key.dart index 471231a..b441d50 100644 --- a/lib/api/tmdb_api_key.dart +++ b/lib/api/tmdb_api_key.dart @@ -1,6 +1,6 @@ // If you a hosting a fork of the app repository on any public server -// you are advised to remove this file from the repository after -// adding the secret key. +// you are advised to remove this file from the repository before +// adding the secret api key. // to do this run: // git rm --cached lib/api/tmdb_api_key.dart // git commit -m 'removed secret api key from repository' -o lib/api/tmdb_api_key.dart