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

completed es6 upgrade. now to test

  • Loading branch information...
jung35 committed Oct 19, 2015
1 parent 4ff1e25 commit f8097e0a51dd8b80fbc485957e333e4785958cf7
Showing with 618 additions and 885 deletions.
  1. +2 −0 .env.example
  2. +1 −0 app/Http/Controllers/APIv1/Lists/CustomListController.php
  3. +36 −14 app/Http/Controllers/APIv1/SettingsController.php
  4. +0 −41 app/Http/Controllers/SettingsController.php
  5. +14 −14 app/Http/Middleware/Authenticate.php
  6. +2 −32 app/Http/routes.php
  7. +9 −18 gulpfile.js
  8. +1 −0 package.json
  9. +5 −1 resources/assets/js/Notify.js
  10. +5 −1 resources/assets/js/Router.js
  11. +19 −0 resources/assets/js/pages/Contact.js
  12. +245 −0 resources/assets/js/pages/Settings/Subscription.js
  13. +71 −0 resources/assets/js/pages/Settings/UserKey.js
  14. +22 −0 resources/assets/js/pages/Settings/index.js
  15. +163 −177 resources/assets/js/pages/donate.js
  16. +6 −1 resources/assets/js/pages/index.js
  17. +0 −239 resources/assets/js/settings/subscription.js
  18. +0 −83 resources/assets/js/settings/userKey.js
  19. +1 −2 resources/assets/less/app.less
  20. +7 −6 resources/assets/less/main.less
  21. +3 −1 resources/assets/less/pages/pages.less
  22. 0 resources/assets/less/{ → pages}/settings/pages.less
  23. 0 resources/assets/less/{ → pages}/settings/subscription.less
  24. 0 resources/assets/less/{ → pages}/settings/userKey.less
  25. 0 resources/views/{layout → }/app.blade.php
  26. +1 −1 resources/views/emails/verification.blade.php
  27. +1 −1 resources/views/errors/404.blade.php
  28. +4 −4 resources/views/errors/503.blade.php
  29. +0 −13 resources/views/pages/contact.blade.php
  30. +0 −6 resources/views/pages/donate.blade.php
  31. +0 −161 resources/views/pages/home.blade.php
  32. +0 −5 resources/views/pages/list.blade.php
  33. +0 −5 resources/views/pages/listPortal.blade.php
  34. +0 −7 resources/views/pages/news.blade.php
  35. +0 −36 resources/views/pages/privacy.blade.php
  36. +0 −16 resources/views/pages/profile.blade.php
