Skip to content

Commit

Permalink
Merge branch 'hotfix/6.0.47'
Browse files Browse the repository at this point in the history
* hotfix/6.0.47:
  builds assets
  Apply fixes from StyleCI (#1304)
  adds laravel mix and node scripts to fix #1181
  uses an svg instead of an icon #1300
  updates dependencies and compiles assets
  updates highlightjs version
  fixes deprecated Github favicons #1300
  Apply fixes from StyleCI (#1303)
  Corrected bug when CANVAS_PATH is empty in EmbedImageModal and FeaturedImageModal
  • Loading branch information
austintoddj committed Jun 22, 2023
2 parents fd32e79 + 291918f commit 20c73b7
Show file tree
Hide file tree
Showing 22 changed files with 1,245 additions and 1,104 deletions.
608 changes: 329 additions & 279 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/js/app.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"/js/app.js": "/js/app.js?id=324e18fcae063bb1f1ca2906c7bb439b",
"/js/app.js": "/js/app.js?id=b3fafb432499dab8ca1789ac2e4265f9",
"/css/app.css": "/css/app.css?id=fba32a97663f92be37a5efdb5fa67cfa"
}
2 changes: 1 addition & 1 deletion resources/js/components/editor/EmbedImageModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default {
getServerOptions() {
return {
url: `${this.settings.path}/api/uploads`,
url: this.settings.path !== '/' ? `${this.settings.path}/api/uploads` : '/api/uploads',
headers: {
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content,
},
Expand Down
3 changes: 1 addition & 2 deletions resources/js/components/modals/AvatarModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ export default {
getServerOptions() {
return {
// TODO: This check shouldn't need to be here
url: this.settings.path === '/' ? `/api/uploads` : `${this.settings.path}/api/uploads`,
url: this.settings.path !== '/' ? `${this.settings.path}/api/uploads` : '/api/uploads',
headers: {
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content,
},
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/modals/FeaturedImageModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export default {
getServerOptions() {
return {
url: `${this.settings.path}/api/uploads`,
url: this.settings.path !== '/' ? `${this.settings.path}/api/uploads` : '/api/uploads',
headers: {
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content,
},
Expand Down
43 changes: 21 additions & 22 deletions resources/js/views/PostStats.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,18 @@
<div class="mr-auto">
<div v-if="host === trans.other">
<p class="mb-0 py-1">
<img
:src="getDefaultFavicon(host)"
:style="
settings.user.dark_mode === true
? {
filter: 'invert(100%)',
}
: ''
"
:alt="host"
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="15"
class="mr-1"
/>
fill="currentColor"
class="mr-1 bi bi-globe"
viewBox="0 0 16 16"
>
<path
d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 0 0 5.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 0 1 .64-1.539 6.7 6.7 0 0 1 .597-.933A7.025 7.025 0 0 0 2.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 0 0-.656 2.5h2.49zM4.847 5a12.5 12.5 0 0 0-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 0 0-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 0 0 .337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 0 1-.597-.933A9.268 9.268 0 0 1 4.09 12H2.255a7.024 7.024 0 0 0 3.072 2.472zM3.82 11a13.652 13.652 0 0 1-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0 0 13.745 12H11.91a9.27 9.27 0 0 1-.64 1.539 6.688 6.688 0 0 1-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 0 1-.312 2.5zm2.802-3.5a6.959 6.959 0 0 0-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 0 0-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 0 0-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"
/>
</svg>
<a
v-tooltip="{
placement: 'right',
Expand Down Expand Up @@ -268,15 +266,20 @@
</div>
<div v-else>
<p class="mb-0 py-1">
<img
:src="getDefaultFavicon(host)"
:alt="host"
<svg
xmlns="http://www.w3.org/2000/svg"
width="15"
height="15"
class="mr-1"
/>
fill="currentColor"
class="mr-1 bi bi-globe"
viewBox="0 0 16 16"
>
<path
d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm7.5-6.923c-.67.204-1.335.82-1.887 1.855A7.97 7.97 0 0 0 5.145 4H7.5V1.077zM4.09 4a9.267 9.267 0 0 1 .64-1.539 6.7 6.7 0 0 1 .597-.933A7.025 7.025 0 0 0 2.255 4H4.09zm-.582 3.5c.03-.877.138-1.718.312-2.5H1.674a6.958 6.958 0 0 0-.656 2.5h2.49zM4.847 5a12.5 12.5 0 0 0-.338 2.5H7.5V5H4.847zM8.5 5v2.5h2.99a12.495 12.495 0 0 0-.337-2.5H8.5zM4.51 8.5a12.5 12.5 0 0 0 .337 2.5H7.5V8.5H4.51zm3.99 0V11h2.653c.187-.765.306-1.608.338-2.5H8.5zM5.145 12c.138.386.295.744.468 1.068.552 1.035 1.218 1.65 1.887 1.855V12H5.145zm.182 2.472a6.696 6.696 0 0 1-.597-.933A9.268 9.268 0 0 1 4.09 12H2.255a7.024 7.024 0 0 0 3.072 2.472zM3.82 11a13.652 13.652 0 0 1-.312-2.5h-2.49c.062.89.291 1.733.656 2.5H3.82zm6.853 3.472A7.024 7.024 0 0 0 13.745 12H11.91a9.27 9.27 0 0 1-.64 1.539 6.688 6.688 0 0 1-.597.933zM8.5 12v2.923c.67-.204 1.335-.82 1.887-1.855.173-.324.33-.682.468-1.068H8.5zm3.68-1h2.146c.365-.767.594-1.61.656-2.5h-2.49a13.65 13.65 0 0 1-.312 2.5zm2.802-3.5a6.959 6.959 0 0 0-.656-2.5H12.18c.174.782.282 1.623.312 2.5h2.49zM11.27 2.461c.247.464.462.98.64 1.539h1.835a7.024 7.024 0 0 0-3.072-2.472c.218.284.418.598.597.933zM10.855 4a7.966 7.966 0 0 0-.468-1.068C9.835 1.897 9.17 1.282 8.5 1.077V4h2.355z"
/>
</svg>
<a
:href="'http://' + host"
:href="'https://' + host"
class="text-decoration-none text-primary"
target="_blank"
>
Expand Down Expand Up @@ -409,10 +412,6 @@ export default {
NProgress.done();
});
},
getDefaultFavicon(host) {
return `https://favicons.githubusercontent.com/${host}`;
},
},
};
</script>
2 changes: 2 additions & 0 deletions resources/stubs/webpack.mix.stub
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
const mix = require('laravel-mix');

mix.js('resources/js/canvas-ui/app.js', 'public/js/canvas-ui.js').vue()
.sass('resources/sass/canvas-ui.scss', 'public/css/canvas-ui.css');
6 changes: 3 additions & 3 deletions resources/views/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
<link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Karla&family=Merriweather:wght@400;700&display=swap">

@if(\Canvas\Canvas::enabledDarkMode($jsVars['user']['dark_mode']))
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/styles/sunburst.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/sunburst.min.css">
@else
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/styles/github.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/github.min.css">
@endif

<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/highlight.min.js"></script>
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/highlight.min.js"></script>
</head>
<body class="mb-5"
@if(\Canvas\Canvas::enabledDarkMode($jsVars['user']['dark_mode'])) data-theme="dark" @endif
Expand Down
2 changes: 1 addition & 1 deletion resources/views/ui.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Karla&family=Merriweather:wght@400;700&display=swap">

<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.1.2/build/styles/github.min.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/styles/github.min.css">
</head>
<body class="mb-5">

Expand Down
2 changes: 1 addition & 1 deletion src/Canvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function availableLanguageCodes(): array
/**
* Return an encoded string of app translations.
*
* @param $locale
* @param $locale
* @return string
*/
public static function availableTranslations($locale): string
Expand Down
40 changes: 39 additions & 1 deletion src/Console/UiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function handle()
'bootstrap' => '^4.6.0',
'highlight.js' => '^10.5.0',
'jquery' => '^3.5.1',
'laravel-mix' => '^6.0.49',
'medium-zoom' => '^1.0.6',
'moment' => '^2.29.1',
'nprogress' => '^0.2.0',
Expand All @@ -60,6 +61,13 @@ public function handle()
] + $packages;
});

$this->updateNodeScripts(function ($scripts) {
return [
'canvas.ui.dev' => 'mix',
'canvas.ui.prod' => 'mix --production',
] + $scripts;
});

// Sass configuration...
copy(dirname(__DIR__, 2).'/resources/sass/ui.scss', resource_path('sass/canvas-ui.scss'));

Expand All @@ -70,7 +78,7 @@ public function handle()
$this->flushNodeModules();

$this->info('Installation complete.');
$this->comment('Please run "npm install && npm run dev" to build your assets.');
$this->comment('Please run "npm install && npm run canvas.ui.dev" to build your assets.');
}

/**
Expand Down Expand Up @@ -103,6 +111,36 @@ protected function updateNodePackages(callable $callback, $dev = true)
);
}

/**
* Update the "package.json" scripts.
*
* @param callable $callback
* @param bool $dev
* @return void
*/
protected function updateNodeScripts(callable $callback)
{
if (! file_exists(base_path('package.json'))) {
return;
}

$configurationKey = 'scripts';

$packages = json_decode(file_get_contents(base_path('package.json')), true);

$packages[$configurationKey] = $callback(
array_key_exists($configurationKey, $packages) ? $packages[$configurationKey] : [],
$configurationKey
);

ksort($packages[$configurationKey]);

file_put_contents(
base_path('package.json'),
json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL
);
}

/**
* Export the authentication views.
*
Expand Down
6 changes: 3 additions & 3 deletions src/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function create(): JsonResponse
* Store a newly created resource in storage.
*
* @param PostRequest $request
* @param $id
* @param $id
* @return JsonResponse
*
* @throws Exception
Expand Down Expand Up @@ -159,7 +159,7 @@ public function store(PostRequest $request, $id): JsonResponse
/**
* Display the specified resource.
*
* @param $id
* @param $id
* @return JsonResponse
*/
public function show($id): JsonResponse
Expand Down Expand Up @@ -207,7 +207,7 @@ public function stats(string $id): JsonResponse
/**
* Remove the specified resource from storage.
*
* @param $id
* @param $id
* @return mixed
*
* @throws Exception
Expand Down
8 changes: 4 additions & 4 deletions src/Http/Controllers/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function create(): JsonResponse
* Store a newly created resource in storage.
*
* @param TagRequest $request
* @param $id
* @param $id
* @return JsonResponse
*/
public function store(TagRequest $request, $id): JsonResponse
Expand Down Expand Up @@ -74,7 +74,7 @@ public function store(TagRequest $request, $id): JsonResponse
/**
* Display the specified resource.
*
* @param $id
* @param $id
* @return JsonResponse
*/
public function show($id): JsonResponse
Expand All @@ -87,7 +87,7 @@ public function show($id): JsonResponse
/**
* Display the specified relationship.
*
* @param $id
* @param $id
* @return JsonResponse
*/
public function posts($id): JsonResponse
Expand All @@ -100,7 +100,7 @@ public function posts($id): JsonResponse
/**
* Remove the specified resource from storage.
*
* @param $id
* @param $id
* @return mixed
*
* @throws Exception
Expand Down
8 changes: 4 additions & 4 deletions src/Http/Controllers/TopicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function create(): JsonResponse
* Store a newly created resource in storage.
*
* @param TopicRequest $request
* @param $id
* @param $id
* @return JsonResponse
*/
public function store(TopicRequest $request, $id): JsonResponse
Expand Down Expand Up @@ -74,7 +74,7 @@ public function store(TopicRequest $request, $id): JsonResponse
/**
* Display the specified resource.
*
* @param $id
* @param $id
* @return JsonResponse
*/
public function show($id): JsonResponse
Expand All @@ -87,7 +87,7 @@ public function show($id): JsonResponse
/**
* Display the specified relationship.
*
* @param $id
* @param $id
* @return JsonResponse
*/
public function posts($id): JsonResponse
Expand All @@ -100,7 +100,7 @@ public function posts($id): JsonResponse
/**
* Remove the specified resource from storage.
*
* @param $id
* @param $id
* @return mixed
*
* @throws Exception
Expand Down
8 changes: 4 additions & 4 deletions src/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function create(): JsonResponse
* Store a newly created resource in storage.
*
* @param UserRequest $request
* @param $id
* @param $id
* @return JsonResponse
*/
public function store(UserRequest $request, $id): JsonResponse
Expand Down Expand Up @@ -92,7 +92,7 @@ public function store(UserRequest $request, $id): JsonResponse
/**
* Display the specified resource.
*
* @param $id
* @param $id
* @return JsonResponse
*/
public function show($id): JsonResponse
Expand All @@ -105,7 +105,7 @@ public function show($id): JsonResponse
/**
* Display the specified relationship.
*
* @param $id
* @param $id
* @return JsonResponse
*/
public function posts($id): JsonResponse
Expand All @@ -118,7 +118,7 @@ public function posts($id): JsonResponse
/**
* Remove the specified resource from storage.
*
* @param $id
* @param $id
* @return mixed
*
* @throws Exception
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Middleware/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class Admin
/**
* Handle the incoming request.
*
* @param $request
* @param $next
* @param $request
* @param $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Middleware/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class Session
/**
* Handle the incoming request.
*
* @param $request
* @param $next
* @param $request
* @param $next
* @return Response
*/
public function handle(Request $request, Closure $next)
Expand Down
12 changes: 6 additions & 6 deletions tests/Http/Middleware/AdminTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public function protectedRoutesProvider(): array
/**
* @dataProvider protectedRoutesProvider
*
* @param $method
* @param $endpoint
* @param $method
* @param $endpoint
*/
public function testContributorAccessIsRestricted($method, $endpoint)
{
Expand All @@ -55,8 +55,8 @@ public function testContributorAccessIsRestricted($method, $endpoint)
/**
* @dataProvider protectedRoutesProvider
*
* @param $method
* @param $endpoint
* @param $method
* @param $endpoint
*/
public function testEditorAccessIsRestricted($method, $endpoint)
{
Expand All @@ -68,8 +68,8 @@ public function testEditorAccessIsRestricted($method, $endpoint)
/**
* @dataProvider protectedRoutesProvider
*
* @param $method
* @param $endpoint
* @param $method
* @param $endpoint
*/
public function testAdminAccessIsGranted($method, $endpoint)
{
Expand Down
Loading

0 comments on commit 20c73b7

Please sign in to comment.