themsaid / wink Goto Github PK
View Code? Open in Web Editor NEWA Laravel-based publishing platform
License: MIT License
A Laravel-based publishing platform
License: MIT License
Note: I don't have any experience with Wink yet, still planning on setting it up and playing with it later. That said, this is just based on looking over code here in the repo.
As the title suggests, in general I think it would be nice to not have Wink duplicate efforts for Users. In an application I've built with multiple user types/roles I had success with extending the base User class. I was thinking a similar approach may be beneficial here - especially for integrating Wink into Laravel applications with other User based features.
I know that this idea is no simple feat - as Wink would have to be aware (in some way) if it needs to provide a complete WinkAuthor
or an extended User
one based on the existing app. All the while maintaining the same relationships to this user class that WinkAuthor
currently has. I also know that this would be an easier task if Laravel had a more standardized 'stock' User.
So what are the thoughts about this concept, or going this direction?
I know that the editor uses Quill under the hood.
But the modifications are looking very very good, and i was wondering if and how this can be used as a stand-alone package for laravel for projects with less needs that wink is offering solutions to them.
Thanks.
Hello, and thanks for this great package.
I s there any built in way to configure wink(and all assets, not just editor) to use RTL?
Thanks.
When I clicked the settings button for the post, it had: 5e51cfe1-5cad-4d50-9ba1-7d12752522ca and I updated to 6-reasons-blah-blah and it keeps showing when I check the settings but it doesn't update in the URL, the URL stays 5e51cfe1-5cad-4d50-9ba1-7d12752522ca even after refreshing / updating the post.
How do you share posts/blog with the public? Is it just the URL to the page? Trying to go to "url.com/blog" just takes me to the login page. (I've updated the path in config/wink.php) Do I need to straight up make a controller to handle it? I thought that would all be built in.
Also, even after updating the path in config/wink.php when I logout, it uses the 'wink/logout' path, should it not update with the path as well?
I really really want to use this but don't want to think it's much further along than it is. Thanks for your hard work and I really think this could replace Ghost.
XSS are possible : add <a href="#" onclick="javascript:alert('XSS');return false;">XSS</a>
in a WinkPost
or WinkPage
body.
The only reason flat out script
tags arent run is because you always output the WinkPost
'body' in a Quill editor which protects you by default by not running those. If later we wants to use the WinkPost
model in another part of his app (public facing urls for example), everything would blow up.
It's usually not considered secure to let the frontend do the sanitization of WYSIWYG comming from database. I can easily bypass the quill editor and post anything to the backend using handcrafted requests. Using HTMLPurifier on output/json serialization/getBodyAttribute accessor would make this secure by default.
As of today, compromission of any account means potential compromission of all of those who would click a tampered link.
If XSS prevention is not something you want to cover, as it's usually a pain with WYSIWYG content, at the very least some clear disclaimer should be added to the readme.
I followed all the steps and generated all the tables for wink in the wink db. The table author has a default user with email: [email protected] but I cannot get the password in plain text as it is already hashed. How can I know the password?
Although I fully understand wink's philosophy of being something simple and intuitive, I would like to propose that assets be published directly in the project so that it can be adapted to any template for admin and that allows it to be extended to add specific functionalities to the needs of the person using this.
@themsaid I was thinking I can handle this feature of the Roadmap.
Before starting I would like to make a few questions:
Route::winkDefault()
? Once the package is installed, you just would need to add that line to your route files to load the default theme routesphp artisan wink:default-theme
or something like that to copy the assets (css mostly) to the public
folder? There will be no need on copying views since that can be loaded from package folder. Some place like public/vendor/wink/default.css
. Otherwise the default.css
can be created on current install
command.copying
your current theme on themsaid.com for now (without the top bar, and routes inside blog
just in case it's installed in a currently running app). Would that be appropriate? Simple & MinimalIt will be good to have ability to extend:
WinkAuthor
WinkPost
WinkPage
Ability to filter the images in the select box while selecting an avatar.
Priority: Low
changing
<input type="file" class="d-none" id="author_avatar" v-on:change="uploadSelectedImage">
to
<input type="file" class="d-none" id="author_avatar" accept="image/*" v-on:change="uploadSelectedImage">
Hello,
I'm thinking about sending a PR for built in comments system.
Is it okay to use a third party package actuallymab/laravel-comment
to pull in comments functionality or do we want to implement it from the scratch?
I have configured my env. file correctly and
DB_DATABASE=database
DB_USERNAME=root
DB_PASSWORD=
WINK_DB_CONNECTION=database
run php artisan config:cache & php artisan config:clear same results.
but when i run the command
php artisan migrate
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_10_30_000000_create_tables
Migrated: 2018_10_30_000000_create_tables
Migrating: 2018_11_16_000000_add_meta_fields
Migrated: 2018_11_16_000000_add_meta_fields
wink tables seems migrating. but when navigating to the wink route giving the same error?
For the dark theme,
Maybe a good idea to get the gravatar for the users email instead of random images.
I think this is a quick win.
https://github.com/writingink/wink/blob/3aedd04c6c66de79a231987319986798243225d9/src/WinkAuthor.php#L135
As the title suggests, it should be possible to pass --force to the command. My database migrations are taken care of by the deploy script that I use. So, if wink:migrate can also support that, it will also allow future wink migrations to be automatically executed when the package is updated.
I thought this would be a nice progression for this project, I'm typically finding that I want a category for a blog post and not just a list of tags
I understand that tags can be used in it's place
I've create a podcast and at the moment I'm being super lazy and manually adding each new episode. I'll be keen to give this a go and offer up feedback with anything where I had an issue. Each podcast is just an iframe with some show notes :)
Pinned posts would add a layer of post sorting when retrieving and displaying posts. The functionality would work much like a Pinned Tweet where the pinned post would display first in any list of posts in which it was retrieved.
Feature Requirements:
Questions Remaining
Should we only allow one pinned post? If so, when one is ready to mark a post as pinned and a pinned post already exists, do we automatically remove the previous pin? Or, do we alert the user and show the previously pinned post's title with the option to continue or cancel the pin override?
Should we allow multiple pins? If so, a Pinned Post view would be recommended for easier identification of pinned posts and easy unpinning.
Should we include a "pin_until" datetime field on the wink_posts table that allows the author to pin their post until a specific time?
Where to implement the Collection Marco? A service provider seems the appropriate place, but one would need to be added to the project and alter the installation instructions. Alternatively, it could be added directly to the WinkPost Model.
I'd be happy to implement this feature after some guidance on what would be the best route to implementation.
InvalidArgumentException : Database [winkdb] not configured.
at C:\xampp\htdocs\wink\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:140
136| // If the configuration doesn't exist, we'll throw an exception and bail.
137| $connections = $this->app['config']['database.connections'];
138|
139| if (is_null($config = Arr::get($connections, $name))) {
140| throw new InvalidArgumentException("Database [{$name}] not configured.");
141| }
142|
143| return $config;
144| }
Exception trace:
1 Illuminate\Database\DatabaseManager::configuration("winkdb")
C:\xampp\htdocs\wink\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:103
2 Illuminate\Database\DatabaseManager::makeConnection("winkdb")
C:\xampp\htdocs\wink\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:74
Please use the argument -v to see more details.
I had the yarn version 1.2.1 but when I upgraded it to the latest version It was unable to compile the assets due to an error with the node-sass. What I ended up doing was to delete the current yarn.lock
file and run yarn
and yarn run dev
again. Everything is working fine now. How should we proceed to with the yarn.lock
file now? Should we delete or commit a new yarn.lock
?
Do you have any plans to add tests for Wink? I couldn't find it on the roadmap 🙂
Getting "Could not open input file: artisan" after php artisan wink:install. I have other Laravel apps running well on same server so nothing wrong with the environment.
May you please update readme file? I cant figure out how to install your code. Looking forward to try out Wink.
Thank you in advance.
I followed all the steps on the CONTRIBUTING guide but when I try to access the wink backend, I get the following error:
"Undefined index: /light.css (View /Users/..../resources/views/login.blade.php)"
Did I do something wrong?
Is there a documentation around easy uninstall or should I manually remove the migration after removing the package from composer ?
It would be great if we can have a tool to import Authors/Tags/Pages/Posts from WordPress. Don't have clear goal for this yet but hoping you guys can help :)
TeamController@store uses bcrypt function. Since Wink requires at least Laravel 5.7, maybe it will be better to use Hash facade instead of bcrypt.
Changed config wink path to '/'.
Everything is fine except the logout link is broken still trying to go to /wink/logout which no longer exists.
Hi thanks for the great project.
I wanted to be able to use the unsplash integration but I am not sure which token I have to use. I saw in the code that I have to set the unsplash key in the services directory:
// src/Wink.php line 15
'unsplash_key' => config('services.unsplash.key'),
But when I create an app on unsplash I only get two keys which both must be remain confidential
I found out that the request works with the access key. But by exposing it to the frontend it is not confidential anymore.
What would be the correct solution for that? Or is the unsplash documentation just missleading?
Thanks,
Silvan
As per instructions, running php artisan wink:migrate
should give me default login credentials. However this is what happens for me:
21:14:55 javorszky@GaborrMBP ~/Sites/wink ⬡ v10.6.0 12s
$ composer require writingink/wink
Using version ^0.0.1 for writingink/wink
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing writingink/wink (v0.0.1): Loading from cache
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: writingink/wink
Package manifest generated successfully.
21:15:25 javorszky@GaborrMBP ~/Sites/wink ⬡ v10.6.0 14s
$ php artisan wink:install
Publishing Wink Assets...
Publishing Wink Configuration...
Wink was installed successfully.
21:15:35 javorszky@GaborrMBP ~/Sites/wink ⬡ v10.6.0
$ php artisan wink:migrate
Nothing to migrate.
To further complicate things, I haven't set up a different database connection for wink, but decided to reuse the one laravel uses (because why not...)
Any reason why we are extending all of the models with AbstractWinkModel?
From what I can see the only real use they are providing is overriding the DB Connection for Wink.
We can Reduce the WinkAuthor code by half by extending from Illuminate\Foundation\Auth\User, using AbstractWinkModel as a trait and removing all the redundant code.
I think this will help us keep the WinkAuthor model close to Laravel defaults
A website (or a part of it) should have a sitemap.
@themsaid Do you plan such a feature? Or do you prefer a PR for that? I can implement that, if you want to.
This ticket addresses the concept of allowing custom, extensible "markup" to be added to the body of a post, and then parse it in a controller method created by the dev. In my initial implementation I am using JSON format for the "markup". For example, adding {{ OGBadge: http://completecodesolutions.com }}
to a post body will result in a controller method firing that pulls OG data from that URL, and returns some HTML that displays the retrieved data. The idea is that devs could use their own tags such as {{ Anything: "red" }}
or {{ SomethingElse: { "color": "blue" } }}
and then create Controller methods parseAnything()
or parseSomethingElse
that return some custom dynamic markup.
Background: I'm starting a blog using Wink, and in one of my first posts I wanted to display a link out to another site. I figured using the OpenGraph data that the external site provides in its header would be a great choice. I found a nice package to retrieve and parse the OG data. But then what? How can I get a dynamic blog post to somehow utilize this package and return a "badge" with the og data retrieved from the external site? Not seeing an existing way to do that, I thought "how about allowing custom markup in the post body, which is then parsed by a custom method on my BlogController."
As a side note, I'm sure there is a better term for this than "custom markup"... "Custom tags" was my first thought, but "tags" conflicts with the existing feature. Perhaps "custom component."
Here is my initial implementation. I have a model at App\WinkPost that extends \Wink\WinkPost. All of my Controllers reference this "local" Model. This is a common practice I do. To parse out any "custom components" that are wrapped in {{ }}
I have this method on my WinkPost model:
public function parseCustomTags() {
$chunks = preg_split("/([{}]{2})/", $this->body, -1, PREG_SPLIT_DELIM_CAPTURE);
$parsed = '';
$in_tag = false;
foreach ($chunks as $chunk) {
if ($chunk === '{{') {
$in_tag = true;
continue;
}
else if ($chunk === '}}') {
$in_tag = false;
continue;
}
if ($in_tag) {
$tag = json_decode('{' .trim($chunk). '}');
foreach ($tag as $k=>$v) {
if (method_exists($this, 'parse' .studly_case($k))) {
$parsed .= call_user_func('App\WinkPost::parse' .studly_case($k), $tag->OGBadge);
}
}
}else{
$parsed .= $chunk;
}
}
$this->body = $parsed;
return $this;
}
Then, if I place {{ "OGBadge": { "src": "https://completecodesolutions.com/" } }}
within the post body, parseCustomTags()
will in turn fire the following function and add the return to the post body (replacing the "custom component"):
public static function parseOGBadge($data) {
$og_data = OpenGraph::fetch($data->src);
$title = isset($og_data['title']) ? $og_data['title'] : null;
$description = isset($og_data['description']) ? $og_data['description'] : null;
$url = isset($og_data['url']) ? $og_data['url'] : $data->src;
$image = isset($og_data['image']) ? $og_data['image'] : null;
return view('blog.partials.ogbadge', compact(
'title',
'description',
'url',
'image'
));
}
The only other piece is that in my show()
method on my BlogController, after retrieving the Post I execute $post->parseCustomTags();
.
So that's my proof-of-concept. I'm not sure if you might feel this concept is outside of the scope of the intentions of this package, but I thought I would bring it up in case you are interested. Another option would be to integrate similar functionality into the WYSIWYG kitchen sink/controls. I know that the Wink package is aimed at developers, so I thought "allowing people to type a little JSON into the WYSIWYG maybe isn't such a bad thing" ;)
When i migrate i get the following error:
Migrating: 2018_10_30_000000_create_tables
Migrated: 2018_10_30_000000_create_tables
PHP Warning: Uncaught ErrorException: Object of class Ramsey\Uuid\Codec\StringCodec could not be converted to string in /Users/matt/www/elevio-website/vendor/laravel/telescope/src/Watchers/ModelWatcher.php:35
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(4096, 'Object of class...', '/Users/matt/www...', 35, Array)
#1 /Users/matt/www/elevio-website/vendor/laravel/telescope/src/Watchers/ModelWatcher.php(35): implode('_', Array)
#2 /Users/matt/www/elevio-website/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(357): Laravel\Telescope\Watchers\ModelWatcher->recordAction('eloquent.create...', Array)
#3 /Users/matt/www/elevio-website/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(209): Illuminate\Events\Dispatcher->Illuminate\Events\{closure}('eloquent.create...', Array)
#4 /Users/matt/www/elevio-website/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php(162): Illuminate\Events\Dispatcher->dispatch('eloquent.create...' in /Users/matt/www/elevio-website/vendor/laravel/telescope/src/Watchers/ModelWatcher.php on line 35
PHP Fatal error: Object of class Ramsey\Uuid\Converter\Number\BigNumberConverter could not be converted to string in /Users/matt/www/elevio-website/vendor/laravel/telescope/src/Watchers/ModelWatcher.php on line 35
Symfony\Component\Debug\Exception\FatalErrorException : Object of class Ramsey\Uuid\Converter\Number\BigNumberConverter could not be converted to string
at /Users/matt/www/elevio-website/vendor/laravel/telescope/src/Watchers/ModelWatcher.php:35
31| if (! $this->shouldRecord($event)) {
32| return;
33| }
34|
> 35| $model = get_class($data[0]) . ':' . implode('_', (array) $data[0]->getKey());
36|
37| $changes = $data[0]->getChanges();
38|
39| Telescope::recordModelEvent(IncomingEntry::make(array_filter([
Whoops\Exception\ErrorException : Object of class Ramsey\Uuid\Converter\Number\BigNumberConverter could not be converted to string
at /Users/matt/www/elevio-website/vendor/laravel/telescope/src/Watchers/ModelWatcher.php:35
31| if (! $this->shouldRecord($event)) {
32| return;
33| }
34|
> 35| $model = get_class($data[0]) . ':' . implode('_', (array) $data[0]->getKey());
36|
37| $changes = $data[0]->getChanges();
38|
39| Telescope::recordModelEvent(IncomingEntry::make(array_filter([
After running yarn run dev
or npm run dev
, it seems that 2 dependencies are missing: Bootstrap and Popper.js. They way to get around this is to install them manually. I think the problem is that they are not declared on the package.json
file.
The use-case:
Suppose you have a complex Laravel webapp and want to add a blog to it. Your options are to use Wordpress or find something in Laravel like Wink (I strongly prefer a laravel solution, despite the strength of the Wordpress ecosystem of plugins and themes).
Here's why the Auth piece is important:
So, Making Wink's Auth work with / defer to the parent project's Auth would be a very common (and strong) use-case.
Given their extensive usage, it would be useful to add scopes regarding posts' published
and published_date
fields. I was thinking something along those lines:
scopePublished()
and scopeUnpublished()
scopedBeforePublishedDate($date)
and scopedAfterPublishedDate($date)
Again, I 'd be more than happy to take care of those 🙂
When defining disk like so:
'public_dev' => [
'driver' => 'local',
'root' => public_path('storage'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
and:
WINK_STORAGE_DISK=public_dev
leads to broken avatar image. This is in part due to the way ImageUploadsController handles uploading image and returning path.
The following change:
$path = request()->image->store('/public/wink/images', config('wink.storage_disk'));
return response()->json([
'url' => \Storage::disk(config('wink.storage_disk'))->url($path)
]);
Unfortunately this will lead to saving absolute url for avatar in the database, which is not desirable. One way of dealing with the issue is to make ImageUploadsController save the avatar path in the database. While doing so, it can also delete currently saved avatar from the disk. (Currently it is not deleting old avatar file when new one is uploaded).
Vue component should get avatar's absolute path, but this path should be generated on the server side by using Storage::url() function. It will be also a good idea to make Vue generate default gravatar url if the path for avatar is empty (null), rather than saving default url for gravatar in the database.
Let me start with: This is the best blog package I have ever come across for Laravel, so a big thank you 🙂
I noticed that that the WinkAuthor model does not include something like
protected $hidden = ['password', 'remember_token'];
Is that on purpose? If not, it would be a good idea to add them in my opinion! I'd be more than happy to contribute.
Hi,
Thank you for the amazing project, I was just searching something like this to start my personal website and provide a little blog in there.
Wink is the perfect solution for my use case.
I saw in the roadmap that you wanted to design a new logo.
I'm not a designer, I'm the opposit of that but your project has inspired me so i tried to come up with something.
It's my first try with a logo design and even my first try with figma, you are welcome to use/discard/love/hate it.
Feel free to edit it or to tell me what you like and what you don't, or even ignore it.
Can we have a contributing.md on how to contribute to the package?
BlogController.php in app/Http/Controllers
` <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class BlogController extends Controller
{
//
public function index()
{
$posts = WinkPost::with('tags')
->where('published', true)
->where('publish_date', '<=', now()->toDateTimeString())
->orderBy('publish_date', 'DESC')
->simplePaginate(12);
return view('blog.index', [
'posts' => $posts
]);
}
}
`
Routes in app/routes/web.php
Route::get('/blog', 'BlogController@index')->name('blog.index');
however, url.com/blog (which I'm making for my homepage) stills redirects instantly to url.com/blog/login ... am I missing a step?
How I can configure Google recaptcha in Wink's forms?
Thanks...
Would be a good idea to build the slug out of the title. Maybe with str_slug. Especially from an SEO standpoint its nice to have some speakable url and not something like example.com/draft-0bb06fa8-5165-4672-bbfc-030c15008b75.
A blog should have a rss feed for its posts and maybe for the tags, so you can subscribe to a tag as reader.
@themsaid Do you have plans for this? Or do you want a PR for this feature? Then i can implement that for you.
Currently the install command will not update the views and config if they have changed due to a composer update
. Would it be sensible to modify the lines to include the --force
parameter, as follows?
$this->callSilent('vendor:publish', ['--tag' => 'wink-assets', '--force']);
$this->callSilent('vendor:publish', ['--tag' => 'wink-config', '--force']);
Alternatively, we could create a re-install command that does this. What does everyone think?
This is a really awesome little package, learning a ton just source diving it. In the project I first went to test it out, when going to project.test/wink, it redirects to auth.login, and not wink.auth.login. Even though it looks like it should be using the wink pages. I haven't tried this on a fresh laravel app with no scaffolding yet.
when going to project.test/wink/login it does go to the wink login page. Perhaps it's not the intention, but wouldn't the expected behaviour be to redirect to the wink login when attempting to do something in the wink directory?
Cheers and thanks again.
When creating a new post with a PostgreSQL database I get the following error:
I think author_id in wink_posts should be of type uuid
, not of type string?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.