Skip to content
This repository was archived by the owner on Aug 21, 2024. It is now read-only.

Commit 8357869

Browse files
committed
Merge branch 'dev' into three157
2 parents f19c5df + c527664 commit 8357869

12 files changed

Lines changed: 50 additions & 79 deletions

File tree

β€Žpackages/client-core/src/common/services/RouterService.tsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ export type CustomRoute = {
5454
* @return {Promise}
5555
*/
5656
export const getCustomRoutes = async (): Promise<CustomRoute[]> => {
57-
const routes = (await Engine.instance.api.service(routePath).find({ query: { paginate: false } })) as RouteType[]
57+
const routes = (await Engine.instance.api
58+
.service(routePath)
59+
.find({ query: { paginate: false } })) as any as RouteType[]
5860
console.log(routes)
5961

6062
const elements: CustomRoute[] = []

β€Žpackages/editor/src/functions/takeScreenshot.tsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ export async function takeScreenshot(
192192
scenePreviewCamera.layers.disableAll()
193193
scenePreviewCamera.layers.set(ObjectLayers.Scene)
194194

195-
const selection = EngineRenderer.instance.effectComposer.HighlightEffect.selection.values()
195+
const selection = EngineRenderer.instance.effectComposer.HighlightEffect?.selection.values()
196196
if (hideHelpers) {
197-
EngineRenderer.instance.effectComposer.HighlightEffect.clearSelection()
197+
EngineRenderer.instance.effectComposer.HighlightEffect?.clearSelection()
198198
}
199199

200200
const originalSize = EngineRenderer.instance.renderer.getSize(new Vector2())
@@ -230,7 +230,7 @@ export async function takeScreenshot(
230230
EngineRenderer.instance.effectComposer.render()
231231

232232
if (hideHelpers) {
233-
EngineRenderer.instance.effectComposer.HighlightEffect.setSelection(selection)
233+
EngineRenderer.instance.effectComposer.HighlightEffect?.setSelection(selection)
234234
}
235235

236236
const canvas = getResizedCanvas(EngineRenderer.instance.renderer.domElement, width, height)

β€Žpackages/server-core/src/media/oembed/oembed.class.tsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export class OembedService implements ServiceInterface<OembedType | BadRequest |
7070
query_url: queryURL
7171
} as OembedType
7272

73-
const activeRoutes = (await this.app.service(routePath).find({ query: { paginate: false } })) as RouteType[]
73+
const activeRoutes = (await this.app
74+
.service(routePath)
75+
.find({ query: { paginate: false } })) as any as RouteType[]
7476
const uniqueProjects = [...new Set<string>(activeRoutes.map((item) => item.project))]
7577

7678
for (const projectName of uniqueProjects) {

β€Žpackages/server-core/src/route/route/route.class.tsβ€Ž

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,51 +23,17 @@ All portions of the code written by the Ethereal Engine team are Copyright Β© 20
2323
Ethereal Engine. All Rights Reserved.
2424
*/
2525

26-
import type { NullableId, Params } from '@feathersjs/feathers'
27-
import type { KnexAdapterOptions } from '@feathersjs/knex'
28-
import { KnexAdapter, KnexAdapterParams } from '@feathersjs/knex'
26+
import type { Params } from '@feathersjs/feathers'
27+
import { KnexAdapterParams, KnexService } from '@feathersjs/knex'
2928

3029
import { RouteData, RoutePatch, RouteQuery, RouteType } from '@etherealengine/engine/src/schemas/route/route.schema'
31-
import { Id } from '@feathersjs/feathers'
32-
import { Application } from '../../../declarations'
3330

3431
// eslint-disable-next-line @typescript-eslint/no-empty-interface
3532
export interface RouteParams extends KnexAdapterParams<RouteQuery> {}
3633

37-
export class RouteService<T = RouteType, ServiceParams extends Params = RouteParams> extends KnexAdapter<
34+
export class RouteService<T = RouteType, ServiceParams extends Params = RouteParams> extends KnexService<
3835
RouteType,
3936
RouteData,
4037
RouteParams,
4138
RoutePatch
42-
> {
43-
app: Application
44-
45-
constructor(options: KnexAdapterOptions, app: Application) {
46-
super(options)
47-
this.app = app
48-
}
49-
50-
async find(params?: RouteParams) {
51-
if (params?.query?.paginate != null) {
52-
if (params.query.paginate === false) params.paginate = params.query.paginate
53-
delete params.query.paginate
54-
}
55-
return super._find(params)
56-
}
57-
58-
async create(data: RouteData, params?: RouteParams) {
59-
return super._create(data, params)
60-
}
61-
62-
async get(id: Id, params?: RouteParams) {
63-
return super._get(id, params)
64-
}
65-
66-
async patch(id: Id, data: RouteData, params?: RouteParams) {
67-
return super._patch(id, data, params)
68-
}
69-
70-
async remove(id: NullableId, params?: RouteParams) {
71-
return super._remove(id, params)
72-
}
73-
}
39+
> {}

β€Žpackages/server-core/src/route/route/route.hooks.tsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
routeQueryValidator
3333
} from '@etherealengine/engine/src/schemas/route/route.schema'
3434

35+
import enableClientPagination from '../../hooks/enable-client-pagination'
3536
import verifyScope from '../../hooks/verify-scope'
3637
import {
3738
routeDataResolver,
@@ -48,7 +49,7 @@ export default {
4849

4950
before: {
5051
all: [() => schemaHooks.validateQuery(routeQueryValidator), schemaHooks.resolveQuery(routeQueryResolver)],
51-
find: [],
52+
find: [enableClientPagination()],
5253
get: [],
5354
create: [
5455
iff(isProvider('external'), verifyScope('admin', 'admin')),

β€Žpackages/server-core/src/route/route/route.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default (app: Application): void => {
123123
multi: true
124124
}
125125

126-
app.use(routePath, new RouteService(options, app), {
126+
app.use(routePath, new RouteService(options), {
127127
// A list of all methods this service exposes externally
128128
methods: routeMethods,
129129
// You can add additional custom events to be sent to clients here

β€Žpackages/server-core/src/user/identity-provider/identity-provider.class.tsβ€Ž

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ import { scopePath, ScopeType } from '@etherealengine/engine/src/schemas/scope/s
4444
import { userPath, UserType } from '@etherealengine/engine/src/schemas/user/user.schema'
4545
import { Application } from '../../../declarations'
4646

47+
import { scopeTypePath } from '@etherealengine/engine/src/schemas/scope/scope-type.schema'
4748
import { KnexAdapterParams } from '@feathersjs/knex'
4849
import appConfig from '../../appconfig'
49-
import { scopeTypeSeed } from '../../scope/scope-type/scope-type.seed'
5050
import getFreeInviteCode from '../../util/get-free-invite-code'
5151

5252
export interface IdentityProviderParams extends KnexAdapterParams<IdentityProviderQuery> {
@@ -255,7 +255,11 @@ export class IdentityProviderService<
255255
.createAccessToken({}, { subject: result.id.toString() })
256256
} else if (isDev && type === 'admin') {
257257
// in dev mode, add all scopes to the first user made an admin
258-
const data = scopeTypeSeed.map(({ type }) => {
258+
const scopeTypes = await this.app.service(scopeTypePath).find({
259+
paginate: false
260+
})
261+
262+
const data = scopeTypes.map(({ type }) => {
259263
return { userId, type }
260264
})
261265
await this.app.service(scopePath).create(data)

β€Žpackages/server-core/src/user/login-token/login-token.class.tsβ€Ž

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ Ethereal Engine. All Rights Reserved.
2424
*/
2525

2626
import type { Params } from '@feathersjs/feathers'
27-
import type { KnexAdapterOptions } from '@feathersjs/knex'
28-
import { KnexAdapter } from '@feathersjs/knex'
29-
import crypto from 'crypto'
30-
import moment from 'moment'
31-
import config from '../../appconfig'
27+
import { KnexService } from '@feathersjs/knex'
3228

3329
import {
3430
LoginTokenData,
@@ -38,8 +34,6 @@ import {
3834
} from '@etherealengine/engine/src/schemas/user/login-token.schema'
3935

4036
import { KnexAdapterParams } from '@feathersjs/knex'
41-
import { Application } from '../../../declarations'
42-
import { toDateTimeSql } from '../../util/datetime-sql'
4337

4438
// eslint-disable-next-line @typescript-eslint/no-empty-interface
4539
export interface LoginTokenParams extends KnexAdapterParams<LoginTokenQuery> {}
@@ -48,21 +42,9 @@ export interface LoginTokenParams extends KnexAdapterParams<LoginTokenQuery> {}
4842
* A class for LoginToken service
4943
*/
5044

51-
export class LoginTokenService<T = LoginTokenType, ServiceParams extends Params = LoginTokenParams> extends KnexAdapter<
45+
export class LoginTokenService<T = LoginTokenType, ServiceParams extends Params = LoginTokenParams> extends KnexService<
5246
LoginTokenType,
5347
LoginTokenData,
5448
LoginTokenParams,
5549
LoginTokenPatch
56-
> {
57-
app: Application
58-
59-
constructor(options: KnexAdapterOptions, app: Application) {
60-
super(options)
61-
this.app = app
62-
}
63-
async create(data: LoginTokenData, params?: LoginTokenParams) {
64-
const token = crypto.randomBytes(config.authentication.bearerToken.numBytes).toString('hex')
65-
66-
return await super._create({ ...data, token, expiresAt: toDateTimeSql(moment().utc().add(2, 'days').toDate()) })
67-
}
68-
}
50+
> {}

β€Žpackages/server-core/src/user/login-token/login-token.resolvers.tsβ€Ž

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ import { v4 } from 'uuid'
3030
import { LoginTokenQuery, LoginTokenType } from '@etherealengine/engine/src/schemas/user/login-token.schema'
3131
import type { HookContext } from '@etherealengine/server-core/declarations'
3232

33-
import { fromDateTimeSql, getDateTimeSql } from '../../util/datetime-sql'
33+
import crypto from 'crypto'
34+
import moment from 'moment'
35+
import config from '../../appconfig'
36+
import { fromDateTimeSql, getDateTimeSql, toDateTimeSql } from '../../util/datetime-sql'
3437

3538
export const loginTokenResolver = resolve<LoginTokenType, HookContext>({
3639
expiresAt: virtual(async (loginToken) => fromDateTimeSql(loginToken.expiresAt)),
@@ -44,6 +47,13 @@ export const loginTokenDataResolver = resolve<LoginTokenType, HookContext>({
4447
id: async () => {
4548
return v4()
4649
},
50+
token: async () => {
51+
return crypto.randomBytes(config.authentication.bearerToken.numBytes).toString('hex')
52+
},
53+
expiresAt: async (value, message, context) => {
54+
console.log('expiresAt context', context)
55+
return context.data.expiresAt ? context.data.expiresAt : toDateTimeSql(moment().utc().add(2, 'days').toDate())
56+
},
4757
createdAt: getDateTimeSql,
4858
updatedAt: getDateTimeSql
4959
})

β€Žpackages/server-core/src/user/login-token/login-token.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default (app: Application): void => {
4444
multi: true
4545
}
4646

47-
app.use(loginTokenPath, new LoginTokenService(options, app), {
47+
app.use(loginTokenPath, new LoginTokenService(options), {
4848
// A list of all methods this service exposes externally
4949
methods: loginTokenMethods,
5050
// You can add additional custom events to be sent to clients here

0 commit comments

Comments
Β (0)