🚧 Ajoute les nouvelles pages
This commit is contained in:
parent
5173017624
commit
8c48c8daa3
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Laravel\Lumen\Routing\Controller as BaseController;
|
|
||||||
|
|
||||||
class Controller extends BaseController
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
class ExampleController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create a new controller instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
|
@ -3,12 +3,49 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
|
||||||
|
use App\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Laravel\Lumen\Routing\Controller as BaseController;
|
||||||
|
|
||||||
class HomeController extends Controller
|
class HomeController extends BaseController
|
||||||
{
|
{
|
||||||
public function home(Request $request)
|
public function home(Request $request)
|
||||||
{
|
{
|
||||||
return view('home');
|
return view('home');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function iframe(Request $request)
|
||||||
|
{
|
||||||
|
$user = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$errors = [];
|
||||||
|
$data = $this->validate($request, [
|
||||||
|
'email' => 'required|email|unique:users'
|
||||||
|
]);
|
||||||
|
|
||||||
|
$token = bin2hex(random_bytes(72));
|
||||||
|
|
||||||
|
$user = new User(['email' => $data['email']]);
|
||||||
|
$user->token = $token;
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
return view('registered', [
|
||||||
|
'user' => $user,
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (ValidationException $e) {
|
||||||
|
$errors = $e->errors();
|
||||||
|
$data = [];
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$errors = ['email' => 'Impossible de générer le token'];
|
||||||
|
$data = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('registration', [
|
||||||
|
'data' => $data,
|
||||||
|
'errors' => $errors
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,13 +1,5 @@
|
|||||||
@extends('layouts.app')
|
@extends('layouts.app')
|
||||||
|
|
||||||
@section('title', 'Page Title')
|
|
||||||
|
|
||||||
@section('sidebar')
|
|
||||||
@parent
|
|
||||||
|
|
||||||
<p>This is appended to the master sidebar.</p>
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<p>This is my body content.</p>
|
@include('registration')
|
||||||
@endsection
|
@endsection
|
@ -1,16 +1,101 @@
|
|||||||
<!-- Stored in resources/views/layouts/app.blade.php -->
|
<!doctype html>
|
||||||
|
<html lang="en" class="no-js">
|
||||||
<html>
|
|
||||||
<head>
|
<head>
|
||||||
<title>App Name - @yield('title')</title>
|
<meta charset="utf-8">
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
@section('sidebar')
|
|
||||||
This is the master sidebar.
|
|
||||||
@show
|
|
||||||
|
|
||||||
<div class="container">
|
<!-- www.phpied.com/conditional-comments-block-downloads/ -->
|
||||||
|
<!--[if IE]><![endif]-->
|
||||||
|
|
||||||
|
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
||||||
|
Remove this if you use the .htaccess -->
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
|
||||||
|
<title>Shikiryu - Read Later by Email Bookmarklet</title>
|
||||||
|
<meta name="description" content="This site will generate a bookmarklet sending an email with things to read later">
|
||||||
|
<meta name="author" content="Clément Desmidt - Shikiryu">
|
||||||
|
|
||||||
|
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
|
||||||
|
<meta name="viewport" content="width=device-width; initial-scale=1.0">
|
||||||
|
|
||||||
|
<!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
|
||||||
|
<link rel="shortcut icon" href="favicon.ico">
|
||||||
|
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
||||||
|
|
||||||
|
<!-- For the less-enabled mobile browsers like Opera Mini -->
|
||||||
|
<link rel="stylesheet" media="handheld" href="css/handheld.css?v=1">
|
||||||
|
|
||||||
|
<!-- CSS : implied media="all" -->
|
||||||
|
<link rel="stylesheet" href="css/style.css?v=1">
|
||||||
|
<!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
|
||||||
|
<script src="js/modernizr-1.5.min.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
|
||||||
|
|
||||||
|
<!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
|
||||||
|
<!--[if IE 7 ]> <body class="ie7"> <![endif]-->
|
||||||
|
<!--[if IE 8 ]> <body class="ie8"> <![endif]-->
|
||||||
|
<!--[if IE 9 ]> <body class="ie9"> <![endif]-->
|
||||||
|
<!--[if (gt IE 9)|!(IE)]><!--> <body> <!--<![endif]-->
|
||||||
|
|
||||||
|
<div id="container" class="container">
|
||||||
|
<header>
|
||||||
|
<a href="/"><img src="apple-touch-icon.png"/></a>
|
||||||
|
<h1>Welcome to the Read Later by Email Bookmarklet Generator</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div id="main">
|
||||||
@yield('content')
|
@yield('content')
|
||||||
|
<br/>
|
||||||
|
<div class="english">
|
||||||
|
<h2>What's a bookmarklet???</h2>
|
||||||
|
<div><p>A bookmarklet is a small javascript shortcut you can put in your bookmark toolbar and will <strong>improve your surfing experience</strong></p></div>
|
||||||
|
<h2>What's the "Read Later by Email Bookmarklet"?</h2>
|
||||||
|
<div><p><strong>This bookmarklet, once clicked, will send you an e-mail with the title and the link of the current page you're viewing.</strong><br/>
|
||||||
|
In summary, it's a reminder, a time saver.</p>
|
||||||
</div>
|
</div>
|
||||||
|
<h2>How to use it?</h2>
|
||||||
|
<div><p>
|
||||||
|
To use it, put your email into the field up this text and generate your personal link. Once generated, drag and drop the link into your bookmark.<br/>
|
||||||
|
While you're on a page you want to read later, click it. A message should tell you if the mail is sent or if there was an error. In the first case, you can close the page! Easy.<br/>
|
||||||
|
In the second case, you should <a href="//shikiryu.com/contact/">email me</a> with the error you got. I'll answer you as soon as possible! I promise!</p></div>
|
||||||
|
<h2>Why should I use it?</h2>
|
||||||
|
<div><p>So many examples. For example, I use it for 3 things : <br/> 1. My own little <a href="//www.delicious.com/">delicious</a> in my mail.<br/> 2. To have access to a page I wanted to read at work but had no time for that atm.<br/> 3. To forward page I liked to my friends or family.<br/><br/> I'm sure there's more use to it ;)</p></div>
|
||||||
|
<h2>Is my privacy safe?</h2>
|
||||||
|
<div><p>Short answer : yes and... no. <strong>This service does store your email for security reasons but never use your email otherwise!</strong> It just generate the bookmarklet dynamically with the given email. Anyway, there are checks to make sure no abuse is done with the service and you can <a href="//shikiryu.com/contact/">contact me</a> if you need your email to be blacklisted.<br/><br/>So, what's not safe? Any body who have access to your browser can have access to your email if they check the bookmarklet code. Therefor, don't use it in a cyber cafe for example. :)</p></div>
|
||||||
|
</div>
|
||||||
|
<hr/>
|
||||||
|
<div class="french">
|
||||||
|
<h2>Un bookmarklet ? C'est quoi ?</h2>
|
||||||
|
<div><p>Un bookmarklet est un petit bout de javascript qu'on peut placer dans sa barre de raccourci et permet d'<strong>améliorer le surf sur internet grâce à de petites améliorations</strong></p></div>
|
||||||
|
<h2>Et celui-ci, il fait quoi ?</h2>
|
||||||
|
<div><p><strong>Ce bookmarklet, une fois cliqué, envoie un email avec le titre et le lien de la page courante à l'adresse que vous lui indiquez préalablement.</strong><br/>
|
||||||
|
En résumé, c'est un pense-bête, il fait gagner du temps.</p>
|
||||||
|
</div>
|
||||||
|
<h2>Comment on l'utilise ?</h2>
|
||||||
|
<div><p>
|
||||||
|
Pour se faire, entrez votre email dans le champs ci-dessus et générer votre lien personnel. Une fois généré, glissez le dans votre barre de favoris.<br/>
|
||||||
|
Ceci réalisé, quand vous serez sur une page à lire plus tard ou à <i>favoriser</i>, cliquez-le. Un message devrait apparaître pour vous signaler si l'email est envoyé ou non. Dans le 1er cas, vous pouvez tout simplement fermer la page.<br/> Dans le 2nd cas, vous devriez <a href="//shikiryu.com/contact/">m'envoyer un email</a> en m'indiquant l'erreur occasionnée. Je vous répondrai le plus vite possible ! Promis !</p></div>
|
||||||
|
<h2>Pourquoi je devrais l'utiliser ?</h2>
|
||||||
|
<div><p>Tellement d'usages différents... Par exemple, je l'utilise pour 3 choses : <br/> 1. Mon propre petit <a href="//www.delicious.com/">delicious</a> dans mes mails.<br/> 2. Pour avoir accès à la page que j'aimerai tant lire au travail mais qu'il me manque le temps (maudites réunions !).<br/> 3. Pour transférer une page que j'aime à des amis ou à la famille plus tard.<br/><br/> Mais je suis sûr qu'il y a d'autres emplois possibles ;)</p></div>
|
||||||
|
<h2>Mes données restent confidentielles ?</h2>
|
||||||
|
<div><p>Réponse rapide : oui... et non. <strong>Ce service enregistre votre e-mail pour des raisons de sécurité (lisez la suite) mais n'utilise jamais votre adresse ! JAMAIS !</strong> Je déteste le spam. L'adresse est utilisée uniquement pour générer dynamiquement le bookmarklet unique pour celle-ci. Il y a parfois des vérifications pour la détection d'abus du service (spam sur une adresse, nombre d'utilisation abusive, etc.). Si vous êtes victime d'un abus, merci de <a href="//shikiryu.com/contact/">me contacter</a> afin que je mette votre email en liste noire.<br/><br/>Mais alors, pourquoi ce n'est pas confidentiel ? Simplement car toute personne ayant accès à votre navigateur web peut voir votre adresse email ou utiliser le bookmarklet frauduleusement. De ce fait, il est déconseillé de l'utiliser depuis un cyber café par exemple :)</p></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<a href="//shikiryu.com/">Clément Desmidt - Shikiryu</a> - <a href="//shikiryu.com/contact/">Contact</a> <span id="en-lang" class="tips" title="English"></span> <span id="fr-lang" class="tips" title="Français"></span> - <a href="https://git.shikiryu.com/Shikiryu/bookmarklet.shikiryu.com">Sources</a>
|
||||||
|
</footer>
|
||||||
|
</div> <!--! end of #container -->
|
||||||
|
|
||||||
|
<!-- Javascript at the bottom for fast page loading -->
|
||||||
|
<script src="js/jquery-1.4.2.min.js"></script>
|
||||||
|
<script src="js/plugins.js?v=1"></script>
|
||||||
|
|
||||||
|
<!--[if lt IE 7 ]>
|
||||||
|
<script src="js/dd_belatedpng.js?v=1"></script>
|
||||||
|
<![endif]-->
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
10
resources/views/registered.blade.php
Normal file
10
resources/views/registered.blade.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php if ($user instanceof \App\User) {
|
||||||
|
$token = $user->token; ?>
|
||||||
|
Votre token est le <?php echo $token; ?>
|
||||||
|
<?php
|
||||||
|
if (array_key_exists('html', $_POST) && $_POST['html'] === 'on') { // bookmarklet pour l'envoi en HTML
|
||||||
|
echo '<a href="javascript:void((function(){if(typeof(jQuery)!=\'function\'){var%20n=document.createElement(\'script\');n.setAttribute(\'src\',\'//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js\');document.getElementsByTagName(\'head\')[0].appendChild(n);}function%20v(){if(typeof(jQuery)==\'function\'){clearInterval(i);c();}}var%20i=window.setInterval(v,100);function%20c(){q=\'\';function%20gx(el){el=el.get(0);xp=\'\';for(;el&&el.nodeType==1;el=el.parentNode){id=jQuery(el.parentNode).children(el.tagName).index(el)+1;id>1?(id=\'[\'+id+\']\'):(id=\'\');xp=\'/\'+el.tagName.toLowerCase()+id+xp;}return%20xp;}jQuery(\'*\').bind(\'mouseenter\',function(){jQuery(\'*\').removeClass(\'shikihover\');jQuery(\'*\').css(\'border\',\'\');jQuery(this).css(\'border\',\'3px%20solid%20yellow\');jQuery(this).addClass(\'shikihover\');});jQuery(\'.shikihover\').live(\'click\',function(){jQuery(\'*\').unbind(\'mouseenter\').removeClass(\'shikihover\');jQuery(this).css(\'border\',\'\');var%20q=\'&q=\'+gx(jQuery(this)),d=document,t=d.title,f=\'//' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, -9) . '\',m=\'' . $token . '\',l=d.location,e=encodeURIComponent,p=\'?v=1&u=\'+e(l.href)+\'&t=\'+e(t)+\'&m=\'+e(m),u=f+p+q;newScript=d.createElement(\'script\');newScript.type=\'text/javascript\';newScript.src=u;d.body.appendChild(newScript);});}})())">Bookmark by email</a>';
|
||||||
|
} else { // bookmarklet pour l'envoi normal
|
||||||
|
echo "<a href='javascript:var%20d=document,t=d.title,f=\"//" . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, -9) . "\",m=\"" . $token . "\",l=d.location,e=encodeURIComponent,p=\"?v=1&u=\"+e(l.href)+\"&t=\"+e(t)+\"&m=\"+e(m),u=f+p;var%20ns=document.createElement(\"script\");ns.type=\"text/javascript\";ns.src=u;document.body.appendChild(ns);void(0)'>Bookmark by email</a>";
|
||||||
|
}
|
||||||
|
}
|
6
resources/views/registration.blade.php
Normal file
6
resources/views/registration.blade.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<form name="bookmarkletGenerator" action="<?php echo url('/register'); ?>" method="POST">
|
||||||
|
<input type="email" name="email" id="email" value="<?php echo $data['email'] ?? ''; ?>" placeholder="email@example.com" />
|
||||||
|
<?php echo isset($errors) && array_key_exists('email', $errors) ? implode(' | ', $errors['email']) : ''; ?>
|
||||||
|
<input type="checkbox" id="html" value="on" name="html" /><label for="html">Clip web page (experimental)</label>
|
||||||
|
<input type="submit" value="Generate!" id="submit"/>
|
||||||
|
</form>
|
@ -10,9 +10,11 @@
|
|||||||
| and give it the Closure to call when that URI is requested.
|
| and give it the Closure to call when that URI is requested.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
/** @var \Laravel\Lumen\Routing\Router $router */
|
||||||
$router->get('/', 'HomeController@home');
|
$router->get('/', 'HomeController@home');
|
||||||
|
|
||||||
|
$router->post('/register', 'HomeController@iframe');
|
||||||
|
|
||||||
$router->post('/api/{token}', function($token) {
|
$router->post('/api/{token}', function($token) {
|
||||||
|
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user