View
@@ -2,6 +2,8 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString
# Don't end in /
APP_URL=https://vacstat.us
STEAM_API=
PUSHBULLET_API=
@@ -12,6 +12,7 @@
use VacStatus\Update\MultiProfile;
use VacStatus\Steam\Steam;
use VacStatus\Steam\SteamUser;
use Auth;
use DB;
@@ -44,9 +44,9 @@ public function subscribeIndex()
return compact('userMail', 'userLists');
}
public function makeSubscription(Request $request)
public function makeSubscription()
{
if($request->input('_key')) return ['error' => 'forbidden'];
if(Input::has('_key')) return ['error' => 'forbidden'];
$email = Input::get('email');
$pushBullet = Input::get('push_bullet');
@@ -104,20 +104,21 @@ public function makeSubscription(Request $request)
if(!$userMail->save()) return ['error' => 'There was an error trying to save the emails'];
foreach($sendVerificationTo as $email) {
$appURL = env('APP_URL');
foreach($sendVerificationTo as $data) {
Mail::send('emails.verification', [
'email' => $email
], function($message) use ($email) {
$message->to($email['email'])->subject('Thank you for subscribing!');
'url' => "$appURL/settings/" . $data['email'] . "/" . $data['verify'],
], function($message) use ($data) {
$message->to($data['email'])->subject('Thank you for subscribing!');
});
}
return $this->subscribeIndex();
}
public function deleteEmail(Request $request)
public function deleteEmail()
{
if($request->input('_key')) return ['error' => 'forbidden'];
if(Input::has('_key')) return ['error' => 'forbidden'];
$user = Auth::user();
$userMail = $user->UserMail;
@@ -130,9 +131,9 @@ public function deleteEmail(Request $request)
return $this->subscribeIndex();
}
public function deletePushBullet(Request $request)
public function deletePushBullet()
{
if($request->input('_key')) return ['error' => 'forbidden'];
if(Input::has('_key')) return ['error' => 'forbidden'];
$user = Auth::user();
$userMail = $user->UserMail;
@@ -149,12 +150,12 @@ public function showUserKey()
{
$user = Auth::user();
return [$user->user_key];
return ['key' => $user->user_key];
}
public function newUserKey(Request $request)
public function newUserKey()
{
if($request->input('_key')) return ['error' => 'forbidden'];
if(Input::has('_key')) return ['error' => 'forbidden'];
$user = Auth::user();
@@ -169,6 +170,27 @@ public function newUserKey(Request $request)
}
}
return [$user->user_key];
return ['key' => $user->user_key];
}
public function subscriptionVerify($email, $code)
{
$userMail = UserMail::whereRaw('(email = ? and verify = ?) or (pushbullet = ? and pushbullet_verify = ?)', [
$email, $code, $email, $code
])->first();
if(!isset($userMail->id)) return 'error';
if($userMail->email == $email && $userMail->verify == $code)
{
$userMail->verify = "verified";
}
else if($userMail->pushbullet == $email && $userMail->pushbullet_verify == $code)
{
$userMail->pushbullet_verify = "verified";
}
$userMail->save();
return 'success';
}
}
@@ -1,41 +0,0 @@
<?php namespace VacStatus\Http\Controllers;
use VacStatus\Http\Requests;
use VacStatus\Http\Controllers\Controller;
use VacStatus\Models\UserMail;
use Auth;
class SettingsController extends Controller
{
public function subscriptionPage()
{
return view('settings/settings');
}
public function subscriptionVerify($email, $verifyKey)
{
$userMail = UserMail::whereRaw('(email = ? and verify = ?) or (pushbullet = ? and pushbullet_verify = ?)', [
$email, $verifyKey, $email, $verifyKey
])->first();
if(!isset($userMail->id))
{
if(Auth::check()) return redirect()->route('settings');
return redirect()->intended('/');
}
if($userMail->email == $email && $userMail->verify == $verifyKey)
{
$userMail->verify = "verified";
} else if($userMail->pushbullet == $email && $userMail->pushbullet_verify == $verifyKey)
{
$userMail->pushbullet_verify = "verified";
}
$userMail->save();
if(Auth::check()) return redirect()->route('settings');
return redirect()->intended('/');
}
}
@@ -6,6 +6,8 @@
use Illuminate\Contracts\Auth\Guard;
use VacStatus\Models\User;
use Input;
class Authenticate {
/**
@@ -37,24 +39,22 @@ public function handle($request, Closure $next)
{
if ($this->auth->guest())
{
if ($request->ajax()) return response('Unauthorized.', 401);
else {
$thisRoute = explode('.', $request->route()->getName());
if($thisRoute[0] == 'api')
$thisRoute = explode('/', $request->route()->getURI());
if($thisRoute[0] == 'api')
{
if(Input::has('_key'))
{
$userKey = $request->input('_key');
if($userKey && !empty($userKey))
{
$user = User::where('user_key', $userKey)->first();
if(isset($user->id)) return $next($request);
}
return ['error' => 'forbidden'];
$user = User::where('user_key', Input::get('_key'))->first();
if(isset($user->id)) return $next($request);
}
return redirect()->guest('auth/login');
return Response()->json(['error' => 'forbidden'], 403);
}
}
return redirect()->guest('auth/login');
}
return $next($request);
}
View
@@ -1,7 +1,5 @@
<?php
get('/', function() { return view('pages.home'); });
post('/search', [ 'as' => 'search', 'uses' => 'DisplayController@searchPage' ]);
Route::group(['prefix' => 'auth'], function()
@@ -11,35 +9,6 @@
get('/logout', [ 'middleware' => 'auth', 'as' => 'auth.logout', 'uses' => 'LoginController@logout' ]);
});
// Route::group(['prefix' => 'list'], function()
// {
// get('/', [ 'as' => 'list.list', 'uses' => 'PagesController@listListPage' ]);
// get('/most', [ 'as' => 'tracked.most', 'uses' => 'PagesController@mostTrackedPage' ]);
// Route::group(['prefix' => 'latest'], function()
// {
// get('/', [ 'as' => 'tracked.latest', 'uses' => 'PagesController@latestTrackedPage' ]);
// get('/vac', [ 'as' => 'tracked.latest.vac', 'uses' => 'PagesController@latestVACPage' ]);
// get('/game', [ 'as' => 'tracked.latest.game', 'uses' => 'PagesController@latestGameBanPage' ]);
// });
// get('/{listId}', [ 'as' => 'tracked.custom', 'uses' => 'PagesController@customListPage' ]);
// });
// get('/u/{steamid}', [ 'as' => 'profile', 'uses' => 'PagesController@profilePage' ]);
// get('/news/{p?}', [ 'as' => 'news', 'uses' => 'PagesController@newsPage']);
// get('/privacy', [ 'as' => 'privacy', 'uses' => 'PagesController@privacyPage' ]);
// get('/contact', [ 'as' => 'contact', 'uses' => 'PagesController@contactPage' ]);
// get('/donate', [ 'as' => 'donate', 'uses' => 'PagesController@donatePage' ]);
// Route::group(['prefix' => 'settings'], function()
// {
// get('/', [ 'middleware' => 'auth', 'as' => 'settings', 'uses' => 'SettingsController@subscriptionPage' ]);
// get('/subscribe/{email}/{verify}', [ 'as' => 'settings.subscription.verify', 'uses' => 'SettingsController@subscriptionVerify' ]);
// });
/**
* API ROUTING STARTS HERE
*/
@@ -103,6 +72,7 @@
Route::group(['prefix' => 'subscribe'], function()
{
get('/', [ 'uses' => 'SettingsController@subscribeIndex' ]);
get('/{email}/{code}', [ 'uses' => 'SettingsController@subscriptionVerify' ]);
post('/', [ 'uses' => 'SettingsController@makeSubscription' ]);
delete('/email', [ 'uses' => 'SettingsController@deleteEmail' ]);
delete('/pushbullet', [ 'uses' => 'SettingsController@deletePushBullet' ]);
@@ -156,7 +126,7 @@
Route::model('news', 'VacStatus\Models\News', function() { return ['error' => '404']; });
Route::any('{undefinedRoute}', function ($undefinedRoute) {
return view('pages.home');
return view('app');
})->where('undefinedRoute', '([A-z\d-\/_.]+)?');
Event::listen('illuminate.query', function($query)
View
@@ -2,18 +2,7 @@ var gulp = require('gulp');
var browserify = require('browserify');
var babelify = require('babelify');
var source = require('vinyl-source-stream');
var scripts = [
'Notify.js',
'App.js',
'BasicComp.js',
'ListHandler.js',
'partials',
'pages',
'Router.js',
]
var less = require('gulp-less');
gulp.task('scripts', function() {
browserify('resources/assets/js/main.js')
@@ -23,13 +12,15 @@ gulp.task('scripts', function() {
.pipe(gulp.dest('public/js'))
});
gulp.task('less', function () {
return gulp.src('resources/assets/less/app.less')
.pipe(less())
.pipe(gulp.dest('public/css'));
});
gulp.task('watch', function() {
gulp.watch('resources/assets/js/**/*.js', ['scripts']);
gulp.watch('resources/assets/less/**/*.less', ['less']);
});
gulp.task('default', ['watch', 'scripts']);
// elixir(function(mix) {
// mix.less('app.less');
// mix.babel(scripts).browserify('all.js', null, 'public/js');
// });
gulp.task('default', ['watch', 'scripts', 'less']);
View
@@ -6,6 +6,7 @@
"browserify": "^11.2.0",
"es6-shim": "^0.33.6",
"gulp": "^3.8.8",
"gulp-less": "^3.0.3",
"history": "^1.9.1",
"react": "^0.13.3",
"react-router": "1.0.0-rc1",
@@ -21,6 +21,10 @@ export default class Notify {
return this.add('success', message);
}
warning(message) {
return this.add('warning', message);
}
danger(message) {
return this.add('danger', message);
}
@@ -54,7 +58,7 @@ export default class Notify {
}, 500, () =>
{
item.remove();
if(this.interval == 0 && typeof callback == 'function') {
if(this.interval === 0 && typeof callback === 'function') {
callback();
}
});
@@ -18,8 +18,12 @@ export default (
<Route path="list/*" component={ Pages.List }/>
<Route path="u/:steamId" component={ Pages.Profile }/>
<Route path="search/:searchId" component={ Pages.Search }/>
<Route path="donate" component={ Pages.Home }/>
<Route path="donate" component={ Pages.Donate }/>
<Route path="privacy" component={ Pages.Privacy }/>
<Route path="settings" component={ Pages.Settings }>
<Route path=":email/:code" component={ Pages.settings }/>
</Route>
<Route path="contact" component={ Pages.Contact }/>
</Route>
</Router>
);
@@ -0,0 +1,19 @@
'use strict';
import React from 'react';
import BasicComp from '../BasicComp';
export default class Contact extends BasicComp {
render() {
return (
<div className="container">
<div className="row">
<div className="col-xs-12">
<h1>Contact</h1>
<p>nope</p>
</div>
</div>
</div>
);
}
}
Oops, something went wrong.

0 comments on commit f8097e0

Please sign in to comment.