mirror of
https://github.com/brunofontes/shareit.git
synced 2025-12-13 03:00:47 -03:00
Compare commits
9 Commits
58fe265821
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
bb01401e0c
|
|||
|
3dddb712c0
|
|||
|
618d91d23b
|
|||
|
720da5a8d1
|
|||
|
3299047fb8
|
|||
|
df08525010
|
|||
|
6bc94d0ec8
|
|||
|
d083d45013
|
|||
|
3d5e484364
|
@@ -51,7 +51,7 @@ class Kernel extends HttpKernel
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
protected $middlewareAliases = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
|
||||
@@ -22,7 +22,6 @@ class AuthServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
"type": "project",
|
||||
"require": {
|
||||
"php": "^8.0.2",
|
||||
"inertiajs/inertia-laravel": "^0.6.3",
|
||||
"laravel/framework": "^9.19.0",
|
||||
"inertiajs/inertia-laravel": "^0.6.11",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/ui": "^4.0",
|
||||
"laravel/helpers": "^1.4",
|
||||
"laravel/tinker": "^2.4.1",
|
||||
"laravel/ui": "^3.0",
|
||||
"pusher/pusher-php-server": "^7.2"
|
||||
},
|
||||
"require-dev": {
|
||||
@@ -18,11 +18,11 @@
|
||||
"filp/whoops": "^2.0",
|
||||
"fzaninotto/faker": "^1.4",
|
||||
"mockery/mockery": "^1.0",
|
||||
"nunomaduro/collision": "^6.1",
|
||||
"nunomaduro/larastan": "^0.7.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
"nunomaduro/larastan": "^2.9.5",
|
||||
"nunomaduro/phpinsights": "*",
|
||||
"phpstan/phpstan": "^0.12.85",
|
||||
"phpunit/phpunit": "^9.0"
|
||||
"phpstan/phpstan": "^1.10.66",
|
||||
"phpunit/phpunit": "^10.0"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
@@ -64,6 +64,6 @@
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
||||
4561
composer.lock
generated
4561
composer.lock
generated
File diff suppressed because it is too large
Load Diff
4376
package-lock.json
generated
4376
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,5 +19,8 @@
|
||||
"sass": "^1.56.1",
|
||||
"sass-loader": "^8.0.2",
|
||||
"vite": "^3.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"moment": "^2.29.4"
|
||||
}
|
||||
}
|
||||
|
||||
35
public/build/assets/app.0299f74e.js
vendored
35
public/build/assets/app.0299f74e.js
vendored
File diff suppressed because one or more lines are too long
48
public/build/assets/app.4993c47e.js
vendored
Normal file
48
public/build/assets/app.4993c47e.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"resources/js/app.js": {
|
||||
"file": "assets/app.0299f74e.js",
|
||||
"file": "assets/app.4993c47e.js",
|
||||
"src": "resources/js/app.js",
|
||||
"isEntry": true
|
||||
},
|
||||
|
||||
BIN
public/favicon.png
Normal file
BIN
public/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
52
resources/js/app.js
vendored
52
resources/js/app.js
vendored
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import './bootstrap';
|
||||
import moment from "moment";
|
||||
|
||||
// window.Vue = require('vue');
|
||||
|
||||
@@ -20,3 +21,54 @@ import './bootstrap';
|
||||
// const app = new Vue({
|
||||
// el: '#app'
|
||||
// });
|
||||
|
||||
function updateTime() {
|
||||
var dates = document.getElementsByClassName("takenItemDate");
|
||||
for (let i = 0; i < dates.length; i++) {
|
||||
let time = dates.item(i).innerText;
|
||||
let fromNow = moment(time).fromNow();
|
||||
let id = "itemPassedTime_" + dates.item(i).id;
|
||||
document.getElementById(id).innerText = fromNow;
|
||||
}
|
||||
}
|
||||
updateTime();
|
||||
setInterval(updateTime, 1 * 60 * 1000);
|
||||
|
||||
|
||||
function setFaviconNumber(number) {
|
||||
var canvas = document.createElement('canvas'),
|
||||
ctx,
|
||||
img = document.createElement('img'),
|
||||
link = document.getElementById('favicon').cloneNode(true);
|
||||
|
||||
if (canvas.getContext) {
|
||||
canvas.height = canvas.width = 48; // set the size
|
||||
ctx = canvas.getContext('2d');
|
||||
img.onload = function () { // once the image has loaded
|
||||
ctx.drawImage(this, 0, 0);
|
||||
ctx.font = 'bold 35px "helvetica", sans-serif';
|
||||
ctx.fillStyle = '#ffff66';
|
||||
ctx.fillText(number, 3, 25);
|
||||
link.href = canvas.toDataURL('image/png');
|
||||
document.body.appendChild(link);
|
||||
};
|
||||
img.src = 'favicon.png';
|
||||
}
|
||||
};
|
||||
|
||||
usedItems = document.getElementById("usedItems").innerText;
|
||||
setFaviconNumber(usedItems);
|
||||
|
||||
/**
|
||||
* Source:
|
||||
* https://www.designcise.com/web/tutorial/how-to-detect-if-the-browser-tab-is-active-or-not-using-javascript
|
||||
*/
|
||||
document.addEventListener('visibilitychange', function (event) {
|
||||
if (document.hidden) {
|
||||
console.log('not visible');
|
||||
} else {
|
||||
updateTime();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@if ($item->used_by == \Auth::id())
|
||||
<form action="/take" method="POST" class="form-inline">
|
||||
<em class="pr-sm-2 ml-auto">{{\Carbon\Carbon::parse($item->updated_at)->diffForHumans()}}</em>
|
||||
<em id="itemPassedTime_{{$item->id}}" class="pr-sm-2 ml-auto">{{\Carbon\Carbon::parse($item->updated_at)->diffForHumans()}}</em>
|
||||
<div hidden class="takenItemDate" id="{{$item->id}}">{{\Carbon\Carbon::parse($item->updated_at)->format('Y-m-d\TH:i:s.uP')}}</div>
|
||||
<div class="w-100 d-xm-block d-sm-none"></div>
|
||||
{{ csrf_field() }}
|
||||
@method('DELETE')
|
||||
@@ -16,8 +17,9 @@
|
||||
@if ($item->waiting_user_id && $item->waiting_user_id != \Auth::id())
|
||||
<strong>> {{str_limit($users[$item->waiting_user_id], 15, '...')}}</strong>
|
||||
@endif
|
||||
<small>({{$item->updated_at->diffForHumans()}})</small>
|
||||
<small id="itemPassedTime_{{$item->id}}">({{$item->updated_at->diffForHumans()}})</small>
|
||||
</em>
|
||||
<div hidden class="takenItemDate" id="{{$item->id}}">{{$item->updated_at->format('Y-m-d\TH:i:s.uP')}}</div>
|
||||
<div class="w-100 d-xm-block d-sm-none"></div>
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="item" value="{{$item->id}}">
|
||||
@@ -28,4 +30,4 @@
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary ml-auto">@lang('home.alert_me')</button>
|
||||
@endif
|
||||
</form>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@@ -19,9 +19,12 @@
|
||||
|
||||
<!-- Styles -->
|
||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||
|
||||
<link id="favicon" rel="icon" type="image/png" href="favicon.png" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div hidden id="usedItems">{{ isset($usedItems) && $usedItems > 0 ? $usedItems : '' }}</div>
|
||||
<div id="app">
|
||||
<nav class="navbar navbar-expand-md navbar-light navbar-laravel">
|
||||
<div class="container">
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Share It</title>
|
||||
<link id="favicon" rel="icon" type="image/png" href="favicon.png" />
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet" type="text/css">
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
ssh homestead -t "cd code/Bruno\ Fontes/shareit; bash --login"
|
||||
echo "Homestead password is: vagrant"
|
||||
ssh homestead -t "cd shareit; bash --login"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/zsh
|
||||
export VAGRANT_CWD=/home/bruno/development/Homestead/
|
||||
vagrant up
|
||||
#builtin cd ~/development/laravelHomestead && /usr/bin/vagrant up && builtin cd -
|
||||
#~/Apps/firefox/firefox-bin http://shareit.test
|
||||
#~/Apps/firefox/firefox-bin https://mailtrap.io/inboxes/455614/messages
|
||||
eval $DEV_BROWSER http://shareit.test \
|
||||
https://mailtrap.io/inboxes/455614/messages \
|
||||
https://dashboard.pusher.com/apps/1505830/console \
|
||||
&
|
||||
|
||||
@@ -1 +1 @@
|
||||
ssh homestead -t 'cd shareit; php7.3 /usr/local/bin/composer update; npm update; echo; echo -n "Press enter to exit..."; read'
|
||||
ssh homestead -t 'cd shareit; /usr/local/bin/composer update; npm update; echo; echo -n "Press enter to exit..."; read'
|
||||
|
||||
Reference in New Issue
Block a user