diff --git a/package.json b/package.json index d926ee8110ed..cdabcc9d2ef2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "2024.5.0-host.4", + "version": "2024.5.0-host.4a", "codename": "nasubi", "repository": { "type": "git", diff --git a/packages/backend/src/server/sso/SAMLIdentifyProviderService.ts b/packages/backend/src/server/sso/SAMLIdentifyProviderService.ts index 60ce37d8eaa8..dbf004e27f0e 100644 --- a/packages/backend/src/server/sso/SAMLIdentifyProviderService.ts +++ b/packages/backend/src/server/sso/SAMLIdentifyProviderService.ts @@ -495,14 +495,28 @@ export class SAMLIdentifyProviderService { '#text': user.id, }, }, - ...(user.name ? [{ + { + '@Name': 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn', + 'saml:AttributeValue': { + '@xsi:type': 'xs:string', + '#text': user.id, + }, + }, + { '@Name': 'firstName', '@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', 'saml:AttributeValue': { '@xsi:type': 'xs:string', - '#text': user.name, + '#text': user.name ? user.name : 'Misskey User', }, - }] : []), + }, + { + '@Name': 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname', + 'saml:AttributeValue': { + '@xsi:type': 'xs:string', + '#text': user.name ? user.name : 'Misskey User', + }, + }, { '@Name': 'lastName', '@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', @@ -511,6 +525,13 @@ export class SAMLIdentifyProviderService { '#text': `@${user.username}`, }, }, + { + '@Name': 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname', + 'saml:AttributeValue': { + '@xsi:type': 'xs:string', + '#text': `@${user.username}`, + }, + }, { '@Name': 'displayName', '@NameFormat': 'urn:oasis:names:tc:SAML:2.0:attrname-format:basic', diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts index c11e6e91257b..a34a70df0e10 100644 --- a/packages/frontend/src/account.ts +++ b/packages/frontend/src/account.ts @@ -14,7 +14,7 @@ import { apiUrl } from '@/config.js'; import { waiting, popup, popupMenu, success, alert } from '@/os.js'; import { generateClientTransactionId, misskeyApi } from '@/scripts/misskey-api.js'; import { unisonReload, reloadChannel } from '@/scripts/unison-reload.js'; -import { set as gtagSet } from 'vue-gtag'; +import { set as gtagSet, time as gtagTime } from 'vue-gtag'; import { instance } from '@/instance.js'; // TODO: 他のタブと永続化されたstateを同期 @@ -53,6 +53,7 @@ export async function signout() { const registration = await navigator.serviceWorker.ready; const push = await registration.pushManager.getSubscription(); if (push) { + const initiateTime = Date.now(); await window.fetch(`${apiUrl}/sw/unregister`, { method: 'POST', body: JSON.stringify({ @@ -63,6 +64,14 @@ export async function signout() { 'Content-Type': 'application/json', 'X-Client-Transaction-Id': generateClientTransactionId('misskey'), }, + }).then(() => { + if (instance.googleAnalyticsId) { + gtagTime({ + name: 'api', + event_category: '/sw/unregister', + value: Date.now() - initiateTime, + }); + } }); } } @@ -105,6 +114,7 @@ export async function removeAccount(idOrToken: Account['id']) { function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Promise { return new Promise((done, fail) => { + const initiateTime = Date.now(); window.fetch(`${apiUrl}/i`, { method: 'POST', body: JSON.stringify({ @@ -115,6 +125,16 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr 'X-Client-Transaction-Id': generateClientTransactionId('misskey'), }, }) + .then(res => { + if (instance.googleAnalyticsId) { + gtagTime({ + name: 'api', + event_category: '/i', + value: Date.now() - initiateTime, + }); + } + return res; + }) .then(res => new Promise }>((done2, fail2) => { if (res.status >= 500 && res.status < 600) { // サーバーエラー(5xx)の場合をrejectとする diff --git a/packages/frontend/src/boot/common.ts b/packages/frontend/src/boot/common.ts index 421619d928be..79ef7b3f2d67 100644 --- a/packages/frontend/src/boot/common.ts +++ b/packages/frontend/src/boot/common.ts @@ -270,6 +270,8 @@ export async function common(createVue: () => App) { app.use(VueGtag, { bootstrap: false, appName: `Misskey v${version}`, + pageTrackerEnabled: true, + pageTrackerScreenviewEnabled: true, config: { id: instance.googleAnalyticsId, params: { diff --git a/packages/frontend/src/components/MkPageWindow.vue b/packages/frontend/src/components/MkPageWindow.vue index aa4509b14b62..13d03abf30df 100644 --- a/packages/frontend/src/components/MkPageWindow.vue +++ b/packages/frontend/src/components/MkPageWindow.vue @@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only