mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
closes: https://github.com/TryGhost/Toolbox/issues/324 refs: https://github.com/TryGhost/Ghost/issues/14446 - Currently, if url is configured to http but a request is marked secure, Ghost will handle upgrading all internal URLs to https so that there are no mixed content warnings - From 5.0 that feature is going away, in favour of strictly honouring the configured URL - Ghost will serve URLs exactly as configured and won't upgrade http to https anymore - This use case was common when Ghost was first built, but in 2022 the web is mostly https. - The code needed to support the feature creates a lot of additional complexity & maintenance overhead, so removing this gives us space to do more cool and useful stuff in 2022
20 lines
651 B
JavaScript
20 lines
651 B
JavaScript
const urlService = require('../../server/services/url');
|
|
const getContextObject = require('./context-object.js');
|
|
|
|
function getAuthorUrl(data, absolute) {
|
|
let context = data.context ? data.context[0] : null;
|
|
|
|
const contextObject = getContextObject(data, context);
|
|
|
|
if (data.author) {
|
|
return urlService.getUrlByResourceId(data.author.id, {absolute: absolute, withSubdirectory: true});
|
|
}
|
|
|
|
if (contextObject && contextObject.primary_author) {
|
|
return urlService.getUrlByResourceId(contextObject.primary_author.id, {absolute: absolute, withSubdirectory: true});
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
module.exports = getAuthorUrl;
|