From 89419c05b27d5419af75b3759bf62e2c4c3a29c3 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sat, 4 Jun 2022 17:26:56 +0900
Subject: [PATCH] use node 16

---
 .node-version                                          | 2 +-
 CHANGELOG.md                                           | 3 ---
 packages/backend/src/models/repositories/drive-file.ts | 4 +++-
 packages/backend/src/server/web/manifest.ts            | 4 +++-
 packages/backend/src/services/relay.ts                 | 8 +++++---
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/.node-version b/.node-version
index 658984787f..c9b6b29e00 100644
--- a/.node-version
+++ b/.node-version
@@ -1 +1 @@
-v18.0.0
+v16.0.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 05158278d0..c58714fd25 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,9 +10,6 @@ You should also include the user name that made the change.
 -->
 
 ## 12.x.x (unreleased)
-### NOTE
-- From this version, Node 18.0.0 or later is required.
-
 ### Improvements
 - Supports Unicode Emoji 14.0 @mei23
 - プッシュ通知を複数アカウント対応に #7667 @tamaina
diff --git a/packages/backend/src/models/repositories/drive-file.ts b/packages/backend/src/models/repositories/drive-file.ts
index b626359d98..0d589d4f11 100644
--- a/packages/backend/src/models/repositories/drive-file.ts
+++ b/packages/backend/src/models/repositories/drive-file.ts
@@ -29,7 +29,9 @@ export const DriveFileRepository = db.getRepository(DriveFile).extend({
 
 	getPublicProperties(file: DriveFile): DriveFile['properties'] {
 		if (file.properties.orientation != null) {
-			const properties = structuredClone(file.properties);
+			// TODO
+			//const properties = structuredClone(file.properties);
+			const properties = JSON.parse(JSON.stringify(file.properties));
 			if (file.properties.orientation >= 5) {
 				[properties.width, properties.height] = [properties.height, properties.width];
 			}
diff --git a/packages/backend/src/server/web/manifest.ts b/packages/backend/src/server/web/manifest.ts
index 61d7660066..ee568b8077 100644
--- a/packages/backend/src/server/web/manifest.ts
+++ b/packages/backend/src/server/web/manifest.ts
@@ -3,7 +3,9 @@ import { fetchMeta } from '@/misc/fetch-meta.js';
 import manifest from './manifest.json' assert { type: 'json' };
 
 export const manifestHandler = async (ctx: Koa.Context) => {
-	const res = structuredClone(manifest);
+	// TODO
+	//const res = structuredClone(manifest);
+	const res = JSON.parse(JSON.stringify(manifest));
 
 	const instance = await fetchMeta(true);
 
diff --git a/packages/backend/src/services/relay.ts b/packages/backend/src/services/relay.ts
index 08bf72cc26..6bc4304436 100644
--- a/packages/backend/src/services/relay.ts
+++ b/packages/backend/src/services/relay.ts
@@ -1,4 +1,4 @@
-import { createSystemUser } from './create-system-user.js';
+import { IsNull } from 'typeorm';
 import { renderFollowRelay } from '@/remote/activitypub/renderer/follow-relay.js';
 import { renderActivity, attachLdSignature } from '@/remote/activitypub/renderer/index.js';
 import renderUndo from '@/remote/activitypub/renderer/undo.js';
@@ -8,7 +8,7 @@ import { Users, Relays } from '@/models/index.js';
 import { genId } from '@/misc/gen-id.js';
 import { Cache } from '@/misc/cache.js';
 import { Relay } from '@/models/entities/relay.js';
-import { IsNull } from 'typeorm';
+import { createSystemUser } from './create-system-user.js';
 
 const ACTOR_USERNAME = 'relay.actor' as const;
 
@@ -88,7 +88,9 @@ export async function deliverToRelays(user: { id: User['id']; host: null; }, act
 	}));
 	if (relays.length === 0) return;
 
-	const copy = structuredClone(activity);
+	// TODO
+	//const copy = structuredClone(activity);
+	const copy = JSON.parse(JSON.stringify(activity));
 	if (!copy.to) copy.to = ['https://www.w3.org/ns/activitystreams#Public'];
 
 	const signed = await attachLdSignature(copy, user);