mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(federation): 🐛 Fix new notes being federated to ALL remote users, regardless of visibility
This commit is contained in:
parent
2f823317c2
commit
558ae72c82
|
|
@ -2,9 +2,6 @@ import type { Undo } from "@lysand-org/federation/types";
|
||||||
import { config } from "config-manager";
|
import { config } from "config-manager";
|
||||||
import type { User } from "~/packages/database-interface/user";
|
import type { User } from "~/packages/database-interface/user";
|
||||||
|
|
||||||
export const localObjectUri = (id: string) =>
|
|
||||||
new URL(`/objects/${id}`, config.http.base_url).toString();
|
|
||||||
|
|
||||||
export const undoFederationRequest = (undoer: User, uri: string): Undo => {
|
export const undoFederationRequest = (undoer: User, uri: string): Undo => {
|
||||||
const id = crypto.randomUUID();
|
const id = crypto.randomUUID();
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import { idValidator } from "@/api";
|
import { idValidator } from "@/api";
|
||||||
|
import { localObjectUri } from "@/constants";
|
||||||
import { proxyUrl } from "@/response";
|
import { proxyUrl } from "@/response";
|
||||||
import { sanitizedHtmlStrip } from "@/sanitization";
|
import { sanitizedHtmlStrip } from "@/sanitization";
|
||||||
import { sentry } from "@/sentry";
|
import { sentry } from "@/sentry";
|
||||||
|
|
@ -29,7 +30,6 @@ import {
|
||||||
type Application,
|
type Application,
|
||||||
applicationToApi,
|
applicationToApi,
|
||||||
} from "~/classes/functions/application";
|
} from "~/classes/functions/application";
|
||||||
import { localObjectUri } from "~/classes/functions/federation";
|
|
||||||
import {
|
import {
|
||||||
type StatusWithRelations,
|
type StatusWithRelations,
|
||||||
contentToHtml,
|
contentToHtml,
|
||||||
|
|
@ -230,7 +230,7 @@ export class Note extends BaseInterface<typeof Notes, StatusWithRelations> {
|
||||||
relationships: {
|
relationships: {
|
||||||
where: (relationship, { eq, and }) =>
|
where: (relationship, { eq, and }) =>
|
||||||
and(
|
and(
|
||||||
eq(relationship.subjectId, Users.id),
|
eq(relationship.subjectId, this.data.authorId),
|
||||||
eq(relationship.following, true),
|
eq(relationship.following, true),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,6 @@ import { config } from "config-manager";
|
||||||
|
|
||||||
export const oauthRedirectUri = (issuer: string) =>
|
export const oauthRedirectUri = (issuer: string) =>
|
||||||
new URL(`/oauth/sso/${issuer}/callback`, config.http.base_url).toString();
|
new URL(`/oauth/sso/${issuer}/callback`, config.http.base_url).toString();
|
||||||
|
|
||||||
|
export const localObjectUri = (id: string) =>
|
||||||
|
new URL(`/objects/${id}`, config.http.base_url).toString();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue