-
Notifications
You must be signed in to change notification settings - Fork 49
Adding Quotes to Sidebar #90
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
39cbb5d
daf3626
1486227
042f81d
9bdb2d1
6aa64fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,3 +113,6 @@ webnews/ | |
| webroster/ | ||
| ybook2003/ | ||
| yearbook/ | ||
|
|
||
| # Ignore Config File from git | ||
| data/config.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "quotefaultAPI": "keyherepls" | ||
| } | ||
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,16 @@ app.directive("meetings", function() { | |
| }; | ||
| }); | ||
|
|
||
| app.directive("quote", function() { | ||
| return { | ||
| restrict: "E", | ||
| templateUrl: "templates/quote.html", | ||
| scope: { | ||
| quote: "=data" | ||
| } | ||
| }; | ||
| }); | ||
|
|
||
| app.controller("MembersController", ['$scope', '$http', function($scope, $http) { | ||
|
|
||
| // Toggle showing the icons | ||
|
|
@@ -32,14 +42,26 @@ app.controller("MembersController", ['$scope', '$http', function($scope, $http) | |
| console.error("Error getting meetings.json"); | ||
| }); | ||
|
|
||
| // Get the quotes | ||
| $scope.quote = []; | ||
| $http.get("./data/config.json").success(function (response) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this pose a security vulnerability where I could visit https://members.csh.rit.edu/data/config.json and then read out your API information and gain access to use that API as your user?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking back I think this concern could be fairly dismissed since only people who would already have quotefault access would get to this point. The only route that would really lead to any questionable activity would be adding quotes, but if that ends up being a concern a good solution may be to add read-only keys to QuotefaultAPI (although I don't think we'll get to that point).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can likely add readonly keys, but yeah in the meantime I'm not really worried about people accessing the key. Also couldn't we do something with permissions around the file to protect it? I don't really know what other way to store the key that makes sense.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since you'd be trying to access the file from client-side JS you'd need to make the file readable over HTTP to authenticated clients. I think that designing a way for that file to be secure would require more effort than would be worth it for protecting a database of quotes. If you end up adding readonly keys I think that would be the simplest way to get a secure solution (from the perspective of someone with organization-level access accessing the API and mutating data through a key that 'anonymizes' them). I'm fine with this change if @mbillow and @stevenmirabito also agree that this concern isn't high enough priority to block adding in this feature. |
||
| $http.get("https://quotefault-api.csh.rit.edu/" + response['quotefaultAPI'] + "/random").success(function (response) { | ||
| $scope.quote = response; | ||
| }).error(function (error) { | ||
| console.error("Error getting quote from API"); | ||
| }); | ||
| }).error(function (error) { | ||
| console.error("Error getting config.json"); | ||
| }); | ||
|
|
||
| // Get all the links | ||
| $scope.sections = []; | ||
| $scope.popular = []; | ||
| $http.get("./data/links.json").success(function (response) { | ||
| $scope.sections = response; | ||
| // Find the popular links | ||
| for (var i = 0; i < $scope.sections.length; i++) { | ||
| var section = $scope.sections[i]; | ||
| var section = $scope.sections[i]; | ||
| for (var j = 0; j < section.links.length; j++ ) { | ||
| if (section.links[j].hasOwnProperty("popular")) { | ||
| $scope.popular.push(section.links[j]); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <div class="col-md-3 col-sm-12"> | ||
| <div class="panel panel-primary center"> | ||
| <div class="panel-heading"> | ||
| <div class="panel-title"> | ||
| <strong>Quotefault!</strong> | ||
| </div> | ||
| </div> | ||
| <div class="panel-body"> | ||
| <div class="row"> | ||
| <div class="row"> | ||
| <div class="col-md-12 col-sm-12 col-xs-12"> | ||
| <p>"{{ quote.quote }}"</p> | ||
| <p>- <b>{{ quote.speaker }}</b></p> | ||
| </div> | ||
| <hr/> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you have the file end with a newline? For reference on why this is important please visit: https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline