This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge branch 'develop'

  • Loading branch information...
jung35 committed Jan 5, 2016
2 parents ae4663c + 27a8910 commit 8039135c11077a61a624d66a70e66282659f360c
@@ -26,7 +26,7 @@ class Handler extends ExceptionHandler {
*/
public function report(Exception $e)
{
if ($e instanceof '\Illuminate\Session\TokenMismatchException') return;
if ($e instanceof \Illuminate\Session\TokenMismatchException) return;
return parent::report($e);
}
@@ -40,15 +40,15 @@ public function report(Exception $e)
*/
public function render($request, Exception $e)
{
$this->recordLog($e, '\Illuminate\Session\TokenMismatchException', function($e) {
$this->recordLog($e, \Illuminate\Session\TokenMismatchException, function($e) {
return [
'url' => $request->url(),
'inputs' => $request->all(),
'auth' => Auth::check() ? Auth::user()->id : null
];
});
$this->recordLog($e, '\GuzzleHttp\Exception\TransferException', function($e) {
$this->recordLog($e, \GuzzleHttp\Exception\TransferException, function($e) {
return [
'request' => $e->getRequest(),
'response' => $e->hasResponse() ? $e->getResponse() : null
@@ -49,14 +49,16 @@ class CustomListController extends Controller
'user_save_error' => 'There was an error trying to add user to list.',
'user_delete_error' => 'There was an error trying to remove user from list.',
'search_invalid' => 'Invalid search option.',
'forbidden' => 'You do not have permission.',
'404' => 'Invalid list.',
];
public function get(UserList $userList)
{
if(!isset($userList->id)) return ['error' => '404'];
if(!isset($userList->id)) return $this->error('404');
$customList = new CustomList($userList);
if($customList->error()) return $customList->error();
if($customList->error()) return $this->error($customList->error());
return $customList->getCustomList();
}
@@ -145,7 +147,7 @@ public function addProfileToList()
$userList = UserList::where('id', $input['list_id'])->first();
if(Auth::user()->id !== $userList->user_id) return $this->error('invalid_user');
if(Auth::user()->id !== $userList->user_id) return $this->error('forbidden');
$userListProfile = UserListProfile::where('user_list_id', (int) $input['list_id'])->get();
@@ -178,7 +180,7 @@ public function deleteProfileFromList()
$input = Input::all();
$userList = UserList::where('id', $input['list_id'])->first();
if(Auth::user()->id !== $userList->user_id) return $this->error('invalid_user');
if(Auth::user()->id !== $userList->user_id) return $this->error('forbidden');
$userListProfile = UserListProfile::where('user_list_id', $input['list_id'])
->where('profile_id', $input['profile_id'])
@@ -198,7 +200,7 @@ public function addManyProfilesToList()
$listId = (int) $input['list_id'];
$userList = UserList::where('id', $listId)->first();
if(Auth::user()->id !== $userList->user_id) return $this->error('invalid_user');
if(Auth::user()->id !== $userList->user_id) return $this->error('forbidden');
$smallIds = $this->findValidProfiles(Steam::parseSearch($input['search']));
if(isset($smallIds['error'])) return $smallIds;
@@ -0,0 +1,22 @@
<?php
namespace VacStatus\Http\Controllers\APIv1\Lists;
use VacStatus\Http\Controllers\Controller;
use VacStatus\Update\Friends;
class FriendsController extends Controller
{
public function get()
{
$friends = new Friends;
$return = [
'list_info' => [ 'title' => 'Friends' ],
'profiles' => $friends->getList()
];
return $return;
}
}
@@ -39,9 +39,8 @@ public function handle($request, Closure $next)
{
if ($this->auth->guest())
{
$thisRoute = explode('/', $request->route()->getURI());
if($thisRoute[0] == 'api')
$thisRoute = explode('/', $request->route()->getURI())[0];
if($thisRoute == 'api')
{
if(Input::has('_key'))
{
@@ -50,7 +49,7 @@ public function handle($request, Closure $next)
if(isset($user->id)) return $next($request);
}
return Response()->json(['error' => 'forbidden'], 403);
return Response()->json(['error' => 'Please Login'], 403);
}
return redirect()->guest('auth/login');
View
@@ -36,10 +36,11 @@
get('/latest', [ 'uses' => 'LatestTrackedController@get' ]);
get('/latest/vac', [ 'uses' => 'LatestVACBannedController@get' ]);
get('/latest/game', [ 'uses' => 'LatestGameBannedController@get' ]);
get('/{userList}', [ 'uses' => 'CustomListController@get' ]);
Route::group(['middleware' => 'auth'], function()
{
get('/friends', [ 'uses' => 'FriendsController@get' ]);
Route::any('/add/many', [ 'uses' => 'CustomListController@addManyProfilesToList' ]);
post('/add', [ 'uses' => 'CustomListController@addProfileToList' ]);
@@ -49,6 +50,8 @@
delete('/delete', [ 'uses' => 'CustomListController@deleteProfileFromList' ]);
delete('/{userList}', [ 'uses' => 'CustomListController@delete' ]);
});
get('/{userList}', [ 'uses' => 'CustomListController@get' ]);
});
/**
@@ -21,7 +21,7 @@ function __construct($userList)
{
if(!isset($userList->id))
{
$this->error = "list_invalid";
$this->error = "404";
return;
}
@@ -36,14 +36,14 @@ function __construct($userList)
$listAuthor = User::whereId($userList->user_id)->first();
if(($listAuthor->exists() && !empty($userFriends) && !in_array($listAuthor->small_id, $userFriends) && $userList->privacy == 2) || $userList->privacy == 3)
{
$this->error = "list_no_permission";
$this->error = "forbidden";
return;
}
}
} else if($userList->privacy == 2 || $userList->privacy == 3)
{
$this->error = "list_no_permission";
$this->error = "forbidden";
return;
}
@@ -52,7 +52,7 @@ function __construct($userList)
public function error()
{
return is_null($this->error) ? false : ['error' => $this->error];
return is_null($this->error) ? false : $this->error;
}
public function myList()
View
@@ -0,0 +1,29 @@
<?php
namespace VacStatus\Update;
use VacStatus\Models\UserListProfile;
use Auth;
class Friends extends MostTracked
{
function __construct()
{
$this->cacheLength = 30;
$this->user = Auth::user();
$this->cacheName = "friends_{$this->user->id}";
}
protected function grabFromDB()
{
$friendsList = json_decode($this->user->friendslist);
$tempProfile = array_map(function($smallId) {
return ['small_id' => $smallId];
}, $friendsList);
$multiProfile = new MultiProfile($tempProfile);
return $multiProfile->run();
}
}
View
@@ -18,7 +18,7 @@ gulp.task('less', function () {
.pipe(gulp.dest('public/css'));
});
gulp.task('watch', function() {
gulp.task('watch', ['scripts', 'less'], function() {
gulp.watch('resources/assets/js/**/*.js', ['scripts']);
gulp.watch('resources/assets/less/**/*.less', ['less']);
});
@@ -43,13 +43,24 @@ export default class List extends BasicComp {
url: url,
dataType: 'json',
success: (data) => {
if(data.error)
{
let errorMessage = data.error;
$('.table-responsive').find('tbody td').html('<strong><em class="text-danger">Error: '+ errorMessage +'</em></strong>');
this.notify.error(errorMessage).run();
return;
}
this.setState($.extend({}, this.state, data));
this.profiles = data.profiles;
if(this.props.updateCurrentList !== undefined)
{
this.props.updateCurrentList(data.list_info);
}
if(this.props.updateCurrentList !== undefined) this.props.updateCurrentList(data.list_info);
},
error: (jqXHR, textStatus, errorThrown) => {
let errorMessage = jqXHR.responseJSON.error;
$('.table-responsive').find('tbody td').html('<strong><em class="text-danger">Error: '+ errorMessage +'</em></strong>');
this.notify.error(errorThrown).run();
},
complete: () => {
delete this.request.fetchList;
@@ -130,12 +130,17 @@ export default class ListPortal extends BasicComp {
myList = this.renderMyList(this.state.my_list);
friendsList = this.renderFriendsList(this.state.friends_list);
let friends;
if(this.authCheck) friends = <Link to="/list/friends">Friends</Link>;
return (
<div id="listPortal" className="listPortal-page">
<div className="container">
<div className="row">
<div className="col-xs-12">
<div className="special-list">
{ friends }
<Link to="/list/most">Most Tracked Users</Link>
<Link to="/list/latest">Latest Added Users</Link>
<Link to="/list/latest/vac">Latest VAC Bans</Link>

0 comments on commit 8039135

Please sign in to comment.