Skip to content

Commit 20c73b7

Browse files
committed
Merge branch 'hotfix/6.0.47'
* 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
2 parents fd32e79 + 291918f commit 20c73b7

22 files changed

+1245
-1104
lines changed

composer.lock

+329-279
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/app.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/app.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/mix-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"/js/app.js": "/js/app.js?id=324e18fcae063bb1f1ca2906c7bb439b",
2+
"/js/app.js": "/js/app.js?id=b3fafb432499dab8ca1789ac2e4265f9",
33
"/css/app.css": "/css/app.css?id=fba32a97663f92be37a5efdb5fa67cfa"
44
}

resources/js/components/editor/EmbedImageModal.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export default {
233233
234234
getServerOptions() {
235235
return {
236-
url: `${this.settings.path}/api/uploads`,
236+
url: this.settings.path !== '/' ? `${this.settings.path}/api/uploads` : '/api/uploads',
237237
headers: {
238238
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content,
239239
},

resources/js/components/modals/AvatarModal.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ export default {
107107
108108
getServerOptions() {
109109
return {
110-
// TODO: This check shouldn't need to be here
111-
url: this.settings.path === '/' ? `/api/uploads` : `${this.settings.path}/api/uploads`,
110+
url: this.settings.path !== '/' ? `${this.settings.path}/api/uploads` : '/api/uploads',
112111
headers: {
113112
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content,
114113
},

resources/js/components/modals/FeaturedImageModal.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export default {
227227
228228
getServerOptions() {
229229
return {
230-
url: `${this.settings.path}/api/uploads`,
230+
url: this.settings.path !== '/' ? `${this.settings.path}/api/uploads` : '/api/uploads',
231231
headers: {
232232
'X-CSRF-TOKEN': document.head.querySelector('meta[name="csrf-token"]').content,
233233
},

resources/js/views/PostStats.vue

+21-22
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,18 @@
225225
<div class="mr-auto">
226226
<div v-if="host === trans.other">
227227
<p class="mb-0 py-1">
228-
<img
229-
:src="getDefaultFavicon(host)"
230-
:style="
231-
settings.user.dark_mode === true
232-
? {
233-
filter: 'invert(100%)',
234-
}
235-
: ''
236-
"
237-
:alt="host"
228+
<svg
229+
xmlns="http://www.w3.org/2000/svg"
238230
width="15"
239231
height="15"
240-
class="mr-1"
241-
/>
232+
fill="currentColor"
233+
class="mr-1 bi bi-globe"
234+
viewBox="0 0 16 16"
235+
>
236+
<path
237+
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"
238+
/>
239+
</svg>
242240
<a
243241
v-tooltip="{
244242
placement: 'right',
@@ -268,15 +266,20 @@
268266
</div>
269267
<div v-else>
270268
<p class="mb-0 py-1">
271-
<img
272-
:src="getDefaultFavicon(host)"
273-
:alt="host"
269+
<svg
270+
xmlns="http://www.w3.org/2000/svg"
274271
width="15"
275272
height="15"
276-
class="mr-1"
277-
/>
273+
fill="currentColor"
274+
class="mr-1 bi bi-globe"
275+
viewBox="0 0 16 16"
276+
>
277+
<path
278+
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"
279+
/>
280+
</svg>
278281
<a
279-
:href="'http://' + host"
282+
:href="'https://' + host"
280283
class="text-decoration-none text-primary"
281284
target="_blank"
282285
>
@@ -409,10 +412,6 @@ export default {
409412
NProgress.done();
410413
});
411414
},
412-
413-
getDefaultFavicon(host) {
414-
return `https://favicons.githubusercontent.com/${host}`;
415-
},
416415
},
417416
};
418417
</script>

resources/stubs/webpack.mix.stub

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
const mix = require('laravel-mix');
2+
13
mix.js('resources/js/canvas-ui/app.js', 'public/js/canvas-ui.js').vue()
24
.sass('resources/sass/canvas-ui.scss', 'public/css/canvas-ui.css');

resources/views/layout.blade.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
<link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Karla&family=Merriweather:wght@400;700&display=swap">
1414

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

21-
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.5.0/build/highlight.min.js"></script>
21+
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.8.0/build/highlight.min.js"></script>
2222
</head>
2323
<body class="mb-5"
2424
@if(\Canvas\Canvas::enabledDarkMode($jsVars['user']['dark_mode'])) data-theme="dark" @endif

resources/views/ui.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<link rel="dns-prefetch" href="//fonts.gstatic.com">
1313
<link rel="stylesheet" href="//fonts.googleapis.com/css2?family=Karla&family=Merriweather:wght@400;700&display=swap">
1414

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

src/Canvas.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function availableLanguageCodes(): array
4141
/**
4242
* Return an encoded string of app translations.
4343
*
44-
* @param $locale
44+
* @param $locale
4545
* @return string
4646
*/
4747
public static function availableTranslations($locale): string

src/Console/UiCommand.php

+39-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function handle()
4444
'bootstrap' => '^4.6.0',
4545
'highlight.js' => '^10.5.0',
4646
'jquery' => '^3.5.1',
47+
'laravel-mix' => '^6.0.49',
4748
'medium-zoom' => '^1.0.6',
4849
'moment' => '^2.29.1',
4950
'nprogress' => '^0.2.0',
@@ -60,6 +61,13 @@ public function handle()
6061
] + $packages;
6162
});
6263

64+
$this->updateNodeScripts(function ($scripts) {
65+
return [
66+
'canvas.ui.dev' => 'mix',
67+
'canvas.ui.prod' => 'mix --production',
68+
] + $scripts;
69+
});
70+
6371
// Sass configuration...
6472
copy(dirname(__DIR__, 2).'/resources/sass/ui.scss', resource_path('sass/canvas-ui.scss'));
6573

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

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

7684
/**
@@ -103,6 +111,36 @@ protected function updateNodePackages(callable $callback, $dev = true)
103111
);
104112
}
105113

114+
/**
115+
* Update the "package.json" scripts.
116+
*
117+
* @param callable $callback
118+
* @param bool $dev
119+
* @return void
120+
*/
121+
protected function updateNodeScripts(callable $callback)
122+
{
123+
if (! file_exists(base_path('package.json'))) {
124+
return;
125+
}
126+
127+
$configurationKey = 'scripts';
128+
129+
$packages = json_decode(file_get_contents(base_path('package.json')), true);
130+
131+
$packages[$configurationKey] = $callback(
132+
array_key_exists($configurationKey, $packages) ? $packages[$configurationKey] : [],
133+
$configurationKey
134+
);
135+
136+
ksort($packages[$configurationKey]);
137+
138+
file_put_contents(
139+
base_path('package.json'),
140+
json_encode($packages, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT).PHP_EOL
141+
);
142+
}
143+
106144
/**
107145
* Export the authentication views.
108146
*

src/Http/Controllers/PostController.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function create(): JsonResponse
8888
* Store a newly created resource in storage.
8989
*
9090
* @param PostRequest $request
91-
* @param $id
91+
* @param $id
9292
* @return JsonResponse
9393
*
9494
* @throws Exception
@@ -159,7 +159,7 @@ public function store(PostRequest $request, $id): JsonResponse
159159
/**
160160
* Display the specified resource.
161161
*
162-
* @param $id
162+
* @param $id
163163
* @return JsonResponse
164164
*/
165165
public function show($id): JsonResponse
@@ -207,7 +207,7 @@ public function stats(string $id): JsonResponse
207207
/**
208208
* Remove the specified resource from storage.
209209
*
210-
* @param $id
210+
* @param $id
211211
* @return mixed
212212
*
213213
* @throws Exception

src/Http/Controllers/TagController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function create(): JsonResponse
4343
* Store a newly created resource in storage.
4444
*
4545
* @param TagRequest $request
46-
* @param $id
46+
* @param $id
4747
* @return JsonResponse
4848
*/
4949
public function store(TagRequest $request, $id): JsonResponse
@@ -74,7 +74,7 @@ public function store(TagRequest $request, $id): JsonResponse
7474
/**
7575
* Display the specified resource.
7676
*
77-
* @param $id
77+
* @param $id
7878
* @return JsonResponse
7979
*/
8080
public function show($id): JsonResponse
@@ -87,7 +87,7 @@ public function show($id): JsonResponse
8787
/**
8888
* Display the specified relationship.
8989
*
90-
* @param $id
90+
* @param $id
9191
* @return JsonResponse
9292
*/
9393
public function posts($id): JsonResponse
@@ -100,7 +100,7 @@ public function posts($id): JsonResponse
100100
/**
101101
* Remove the specified resource from storage.
102102
*
103-
* @param $id
103+
* @param $id
104104
* @return mixed
105105
*
106106
* @throws Exception

src/Http/Controllers/TopicController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function create(): JsonResponse
4343
* Store a newly created resource in storage.
4444
*
4545
* @param TopicRequest $request
46-
* @param $id
46+
* @param $id
4747
* @return JsonResponse
4848
*/
4949
public function store(TopicRequest $request, $id): JsonResponse
@@ -74,7 +74,7 @@ public function store(TopicRequest $request, $id): JsonResponse
7474
/**
7575
* Display the specified resource.
7676
*
77-
* @param $id
77+
* @param $id
7878
* @return JsonResponse
7979
*/
8080
public function show($id): JsonResponse
@@ -87,7 +87,7 @@ public function show($id): JsonResponse
8787
/**
8888
* Display the specified relationship.
8989
*
90-
* @param $id
90+
* @param $id
9191
* @return JsonResponse
9292
*/
9393
public function posts($id): JsonResponse
@@ -100,7 +100,7 @@ public function posts($id): JsonResponse
100100
/**
101101
* Remove the specified resource from storage.
102102
*
103-
* @param $id
103+
* @param $id
104104
* @return mixed
105105
*
106106
* @throws Exception

src/Http/Controllers/UserController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function create(): JsonResponse
4747
* Store a newly created resource in storage.
4848
*
4949
* @param UserRequest $request
50-
* @param $id
50+
* @param $id
5151
* @return JsonResponse
5252
*/
5353
public function store(UserRequest $request, $id): JsonResponse
@@ -92,7 +92,7 @@ public function store(UserRequest $request, $id): JsonResponse
9292
/**
9393
* Display the specified resource.
9494
*
95-
* @param $id
95+
* @param $id
9696
* @return JsonResponse
9797
*/
9898
public function show($id): JsonResponse
@@ -105,7 +105,7 @@ public function show($id): JsonResponse
105105
/**
106106
* Display the specified relationship.
107107
*
108-
* @param $id
108+
* @param $id
109109
* @return JsonResponse
110110
*/
111111
public function posts($id): JsonResponse
@@ -118,7 +118,7 @@ public function posts($id): JsonResponse
118118
/**
119119
* Remove the specified resource from storage.
120120
*
121-
* @param $id
121+
* @param $id
122122
* @return mixed
123123
*
124124
* @throws Exception

src/Http/Middleware/Admin.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class Admin
1010
/**
1111
* Handle the incoming request.
1212
*
13-
* @param $request
14-
* @param $next
13+
* @param $request
14+
* @param $next
1515
* @return mixed
1616
*/
1717
public function handle(Request $request, Closure $next)

src/Http/Middleware/Session.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class Session
1212
/**
1313
* Handle the incoming request.
1414
*
15-
* @param $request
16-
* @param $next
15+
* @param $request
16+
* @param $next
1717
* @return Response
1818
*/
1919
public function handle(Request $request, Closure $next)

tests/Http/Middleware/AdminTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public function protectedRoutesProvider(): array
4242
/**
4343
* @dataProvider protectedRoutesProvider
4444
*
45-
* @param $method
46-
* @param $endpoint
45+
* @param $method
46+
* @param $endpoint
4747
*/
4848
public function testContributorAccessIsRestricted($method, $endpoint)
4949
{
@@ -55,8 +55,8 @@ public function testContributorAccessIsRestricted($method, $endpoint)
5555
/**
5656
* @dataProvider protectedRoutesProvider
5757
*
58-
* @param $method
59-
* @param $endpoint
58+
* @param $method
59+
* @param $endpoint
6060
*/
6161
public function testEditorAccessIsRestricted($method, $endpoint)
6262
{
@@ -68,8 +68,8 @@ public function testEditorAccessIsRestricted($method, $endpoint)
6868
/**
6969
* @dataProvider protectedRoutesProvider
7070
*
71-
* @param $method
72-
* @param $endpoint
71+
* @param $method
72+
* @param $endpoint
7373
*/
7474
public function testAdminAccessIsGranted($method, $endpoint)
7575
{

0 commit comments

Comments
 (0)