ghost 5.118.0 → 5.118.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/minify-assets.js +119 -0
- package/components/{tryghost-api-framework-5.118.0.tgz → tryghost-api-framework-5.118.1.tgz} +0 -0
- package/components/tryghost-constants-5.118.1.tgz +0 -0
- package/components/tryghost-custom-fonts-5.118.1.tgz +0 -0
- package/components/{tryghost-custom-theme-settings-service-5.118.0.tgz → tryghost-custom-theme-settings-service-5.118.1.tgz} +0 -0
- package/components/tryghost-domain-events-5.118.1.tgz +0 -0
- package/components/tryghost-donations-5.118.1.tgz +0 -0
- package/components/{tryghost-email-addresses-5.118.0.tgz → tryghost-email-addresses-5.118.1.tgz} +0 -0
- package/components/{tryghost-email-service-5.118.0.tgz → tryghost-email-service-5.118.1.tgz} +0 -0
- package/components/tryghost-email-suppression-list-5.118.1.tgz +0 -0
- package/components/tryghost-html-to-plaintext-5.118.1.tgz +0 -0
- package/components/tryghost-i18n-5.118.1.tgz +0 -0
- package/components/{tryghost-job-manager-5.118.0.tgz → tryghost-job-manager-5.118.1.tgz} +0 -0
- package/components/tryghost-link-replacer-5.118.1.tgz +0 -0
- package/components/tryghost-magic-link-5.118.1.tgz +0 -0
- package/components/{tryghost-member-attribution-5.118.0.tgz → tryghost-member-attribution-5.118.1.tgz} +0 -0
- package/components/{tryghost-member-events-5.118.0.tgz → tryghost-member-events-5.118.1.tgz} +0 -0
- package/components/{tryghost-members-csv-5.118.0.tgz → tryghost-members-csv-5.118.1.tgz} +0 -0
- package/components/{tryghost-members-offers-5.118.0.tgz → tryghost-members-offers-5.118.1.tgz} +0 -0
- package/components/tryghost-mw-error-handler-5.118.1.tgz +0 -0
- package/components/{tryghost-mw-vhost-5.118.0.tgz → tryghost-mw-vhost-5.118.1.tgz} +0 -0
- package/components/tryghost-post-events-5.118.1.tgz +0 -0
- package/components/{tryghost-post-revisions-5.118.0.tgz → tryghost-post-revisions-5.118.1.tgz} +0 -0
- package/components/tryghost-posts-service-5.118.1.tgz +0 -0
- package/components/tryghost-prometheus-metrics-5.118.1.tgz +0 -0
- package/components/tryghost-security-5.118.1.tgz +0 -0
- package/components/tryghost-tiers-5.118.1.tgz +0 -0
- package/components/{tryghost-webmentions-5.118.0.tgz → tryghost-webmentions-5.118.1.tgz} +0 -0
- package/core/bridge.js +1 -11
- package/core/built/admin/assets/admin-x-activitypub/admin-x-activitypub.js +9210 -8727
- package/core/built/admin/assets/admin-x-settings/{CodeEditorView-1143c509.mjs → CodeEditorView-9d2a0119.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-19ebc8ad.mjs → index-48250e60.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-ac104f42.mjs → index-fd83d7a5.mjs} +3400 -3356
- package/core/built/admin/assets/admin-x-settings/{modals-994901ee.mjs → modals-8fdc40a2.mjs} +7714 -7257
- package/core/built/admin/assets/chunk.524.9c1e444ecff073f053f5.js +35 -0
- package/core/built/admin/assets/chunk.582.9b35e36c109a3c2d486b.js +37 -0
- package/core/built/admin/assets/{chunk.713.48f120c377bcaffdfddf.js → chunk.709.0cb431c2ada3758f5368.js} +2728 -2726
- package/core/built/admin/assets/{chunk.713.48f120c377bcaffdfddf.js.LICENSE.txt → chunk.709.0cb431c2ada3758f5368.js.LICENSE.txt} +2 -2
- package/core/built/admin/assets/{ghost-cd90a28b214ee800a007bb62cd45e6e6.js → ghost-941b0691f9ab77a31452151d2828caee.js} +388 -388
- package/core/built/admin/assets/{ghost-ba58e9822f7384461e926c7e23f04a75.css → ghost-c10c25cbf2256a65051bf20fdb32b1a9.css} +1 -1
- package/core/built/admin/assets/{ghost-dark-f1f29683b14ffa11615b3bba8b6ab92c.css → ghost-dark-6cbe9c3d45b8b605f846c4b417881e50.css} +1 -1
- package/core/built/admin/assets/posts/posts.js +79873 -29814
- package/core/built/admin/assets/stats/stats.js +14441 -14417
- package/core/built/admin/assets/{vendor-8e3ee8261528bb429cfe78ce79a4a82a.js → vendor-778197221846b9f24b630ecc57b8d8a9.js} +25 -25
- package/core/built/admin/index.html +13 -22
- package/core/frontend/apps/private-blogging/lib/views/private.hbs +4 -12
- package/core/frontend/helpers/ghost_head.js +2 -2
- package/core/frontend/public/admin-auth/admin-auth.min.js +1 -0
- package/core/frontend/public/comment-counts.min.js +1 -0
- package/core/frontend/public/ghost-stats.min.js +1 -0
- package/core/frontend/public/member-attribution.min.js +1 -0
- package/core/frontend/services/assets-minification/index.js +1 -11
- package/core/frontend/src/ghost-stats/ghost-stats.js +234 -0
- package/core/frontend/src/member-attribution/member-attribution.js +29 -29
- package/core/frontend/src/utils/privacy.js +70 -0
- package/core/frontend/src/utils/session-storage.js +68 -0
- package/core/frontend/src/utils/url-attribution.js +92 -0
- package/core/frontend/web/site.js +26 -6
- package/core/server/services/activitypub/ActivityPubService.js +0 -5
- package/core/server/services/activitypub/ActivityPubService.ts +0 -5
- package/core/server/views/error.hbs +4 -9
- package/core/server/web/admin/app.js +3 -5
- package/core/server/web/admin/middleware/serve-auth-frame-file.js +35 -0
- package/core/shared/config/env/config.development.docker.json +8 -0
- package/core/shared/config/env/config.development.json +1 -1
- package/core/shared/config/helpers.js +1 -21
- package/core/shared/labs.js +3 -6
- package/package.json +75 -66
- package/tsconfig.tsbuildinfo +1 -1
- package/yarn.lock +379 -351
- package/components/tryghost-constants-5.118.0.tgz +0 -0
- package/components/tryghost-custom-fonts-5.118.0.tgz +0 -0
- package/components/tryghost-domain-events-5.118.0.tgz +0 -0
- package/components/tryghost-donations-5.118.0.tgz +0 -0
- package/components/tryghost-email-suppression-list-5.118.0.tgz +0 -0
- package/components/tryghost-html-to-plaintext-5.118.0.tgz +0 -0
- package/components/tryghost-i18n-5.118.0.tgz +0 -0
- package/components/tryghost-link-replacer-5.118.0.tgz +0 -0
- package/components/tryghost-magic-link-5.118.0.tgz +0 -0
- package/components/tryghost-mw-error-handler-5.118.0.tgz +0 -0
- package/components/tryghost-post-events-5.118.0.tgz +0 -0
- package/components/tryghost-posts-service-5.118.0.tgz +0 -0
- package/components/tryghost-prometheus-metrics-5.118.0.tgz +0 -0
- package/components/tryghost-security-5.118.0.tgz +0 -0
- package/components/tryghost-tiers-5.118.0.tgz +0 -0
- package/core/built/admin/assets/admin-x-demo/admin-x-demo.js +0 -6
- package/core/built/admin/assets/admin-x-demo/index-09325f38.mjs +0 -11427
- package/core/built/admin/assets/admin-x-demo/modals-1a9ae8b7.mjs +0 -397
- package/core/built/admin/assets/chunk.524.5710919eb507b9a81166.js +0 -35
- package/core/built/admin/assets/chunk.582.c8cb99b85cfa13fc7df1.js +0 -37
- package/core/frontend/public/ghost-stats.js +0 -297
- package/core/frontend/services/assets-minification/AdminAuthAssets.js +0 -69
- package/core/frontend/services/assets-minification/CommentCountsAssets.js +0 -33
- package/core/frontend/services/assets-minification/MemberAttributionAssets.js +0 -45
- package/core/frontend/src/admin-auth/index.html +0 -6
- package/core/frontend/src/member-attribution/.eslintrc +0 -10
- /package/core/frontend/src/comment-counts/{js/comment-counts.js → comment-counts.js} +0 -0
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
(function(){
|
|
2
|
-
const timezones = {"Asia/Barnaul":"RU","Africa/Nouakchott":"MR","Africa/Lusaka":"ZM","Asia/Pyongyang":"KP","Europe/Bratislava":"SK","America/Belize":"BZ","America/Maceio":"BR","Pacific/Chuuk":"FM","Indian/Comoro":"KM","Pacific/Palau":"PW","Asia/Jakarta":"ID","Africa/Windhoek":"NA","America/Chihuahua":"MX","America/Nome":"US","Africa/Mbabane":"SZ","Africa/Porto-Novo":"BJ","Europe/San_Marino":"SM","Pacific/Fakaofo":"TK","America/Denver":"US","Europe/Belgrade":"RS","America/Indiana/Tell_City":"US","America/Fortaleza":"BR","America/Halifax":"CA","Europe/Bucharest":"RO","America/Indiana/Petersburg":"US","Europe/Kirov":"RU","Europe/Athens":"GR","America/Argentina/Ushuaia":"AR","Europe/Monaco":"MC","Europe/Vilnius":"LT","Europe/Copenhagen":"DK","Pacific/Kanton":"KI","America/Caracas":"VE","Asia/Almaty":"KZ","Europe/Paris":"FR","Africa/Blantyre":"MW","Asia/Muscat":"OM","America/North_Dakota/Beulah":"US","America/Matamoros":"MX","Asia/Irkutsk":"RU","America/Costa_Rica":"CR","America/Araguaina":"BR","Atlantic/Canary":"ES","America/Santo_Domingo":"DO","America/Vancouver":"CA","Africa/Addis_Ababa":"ET","Africa/Accra":"GH","Pacific/Kwajalein":"MH","Asia/Baghdad":"IQ","Australia/Adelaide":"AU","Australia/Hobart":"AU","America/Guayaquil":"EC","America/Argentina/Tucuman":"AR","Australia/Lindeman":"AU","America/New_York":"US","Pacific/Fiji":"FJ","America/Antigua":"AG","Africa/Casablanca":"MA","America/Paramaribo":"SR","Africa/Cairo":"EG","America/Cayenne":"GF","America/Detroit":"US","Antarctica/Syowa":"AQ","Africa/Douala":"CM","America/Argentina/La_Rioja":"AR","Africa/Lagos":"NG","America/St_Barthelemy":"BL","Asia/Nicosia":"CY","Asia/Macau":"MO","Europe/Riga":"LV","Asia/Ashgabat":"TM","Indian/Antananarivo":"MG","America/Argentina/San_Juan":"AR","Asia/Aden":"YE","Asia/Tomsk":"RU","America/Asuncion":"PY","Pacific/Bougainville":"PG","Asia/Vientiane":"LA","America/Mazatlan":"MX","Africa/Luanda":"AO","Europe/Oslo":"NO","Africa/Kinshasa":"CD","Europe/Warsaw":"PL","America/Grand_Turk":"TC","Asia/Seoul":"KR","Africa/Tripoli":"LY","America/St_Thomas":"VI","Asia/Kathmandu":"NP","Pacific/Pitcairn":"PN","Pacific/Nauru":"NR","America/Curacao":"CW","Asia/Kabul":"AF","Pacific/Tongatapu":"TO","Europe/Simferopol":"UA","Asia/Ust-Nera":"RU","Africa/Mogadishu":"SO","Indian/Mayotte":"YT","Pacific/Niue":"NU","America/Thunder_Bay":"CA","Atlantic/Azores":"PT","Pacific/Gambier":"PF","Europe/Stockholm":"SE","Africa/Libreville":"GA","America/Punta_Arenas":"CL","America/Guatemala":"GT","America/Noronha":"BR","Europe/Helsinki":"FI","Asia/Gaza":"PS","Pacific/Kosrae":"FM","America/Aruba":"AW","America/Nassau":"BS","Asia/Choibalsan":"MN","America/Winnipeg":"CA","America/Anguilla":"AI","Asia/Thimphu":"BT","Asia/Beirut":"LB","Atlantic/Faroe":"FO","Europe/Berlin":"DE","Europe/Amsterdam":"NL","Pacific/Honolulu":"US","America/Regina":"CA","America/Scoresbysund":"GL","Europe/Vienna":"AT","Europe/Tirane":"AL","Africa/El_Aaiun":"EH","America/Creston":"CA","Asia/Qostanay":"KZ","Asia/Ho_Chi_Minh":"VN","Europe/Samara":"RU","Europe/Rome":"IT","Australia/Eucla":"AU","America/El_Salvador":"SV","America/Chicago":"US","Africa/Abidjan":"CI","Asia/Kamchatka":"RU","Pacific/Tarawa":"KI","America/Santiago":"CL","America/Bahia":"BR","Indian/Christmas":"CX","Asia/Atyrau":"KZ","Asia/Dushanbe":"TJ","Europe/Ulyanovsk":"RU","America/Yellowknife":"CA","America/Recife":"BR","Australia/Sydney":"AU","America/Fort_Nelson":"CA","Pacific/Efate":"VU","Europe/Saratov":"RU","Africa/Banjul":"GM","Asia/Omsk":"RU","Europe/Ljubljana":"SI","Europe/Budapest":"HU","Europe/Astrakhan":"RU","America/Argentina/Buenos_Aires":"AR","Pacific/Chatham":"NZ","America/Argentina/Salta":"AR","Africa/Niamey":"NE","Asia/Pontianak":"ID","Indian/Reunion":"RE","Asia/Hong_Kong":"HK","Antarctica/McMurdo":"AQ","Africa/Malabo":"GQ","America/Los_Angeles":"US","America/Argentina/Cordoba":"AR","Pacific/Pohnpei":"FM","America/Tijuana":"MX","America/Campo_Grande":"BR","America/Dawson_Creek":"CA","Asia/Novosibirsk":"RU","Pacific/Pago_Pago":"AS","Asia/Jerusalem":"IL","Europe/Sarajevo":"BA","Africa/Freetown":"SL","Asia/Yekaterinburg":"RU","America/Juneau":"US","Africa/Ouagadougou":"BF","Africa/Monrovia":"LR","Europe/Kiev":"UA","America/Argentina/San_Luis":"AR","Asia/Tokyo":"JP","Asia/Qatar":"QA","America/La_Paz":"BO","America/Bogota":"CO","America/Thule":"GL","Asia/Manila":"PH","Asia/Hovd":"MN","Asia/Tehran":"IR","Atlantic/Madeira":"PT","America/Metlakatla":"US","Europe/Vatican":"VA","Asia/Bishkek":"KG","Asia/Dili":"TL","Antarctica/Palmer":"AQ","Atlantic/Cape_Verde":"CV","Indian/Chagos":"IO","America/Kentucky/Monticello":"US","Africa/Algiers":"DZ","Africa/Maseru":"LS","Asia/Kuala_Lumpur":"MY","Africa/Khartoum":"SD","America/Argentina/Rio_Gallegos":"AR","America/Blanc-Sablon":"CA","Africa/Maputo":"MZ","America/Tortola":"VG","Atlantic/Bermuda":"BM","America/Argentina/Catamarca":"AR","America/Cayman":"KY","America/Puerto_Rico":"PR","Pacific/Majuro":"MH","Europe/Busingen":"DE","Pacific/Midway":"UM","Indian/Cocos":"CC","Asia/Singapore":"SG","America/Boise":"US","America/Nuuk":"GL","America/Goose_Bay":"CA","Australia/Broken_Hill":"AU","Africa/Dar_es_Salaam":"TZ","Africa/Asmara":"ER","Asia/Samarkand":"UZ","Asia/Tbilisi":"GE","America/Argentina/Jujuy":"AR","America/Indiana/Winamac":"US","America/Porto_Velho":"BR","Asia/Magadan":"RU","Europe/Zaporozhye":"UA","Antarctica/Casey":"AQ","Asia/Shanghai":"CN","Pacific/Norfolk":"NF","Europe/Guernsey":"GG","Australia/Brisbane":"AU","Antarctica/DumontDUrville":"AQ","America/Havana":"CU","America/Atikokan":"CA","America/Mexico_City":"MX","America/Rankin_Inlet":"CA","America/Cuiaba":"BR","America/Resolute":"CA","Africa/Ceuta":"ES","Arctic/Longyearbyen":"SJ","Pacific/Guam":"GU","Asia/Damascus":"SY","Asia/Colombo":"LK","Asia/Yerevan":"AM","America/Montserrat":"MS","America/Belem":"BR","Europe/Kaliningrad":"RU","Atlantic/South_Georgia":"GS","Asia/Tashkent":"UZ","Asia/Kolkata":"IN","America/St_Johns":"CA","Asia/Srednekolymsk":"RU","Asia/Yakutsk":"RU","Europe/Prague":"CZ","Africa/Djibouti":"DJ","Asia/Dubai":"AE","Europe/Uzhgorod":"UA","America/Edmonton":"CA","Asia/Famagusta":"CY","America/Indiana/Knox":"US","Asia/Hebron":"PS","Asia/Taipei":"TW","Europe/London":"GB","Africa/Dakar":"SN","Australia/Darwin":"AU","America/Glace_Bay":"CA","Antarctica/Vostok":"AQ","America/Indiana/Vincennes":"US","America/Nipigon":"CA","Asia/Kuwait":"KW","Pacific/Guadalcanal":"SB","America/Toronto":"CA","Africa/Gaborone":"BW","Africa/Bujumbura":"BI","Africa/Lubumbashi":"CD","America/Merida":"MX","America/Marigot":"MF","Europe/Zagreb":"HR","Pacific/Easter":"CL","America/Santarem":"BR","Pacific/Noumea":"NC","America/Sitka":"US","Atlantic/Stanley":"FK","Pacific/Funafuti":"TV","America/Iqaluit":"CA","America/Rainy_River":"CA","America/Anchorage":"US","America/Lima":"PE","Asia/Baku":"AZ","America/Indiana/Vevay":"US","Asia/Ulaanbaatar":"MN","America/Managua":"NI","Asia/Krasnoyarsk":"RU","Asia/Qyzylorda":"KZ","America/Eirunepe":"BR","Europe/Podgorica":"ME","Europe/Chisinau":"MD","Europe/Mariehamn":"AX","Europe/Volgograd":"RU","Africa/Nairobi":"KE","Europe/Isle_of_Man":"IM","America/Menominee":"US","Africa/Harare":"ZW","Asia/Anadyr":"RU","America/Moncton":"CA","Indian/Maldives":"MV","America/Whitehorse":"CA","Antarctica/Mawson":"AQ","Europe/Madrid":"ES","America/Argentina/Mendoza":"AR","America/Manaus":"BR","Africa/Bangui":"CF","Indian/Mauritius":"MU","Africa/Tunis":"TN","Australia/Lord_Howe":"AU","America/Kentucky/Louisville":"US","America/North_Dakota/Center":"US","Asia/Novokuznetsk":"RU","Asia/Makassar":"ID","America/Port_of_Spain":"TT","America/Bahia_Banderas":"MX","Pacific/Auckland":"NZ","America/Sao_Paulo":"BR","Asia/Dhaka":"BD","America/Pangnirtung":"CA","Europe/Dublin":"IE","Asia/Brunei":"BN","Africa/Brazzaville":"CG","America/Montevideo":"UY","America/Jamaica":"JM","America/Indiana/Indianapolis":"US","America/Kralendijk":"BQ","Europe/Gibraltar":"GI","Pacific/Marquesas":"PF","Pacific/Apia":"WS","Europe/Jersey":"JE","America/Phoenix":"US","Africa/Ndjamena":"TD","Asia/Karachi":"PK","Africa/Kampala":"UG","Asia/Sakhalin":"RU","America/Martinique":"MQ","Europe/Moscow":"RU","Africa/Conakry":"GN","America/Barbados":"BB","Africa/Lome":"TG","America/Ojinaga":"MX","America/Tegucigalpa":"HN","Asia/Bangkok":"TH","Africa/Johannesburg":"ZA","Europe/Vaduz":"LI","Africa/Sao_Tome":"ST","America/Cambridge_Bay":"CA","America/Lower_Princes":"SX","America/Miquelon":"PM","America/St_Kitts":"KN","Australia/Melbourne":"AU","Europe/Minsk":"BY","Asia/Vladivostok":"RU","Europe/Sofia":"BG","Antarctica/Davis":"AQ","Pacific/Galapagos":"EC","America/North_Dakota/New_Salem":"US","Asia/Amman":"JO","Pacific/Wallis":"WF","America/Hermosillo":"MX","Pacific/Kiritimati":"KI","Antarctica/Macquarie":"AU","America/Guyana":"GY","Asia/Riyadh":"SA","Pacific/Tahiti":"PF","America/St_Vincent":"VC","America/Cancun":"MX","America/Grenada":"GD","Pacific/Wake":"UM","America/Dawson":"CA","Europe/Brussels":"BE","Indian/Kerguelen":"TF","America/Yakutat":"US","Indian/Mahe":"SC","Atlantic/Reykjavik":"IS","America/Panama":"PA","America/Guadeloupe":"GP","Europe/Malta":"MT","Antarctica/Troll":"AQ","Asia/Jayapura":"ID","Asia/Bahrain":"BH","Asia/Chita":"RU","Europe/Tallinn":"EE","Asia/Khandyga":"RU","America/Rio_Branco":"BR","Atlantic/St_Helena":"SH","Africa/Juba":"SS","America/Adak":"US","Pacific/Saipan":"MP","America/St_Lucia":"LC","America/Inuvik":"CA","Europe/Luxembourg":"LU","Africa/Bissau":"GW","Asia/Oral":"KZ","America/Boa_Vista":"BR","Europe/Skopje":"MK","America/Port-au-Prince":"HT","Pacific/Port_Moresby":"PG","Europe/Andorra":"AD","America/Indiana/Marengo":"US","Africa/Kigali":"RW","Africa/Bamako":"ML","America/Dominica":"DM","Asia/Aqtobe":"KZ","Europe/Istanbul":"TR","Pacific/Rarotonga":"CK","America/Danmarkshavn":"GL","Europe/Zurich":"CH","Asia/Yangon":"MM","America/Monterrey":"MX","Europe/Lisbon":"PT","Asia/Kuching":"MY","Antarctica/Rothera":"AQ","Australia/Perth":"AU","Asia/Phnom_Penh":"KH","America/Swift_Current":"CA","Asia/Aqtau":"KZ","Asia/Urumqi":"CN","Asia/Calcutta":"IN"};
|
|
3
|
-
const STORAGE_KEY = 'session-id'
|
|
4
|
-
let DATASOURCE = 'analytics_events'
|
|
5
|
-
const storageMethods = {
|
|
6
|
-
localStorage: 'localStorage',
|
|
7
|
-
sessionStorage: 'sessionStorage',
|
|
8
|
-
}
|
|
9
|
-
let STORAGE_METHOD = storageMethods.localStorage
|
|
10
|
-
let globalAttributes = {}
|
|
11
|
-
let stringifyPayload = true
|
|
12
|
-
|
|
13
|
-
let token, host, domain
|
|
14
|
-
if (document.currentScript) {
|
|
15
|
-
host = document.currentScript.getAttribute('data-host')
|
|
16
|
-
token = document.currentScript.getAttribute('data-token')
|
|
17
|
-
domain = document.currentScript.getAttribute('data-domain')
|
|
18
|
-
DATASOURCE =
|
|
19
|
-
document.currentScript.getAttribute('data-datasource') || DATASOURCE
|
|
20
|
-
STORAGE_METHOD =
|
|
21
|
-
document.currentScript.getAttribute('data-storage') || STORAGE_METHOD
|
|
22
|
-
stringifyPayload = document.currentScript.getAttribute('data-stringify-payload') !== 'false'
|
|
23
|
-
for (const attr of document.currentScript.attributes) {
|
|
24
|
-
if (attr.name.startsWith('tb_')) {
|
|
25
|
-
globalAttributes[attr.name.slice(3)] = attr.value
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Generate uuid to identify the session. Random, not data-derived
|
|
32
|
-
*/
|
|
33
|
-
function _uuidv4() {
|
|
34
|
-
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
|
|
35
|
-
(
|
|
36
|
-
c ^
|
|
37
|
-
(crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))
|
|
38
|
-
).toString(16)
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _getSessionId() {
|
|
43
|
-
const storage =
|
|
44
|
-
STORAGE_METHOD === storageMethods.localStorage
|
|
45
|
-
? localStorage
|
|
46
|
-
: sessionStorage
|
|
47
|
-
const serializedItem = storage.getItem(STORAGE_KEY)
|
|
48
|
-
|
|
49
|
-
if (!serializedItem) {
|
|
50
|
-
return null
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
let item = null;
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
item = JSON.parse(serializedItem)
|
|
57
|
-
} catch (error) {
|
|
58
|
-
return null
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if(typeof item !== 'object' || item === null) {
|
|
62
|
-
return null
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const now = new Date()
|
|
66
|
-
|
|
67
|
-
if (now.getTime() > item.expiry) {
|
|
68
|
-
storage.removeItem(STORAGE_KEY)
|
|
69
|
-
return null
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return item.value
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function _setSessionId() {
|
|
76
|
-
/**
|
|
77
|
-
* Try to keep same session id if it exists, generate a new one otherwise.
|
|
78
|
-
* - First request in a session will generate a new session id
|
|
79
|
-
* - The next request will keep the same session id and extend the TTL for 30 more minutes
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
const sessionId = _getSessionId() || _uuidv4()
|
|
83
|
-
const now = new Date()
|
|
84
|
-
const item = {
|
|
85
|
-
value: sessionId,
|
|
86
|
-
expiry: now.getTime() + 14400 * 1000, // 4 hours
|
|
87
|
-
}
|
|
88
|
-
const value = JSON.stringify(item)
|
|
89
|
-
const storage =
|
|
90
|
-
STORAGE_METHOD === storageMethods.localStorage
|
|
91
|
-
? localStorage
|
|
92
|
-
: sessionStorage
|
|
93
|
-
storage.setItem(STORAGE_KEY, value)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Try to mask PPI and potential sensible attributes
|
|
98
|
-
*
|
|
99
|
-
* @param { object } payload Event payload
|
|
100
|
-
* @return { object } Sanitized payload
|
|
101
|
-
*/
|
|
102
|
-
const _maskSuspiciousAttributes = payload => {
|
|
103
|
-
const attributesToMask = [
|
|
104
|
-
'username',
|
|
105
|
-
'user',
|
|
106
|
-
'user_id',
|
|
107
|
-
'userid',
|
|
108
|
-
'password',
|
|
109
|
-
'pass',
|
|
110
|
-
'pin',
|
|
111
|
-
'passcode',
|
|
112
|
-
'token',
|
|
113
|
-
'api_token',
|
|
114
|
-
'email',
|
|
115
|
-
'address',
|
|
116
|
-
'phone',
|
|
117
|
-
'sex',
|
|
118
|
-
'gender',
|
|
119
|
-
'order',
|
|
120
|
-
'order_id',
|
|
121
|
-
'orderid',
|
|
122
|
-
'payment',
|
|
123
|
-
'credit_card',
|
|
124
|
-
]
|
|
125
|
-
|
|
126
|
-
// Deep copy
|
|
127
|
-
let _payload = JSON.stringify(payload)
|
|
128
|
-
attributesToMask.forEach(attr => {
|
|
129
|
-
_payload = _payload.replaceAll(
|
|
130
|
-
new RegExp(`("${attr}"):(".+?"|\\d+)`, 'mgi'),
|
|
131
|
-
'$1:"********"'
|
|
132
|
-
)
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
return _payload
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Send event to endpoint
|
|
140
|
-
*
|
|
141
|
-
* @param { string } name Event name
|
|
142
|
-
* @param { object } payload Event payload
|
|
143
|
-
* @return { Promise<any> } request response
|
|
144
|
-
*/
|
|
145
|
-
async function _sendEvent(name, payload) {
|
|
146
|
-
_setSessionId()
|
|
147
|
-
const url = `${host}?name=${DATASOURCE}&token=${token}`
|
|
148
|
-
|
|
149
|
-
let processedPayload
|
|
150
|
-
if (stringifyPayload) {
|
|
151
|
-
processedPayload = _maskSuspiciousAttributes(payload)
|
|
152
|
-
processedPayload = Object.assign({}, JSON.parse(processedPayload), globalAttributes)
|
|
153
|
-
processedPayload = JSON.stringify(processedPayload)
|
|
154
|
-
} else {
|
|
155
|
-
processedPayload = Object.assign({}, payload, globalAttributes)
|
|
156
|
-
const maskedStr = _maskSuspiciousAttributes(processedPayload)
|
|
157
|
-
processedPayload = JSON.parse(maskedStr)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const session_id = _getSessionId() || _uuidv4()
|
|
161
|
-
|
|
162
|
-
const request = new XMLHttpRequest()
|
|
163
|
-
request.open('POST', url, true)
|
|
164
|
-
request.setRequestHeader('Content-Type', 'application/json')
|
|
165
|
-
request.send(
|
|
166
|
-
JSON.stringify({
|
|
167
|
-
timestamp: new Date().toISOString(),
|
|
168
|
-
action: name,
|
|
169
|
-
version: '1',
|
|
170
|
-
session_id,
|
|
171
|
-
payload: processedPayload,
|
|
172
|
-
})
|
|
173
|
-
)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Track page hit
|
|
178
|
-
*/
|
|
179
|
-
function _trackPageHit() {
|
|
180
|
-
// If local development environment
|
|
181
|
-
// if (/^localhost$|^127(\.[0-9]+){0,2}\.[0-9]+$|^\[::1?\]$/.test(location.hostname) || location.protocol === 'file:') return;
|
|
182
|
-
// If test environment
|
|
183
|
-
if (window.__nightmare || window.navigator.webdriver || window.Cypress)
|
|
184
|
-
return
|
|
185
|
-
|
|
186
|
-
let country, locale
|
|
187
|
-
try {
|
|
188
|
-
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
|
189
|
-
country = timezones[timezone]
|
|
190
|
-
locale =
|
|
191
|
-
navigator.languages && navigator.languages.length
|
|
192
|
-
? navigator.languages[0]
|
|
193
|
-
: navigator.userLanguage ||
|
|
194
|
-
navigator.language ||
|
|
195
|
-
navigator.browserLanguage ||
|
|
196
|
-
'en'
|
|
197
|
-
} catch (error) {
|
|
198
|
-
// ignore error
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Wait a bit for SPA routers
|
|
202
|
-
setTimeout(() => {
|
|
203
|
-
_sendEvent('page_hit', {
|
|
204
|
-
'user-agent': window.navigator.userAgent,
|
|
205
|
-
locale,
|
|
206
|
-
location: country,
|
|
207
|
-
referrer: _getReferrer(),
|
|
208
|
-
pathname: window.location.pathname,
|
|
209
|
-
href: window.location.href,
|
|
210
|
-
})
|
|
211
|
-
}, 300)
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function _getReferrer() {
|
|
215
|
-
// Fetch referrer data from query params - priority is the following order: ref, source, utm_source, utm_medium, referrer
|
|
216
|
-
let refParam;
|
|
217
|
-
let sourceParam;
|
|
218
|
-
let utmSourceParam;
|
|
219
|
-
let utmMediumParam;
|
|
220
|
-
let referrerSource;
|
|
221
|
-
|
|
222
|
-
// Fetch source/medium from query param
|
|
223
|
-
const url = new URL(window.location.href);
|
|
224
|
-
refParam = url.searchParams.get('ref');
|
|
225
|
-
sourceParam = url.searchParams.get('source');
|
|
226
|
-
utmSourceParam = url.searchParams.get('utm_source');
|
|
227
|
-
utmMediumParam = url.searchParams.get('utm_medium');
|
|
228
|
-
|
|
229
|
-
referrerSource = refParam || sourceParam || utmSourceParam || null;
|
|
230
|
-
|
|
231
|
-
// if referrerSource is not set, check to see if the url contains a hash like ghost.org/#/portal/signup?ref=ghost and pull the ref from the hash
|
|
232
|
-
if (!referrerSource && url.hash && url.hash.includes('#/portal')) {
|
|
233
|
-
const hashUrl = new URL(window.location.href.replace('/#/portal', ''));
|
|
234
|
-
refParam = hashUrl.searchParams.get('ref');
|
|
235
|
-
sourceParam = hashUrl.searchParams.get('source');
|
|
236
|
-
utmSourceParam = hashUrl.searchParams.get('utm_source');
|
|
237
|
-
utmMediumParam = hashUrl.searchParams.get('utm_medium');
|
|
238
|
-
|
|
239
|
-
referrerSource = refParam || sourceParam || utmSourceParam || null;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// Get referrer medium and url
|
|
243
|
-
const referrerMedium = utmMediumParam || null;
|
|
244
|
-
const referrerUrl = window.document.referrer || null;
|
|
245
|
-
|
|
246
|
-
// Get the final referrer value based on priority
|
|
247
|
-
const finalReferrer = referrerSource || referrerMedium || referrerUrl || null;
|
|
248
|
-
|
|
249
|
-
if (finalReferrer) {
|
|
250
|
-
try {
|
|
251
|
-
const referrerHost = new URL(finalReferrer).hostname;
|
|
252
|
-
const currentHost = window.location.hostname;
|
|
253
|
-
// If the final referrer matches the current site's domain, return null
|
|
254
|
-
if (referrerHost === currentHost) {
|
|
255
|
-
return null;
|
|
256
|
-
}
|
|
257
|
-
} catch (e) {
|
|
258
|
-
// If URL parsing fails (e.g. for non-URL refs like "ghost-newsletter"),
|
|
259
|
-
// just return the original referrer value
|
|
260
|
-
return finalReferrer;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return finalReferrer;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
// Client
|
|
268
|
-
window.Tinybird = {
|
|
269
|
-
trackEvent: _sendEvent,
|
|
270
|
-
_trackPageHit: _trackPageHit
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Event listener
|
|
274
|
-
window.addEventListener('hashchange', _trackPageHit)
|
|
275
|
-
const his = window.history
|
|
276
|
-
if (his.pushState) {
|
|
277
|
-
const originalPushState = his['pushState']
|
|
278
|
-
his.pushState = function () {
|
|
279
|
-
originalPushState.apply(this, arguments)
|
|
280
|
-
_trackPageHit()
|
|
281
|
-
}
|
|
282
|
-
window.addEventListener('popstate', _trackPageHit)
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
let lastPage
|
|
286
|
-
function handleVisibilityChange() {
|
|
287
|
-
if (!lastPage && document.visibilityState === 'visible') {
|
|
288
|
-
_trackPageHit()
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
if (document.visibilityState === 'prerender') {
|
|
293
|
-
document.addEventListener('visibilitychange', handleVisibilityChange)
|
|
294
|
-
} else {
|
|
295
|
-
_trackPageHit()
|
|
296
|
-
}
|
|
297
|
-
})()
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// const debug = require('@tryghost/debug')('comments-counts-assets');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const logging = require('@tryghost/logging');
|
|
5
|
-
const config = require('../../../shared/config');
|
|
6
|
-
const urlUtils = require('../../../shared/url-utils');
|
|
7
|
-
|
|
8
|
-
const Minifier = require('./Minifier');
|
|
9
|
-
const AssetsMinificationBase = require('./AssetsMinificationBase');
|
|
10
|
-
|
|
11
|
-
module.exports = class AdminAuthAssets extends AssetsMinificationBase {
|
|
12
|
-
constructor(options = {}) {
|
|
13
|
-
super(options);
|
|
14
|
-
|
|
15
|
-
this.src = options.src || path.join(config.get('paths').assetSrc, 'admin-auth');
|
|
16
|
-
/** @private */
|
|
17
|
-
this.dest = options.dest || path.join(config.getContentPath('public'), 'admin-auth');
|
|
18
|
-
|
|
19
|
-
this.minifier = new Minifier({src: this.src, dest: this.dest});
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
// TODO: don't do this synchronously
|
|
23
|
-
fs.mkdirSync(this.dest, {recursive: true});
|
|
24
|
-
fs.copyFileSync(path.join(this.src, 'index.html'), path.join(this.dest, 'index.html'));
|
|
25
|
-
} catch (error) {
|
|
26
|
-
if (error.code === 'EACCES') {
|
|
27
|
-
logging.error('Ghost was not able to write admin-auth asset files due to permissions.');
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @override
|
|
37
|
-
*/
|
|
38
|
-
generateGlobs() {
|
|
39
|
-
return {
|
|
40
|
-
'admin-auth.min.js': '*.js'
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @private
|
|
46
|
-
*/
|
|
47
|
-
generateReplacements() {
|
|
48
|
-
// Clean the URL, only keep schema, host and port (without trailing slashes or subdirectory)
|
|
49
|
-
const url = new URL(urlUtils.getSiteUrl());
|
|
50
|
-
const origin = url.origin;
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
// Properly encode the origin
|
|
54
|
-
'\'{{SITE_ORIGIN}}\'': JSON.stringify(origin)
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Minify, move into the destination directory, and clear existing asset files.
|
|
60
|
-
*
|
|
61
|
-
* @override
|
|
62
|
-
* @returns {Promise<void>}
|
|
63
|
-
*/
|
|
64
|
-
async load() {
|
|
65
|
-
const globs = this.generateGlobs();
|
|
66
|
-
const replacements = this.generateReplacements();
|
|
67
|
-
await this.minify(globs, {replacements});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const config = require('../../../shared/config');
|
|
3
|
-
const Minifier = require('./Minifier');
|
|
4
|
-
const AssetsMinificationBase = require('./AssetsMinificationBase');
|
|
5
|
-
|
|
6
|
-
module.exports = class CommentCountsAssets extends AssetsMinificationBase {
|
|
7
|
-
constructor(options = {}) {
|
|
8
|
-
super(options);
|
|
9
|
-
|
|
10
|
-
this.src = options.src || path.join(config.get('paths').assetSrc, 'comment-counts');
|
|
11
|
-
this.dest = options.dest || config.getContentPath('public');
|
|
12
|
-
this.minifier = new Minifier({src: this.src, dest: this.dest});
|
|
13
|
-
|
|
14
|
-
this.files = [];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @override
|
|
19
|
-
*/
|
|
20
|
-
generateGlobs() {
|
|
21
|
-
return {
|
|
22
|
-
'comment-counts.min.js': 'js/*.js'
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @override
|
|
28
|
-
*/
|
|
29
|
-
async load() {
|
|
30
|
-
const globs = this.generateGlobs();
|
|
31
|
-
this.files = await this.minify(globs);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const config = require('../../../shared/config');
|
|
3
|
-
const Minifier = require('./Minifier');
|
|
4
|
-
const AssetsMinificationBase = require('./AssetsMinificationBase');
|
|
5
|
-
|
|
6
|
-
module.exports = class MemberAttributionAssets extends AssetsMinificationBase {
|
|
7
|
-
constructor(options = {}) {
|
|
8
|
-
super(options);
|
|
9
|
-
|
|
10
|
-
/** @private */
|
|
11
|
-
this.src = options.src || path.join(config.get('paths').assetSrc, 'member-attribution');
|
|
12
|
-
/** @private */
|
|
13
|
-
this.dest = options.dest || config.getContentPath('public');
|
|
14
|
-
|
|
15
|
-
this.minifier = new Minifier({src: this.src, dest: this.dest});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @override
|
|
20
|
-
*/
|
|
21
|
-
generateGlobs() {
|
|
22
|
-
return {
|
|
23
|
-
'member-attribution.min.js': '*.js'
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* @private
|
|
29
|
-
*/
|
|
30
|
-
generateReplacements() {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Minify, move into the destination directory, and clear existing asset files.
|
|
36
|
-
*
|
|
37
|
-
* @override
|
|
38
|
-
* @returns {Promise<void>}
|
|
39
|
-
*/
|
|
40
|
-
async load() {
|
|
41
|
-
const globs = this.generateGlobs();
|
|
42
|
-
const replacements = this.generateReplacements();
|
|
43
|
-
await this.minify(globs, {replacements});
|
|
44
|
-
}
|
|
45
|
-
};
|
|
File without changes
|