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

Project Orgname Support #10396

Merged
merged 138 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
ccae33e
Remove sid field from static-resource table
HexaField Jun 3, 2024
1199c8d
move getCachedURL and getCacheDomain to storage provider interface, h…
HexaField Jun 3, 2024
6640ba2
resolve url
HexaField Jun 3, 2024
ded0117
fix avatars and tsc errors
HexaField Jun 3, 2024
bd63396
local upload changes
HexaField Jun 3, 2024
389a8e2
Merge branch 'dev' into cms-refactor
HexaField Jun 3, 2024
3f26fba
add more info to resource json and static resources
HexaField Jun 4, 2024
058df46
fixes
HexaField Jun 4, 2024
64482de
fix seeding
HexaField Jun 4, 2024
c7cdcb3
migration convert assets to static resources, fix reinit to wipe DB c…
HexaField Jun 4, 2024
b0bef50
Merge branch 'dev' into cms-refactor
HexaField Jun 4, 2024
f0babda
Merge branch 'dev' into cms-refactor
HexaField Jun 4, 2024
efaf2e1
fixes
HexaField Jun 5, 2024
2298c61
fixes to seeder, avatar install and uploading local to storage provider
HexaField Jun 6, 2024
446a63e
license
HexaField Jun 6, 2024
a32e3a2
Merge branch 'dev' into cms-refactor
HexaField Jun 6, 2024
76e4b55
use static resource service instead of asset service
HexaField Jun 6, 2024
68bc37f
bug fixes
HexaField Jun 7, 2024
40fa785
more simplification and refactoring
HexaField Jun 7, 2024
b0834a5
remove unused asset service
HexaField Jun 7, 2024
49e2998
bug fixes, simplification
HexaField Jun 7, 2024
0069e6f
bug fixes for types
HexaField Jun 7, 2024
436a161
refactoring file browser
HexaField Jun 10, 2024
85aad20
license
HexaField Jun 10, 2024
2144f74
Merge branch 'dev' into cms-refactor
HexaField Jun 10, 2024
29b03ae
dynamically handle org name in file browser ui (#10354)
aditya-mitra Jun 10, 2024
936db7b
file upload and other fixes
HexaField Jun 10, 2024
fe362f5
tsc fix
HexaField Jun 10, 2024
4a1d7f0
fix merge conflict
HexaField Jun 10, 2024
6546ae1
test fixes
HexaField Jun 10, 2024
c9fcf6f
fix project upload
HexaField Jun 11, 2024
72b9440
various fixes
HexaField Jun 11, 2024
71d68bf
file browser works with orgs
HexaField Jun 11, 2024
941035b
clean up
HexaField Jun 11, 2024
219d8ee
update resources json in hooks
HexaField Jun 11, 2024
da8f312
Merge branch 'dev' into cms-refactor
HexaField Jun 11, 2024
3c12617
Merge branch 'dev' into cms-refactor
HexaField Jun 11, 2024
972cd25
bug fixes
HexaField Jun 11, 2024
b6ead5f
fixes
HexaField Jun 11, 2024
979ddad
fixes for update method and tests
HexaField Jun 11, 2024
7b08b12
Merge branch 'dev' into cms-refactor
HexaField Jun 11, 2024
2080df2
improve file browser tests
HexaField Jun 12, 2024
7c0a6de
bug fixes
HexaField Jun 12, 2024
de17644
fix rename scene
HexaField Jun 12, 2024
e3eb963
Merge branch 'dev' into cms-refactor
HexaField Jun 12, 2024
877df44
Merge branch 'dev' into cms-refactor
HexaField Jun 12, 2024
399d925
tsc err
HexaField Jun 13, 2024
38c5187
fix rename
HexaField Jun 13, 2024
5ffdc16
Merge branch 'dev' into cms-refactor
HexaField Jun 13, 2024
6331c12
Merge branch 'dev' into cms-refactor
HexaField Jun 14, 2024
1438bd3
fix saving scenes
HexaField Jun 14, 2024
2093e28
fix thumbnail gen
HexaField Jun 14, 2024
24933d1
Merge branch 'dev' into cms-refactor
HexaField Jun 14, 2024
fd6ba2b
fix delete scene and rename scene
HexaField Jun 14, 2024
a73ff73
cleanup logs
HexaField Jun 14, 2024
6a3df40
Merge branch 'dev' into cms-refactor
HexaField Jun 14, 2024
767193a
Merge branch 'dev' into cms-refactor
HexaField Jun 14, 2024
f485257
optimize location query, improve export, add back removed delete for …
HexaField Jun 14, 2024
1cb6260
fix projectEventHooks
HexaField Jun 14, 2024
611139f
fix projectEventHooks
HexaField Jun 14, 2024
fd5eb9e
Merge branch 'dev' into cms-refactor
HexaField Jun 15, 2024
5cbc43f
remove knex transaction from migration
HexaField Jun 15, 2024
73211be
remove console log
HexaField Jun 15, 2024
63052dc
Merge branch 'dev' into cms-refactor
HexaField Jun 15, 2024
8825426
fixes
HexaField Jun 15, 2024
9c46994
trying migrations
HexaField Jun 15, 2024
63b83aa
fix bug with migrating resources
HexaField Jun 15, 2024
1242c75
optimize single static resource updates to resources.json
HexaField Jun 15, 2024
8d6ae12
Merge branch 'dev' into cms-refactor
HexaField Jun 15, 2024
4402d71
support projects with orgname for local dev and migrate default project
HexaField Jun 16, 2024
8e92172
route seeds
HexaField Jun 16, 2024
259672e
fix workspace and projects
HexaField Jun 16, 2024
1ab2bde
fix lerna and pnpm
HexaField Jun 16, 2024
4618c25
fix default project tsconfig
HexaField Jun 16, 2024
e7037a2
scripts and ui
HexaField Jun 16, 2024
1931214
update create project
HexaField Jun 16, 2024
15de684
Merge branch 'dev' into cms-refactor
HexaField Jun 17, 2024
fa0a473
add thumbnail key field alongside thumbnail url
HexaField Jun 17, 2024
52810f3
Merge branch 'cms-refactor' into project-orgnames
HexaField Jun 17, 2024
7817ff5
fix file browser tests
HexaField Jun 17, 2024
f6110ab
Merge branch 'dev' into cms-refactor
HexaField Jun 17, 2024
5466542
Merge branch 'cms-refactor' into project-orgnames
HexaField Jun 17, 2024
6bf5d2f
dont always generate resources json
HexaField Jun 17, 2024
82617c0
fix for manifest
HexaField Jun 17, 2024
bed8ad1
Merge branch 'dev' into cms-refactor
HexaField Jun 17, 2024
6c23b25
fix bugs with updating resources json
HexaField Jun 17, 2024
cce7868
ensure new scenes have unique names and include thumbnail
HexaField Jun 18, 2024
343124b
fix pagination and reactivity
HexaField Jun 18, 2024
95e245c
type fix
HexaField Jun 18, 2024
e4214b4
Merge branch 'cms-refactor' into project-orgnames
HexaField Jun 18, 2024
be88424
Merge branch 'dev' into cms-refactor
HexaField Jun 18, 2024
ac268c1
Merge branch 'cms-refactor' into project-orgnames
HexaField Jun 18, 2024
cb4cd59
Merge branch 'dev' into project-orgnames
HexaField Jun 18, 2024
ab74817
Merge branch 'dev' into project-orgnames
HexaField Jun 19, 2024
1008e5b
Merge branch 'dev' into project-orgnames
HexaField Jun 19, 2024
b20d5e5
Merge branch 'dev' into project-orgnames
HexaField Jun 20, 2024
55a39bf
Merge branch 'dev' into project-orgnames
HexaField Jun 26, 2024
ed89122
Merge branch 'dev' into project-orgnames
HexaField Jun 28, 2024
c293339
Merge branch 'dev' into project-orgnames
HexaField Jun 28, 2024
0985c2f
Merge branch 'dev' into project-orgnames
HexaField Jun 29, 2024
5d1cfa0
Merge branch 'dev' into project-orgnames
HexaField Jun 30, 2024
6485064
Merge branch 'dev' into project-orgnames
HexaField Jul 6, 2024
e5efc98
Merge branch 'dev' into project-orgnames
MoizAdnan Jul 29, 2024
90eb8fd
Moved default-project to org
MoizAdnan Jul 29, 2024
70cf138
Merge branch 'dev' into project-orgnames
MoizAdnan Jul 29, 2024
83fd587
reverted s3 change
MoizAdnan Jul 29, 2024
a38b6ec
Added sourceRepo to project name
MoizAdnan Jul 30, 2024
9795c6b
reverted default-project changes
MoizAdnan Jul 30, 2024
6bbdd46
Fixed regex tests
MoizAdnan Jul 30, 2024
fd02f60
Updated projects class
MoizAdnan Jul 30, 2024
8150516
updated project name cleaning
MoizAdnan Jul 30, 2024
4dba66e
Disable create project button
MoizAdnan Jul 30, 2024
143654e
Added migration for deployments
MoizAdnan Jul 31, 2024
d25bb17
Updated addOrgNameToProject
MoizAdnan Jul 31, 2024
b21fb20
updated regex
MoizAdnan Aug 1, 2024
9c8fccb
fixed regex tests
MoizAdnan Aug 1, 2024
6f98f40
reverted source.name
MoizAdnan Aug 1, 2024
6494747
Updated tests
MoizAdnan Aug 1, 2024
c197302
fixed github push test
MoizAdnan Aug 1, 2024
a04b888
fixed route test
MoizAdnan Aug 1, 2024
968dbdf
Merge branch 'dev' into project-orgnames
HexaField Aug 16, 2024
9f48060
merge conflicts, update resources json
HexaField Aug 16, 2024
71fda80
try to make cicd happy by ignoring project check errors
HexaField Aug 16, 2024
f4898d1
try to make cicd happy by ignoring project check errors
HexaField Aug 16, 2024
88e0fd8
add clone project helper script
HexaField Aug 16, 2024
5ff3b69
refactor: Remove commented code for project name check
MoizAdnan Aug 16, 2024
f80c26e
Merge branch 'dev' into project-orgnames
HexaField Aug 16, 2024
bfbd238
Added project name in regex tests
hanzlamateen Aug 17, 2024
b8fea9a
remove @ from folder name
HexaField Aug 17, 2024
9a3a98f
create root package json
HexaField Aug 17, 2024
f2c2e79
Update github action to include org name in checkout
hanzlamateen Aug 17, 2024
4b77f59
update orgname migration and revert changes to old migration
HexaField Aug 17, 2024
d5699d7
Merge branch 'dev' into project-orgnames
HexaField Aug 17, 2024
3bc1ef8
update project build script
HexaField Aug 18, 2024
5645bb8
update ts config
HexaField Aug 18, 2024
bf45ddc
bug fix for backend services not running
HexaField Aug 18, 2024
3fe2fd2
octokit test standardization
HexaField Aug 18, 2024
57ddebb
uncomment code used to bypas restriction for testing
HexaField Aug 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/branch-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
key: dir-${{github.sha}}
- run: npm run dev-docker
- run: npm run dev-reinit
- run: npm run check-errors
- run: npx lerna run --scope '@etherealengine/*' check-errors
timeout-minutes: 20

build-client:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/projects-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: etherealengine/ee-development-test-suite
path: './packages/projects/projects/ee-development-test-suite'
path: './packages/projects/projects/etherealengine/ee-development-test-suite'
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -43,7 +43,7 @@ jobs:
- run: cp .env.local.default .env.local
- run: npm install --production=false --loglevel notice --legacy-peer-deps
- run: npm run lint
- run: npm run check-errors
- run: npx lerna run --scope '@etherealengine/*' check-errors
- run: npm run check-eslint
- run: npm run dev-docker
- run: npm run dev-reinit
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"packages": [
"packages/*",
"packages/projects/projects/*"
"packages/projects/projects/**"
],
"version": "1.6.0",
"npmClient": "npm",
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"workspaces": [
"packages/*",
"packages/projects/projects/*"
"packages/projects/projects/**"
],
"keywords": [
"three",
Expand Down Expand Up @@ -41,10 +41,11 @@
"scripts": {
"build-client": "cd packages/client && npm run build",
"check": "npm run lint && npm run check-errors && npm run check-eslint && npm run test && npm run build-client",
"check-errors": "tsc --noemit && lerna run --scope '@etherealengine/*' check-errors && lerna run --ignore '@etherealengine/*' check-errors",
"check-errors": "lerna run --scope '@etherealengine/*' check-errors && lerna run --ignore '@etherealengine/*' check-errors",
"check-eslint": "eslint --quiet .",
"checkout-dev": "lerna exec 'git checkout dev' --parallel --no-bail",
"clean-node-modules": "npx rimraf node_modules && npx rimraf package-lock.json && npx lerna exec npx rimraf node_modules && npx lerna exec npx rimraf package-lock.json",
"clone-project": "cross-env ts-node --swc scripts/clone-project.ts",
"create-root-package-json": "cross-env ts-node --swc scripts/create-root-package-json",
"create-project": "cross-env ts-node --swc scripts/create-project",
"depcheck": "lerna exec --no-bail --stream -- depcheck",
Expand All @@ -57,7 +58,7 @@
"dev-docker": "cd scripts && ./start-containers.sh",
"dev-docker-windows": "cd scripts && docker-compose up -d && docker-compose up -d -f docker-compose-minio.yml",
"dev-tabs": "npm run dev-docker && cd scripts && ./dev-tabs.sh",
"fetch-projects": "lerna exec 'git fetch -p && git rebase' --parallel --ignore @etherealengine/* --no-bail",
"fetch-projects": "lerna exec 'git fetch -p && git rebase' --parallel --no-bail",
"dev-reinit": "./scripts/checkenv.sh && npm run dev-docker && cd packages/server && npm run dev-reinit-db",
"dev-server": "cd packages/server && npm run dev",
"dev-windows": "npm run dev-docker-windows && concurrently -n agones,server,client npm:dev-agones-silent npm:dev-server npm:dev-client",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default function ProjectTable(props: { search: string }) {
startIcon={<HiOutlineArrowPath />}
size="small"
className="mr-2 h-min whitespace-pre bg-theme-blue-secondary text-[#214AA6] disabled:opacity-50 dark:text-white"
disabled={project.name === 'default-project'}
disabled={project.name === 'etherealengine/default-project'}
onClick={() =>
PopoverState.showPopupover(
<AddEditProjectModal update={true} inputProject={project} onSubmit={handleProjectUpdate} />
Expand All @@ -135,7 +135,7 @@ export default function ProjectTable(props: { search: string }) {
startIcon={<GrGithub />}
size="small"
className="mr-2 h-min whitespace-pre bg-theme-blue-secondary text-[#214AA6] disabled:opacity-50 dark:text-white"
disabled={!project || !project.repositoryPath || project.name === 'default-project'}
disabled={!project || !project.repositoryPath || project.name === 'etherealengine/default-project'}
onClick={() => {
PopoverState.showPopupover(
<ConfirmDialog
Expand Down Expand Up @@ -202,7 +202,7 @@ export default function ProjectTable(props: { search: string }) {
startIcon={<HiOutlineTrash />}
size="small"
className="h-min whitespace-pre bg-theme-blue-secondary text-[#214AA6] disabled:opacity-50 dark:text-white"
disabled={project.name === 'default-project'}
disabled={project.name === 'etherealengine/default-project'}
onClick={() => {
PopoverState.showPopupover(
<ConfirmDialog
Expand Down Expand Up @@ -247,7 +247,7 @@ export default function ProjectTable(props: { search: string }) {
projectVersion: row.version,
enabled: (
<Toggle
disabled={row.name === 'default-project'}
disabled={row.name === 'etherealengine/default-project'}
value={row.enabled}
onChange={() => handleEnabledChange(row)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default function UpdateEngineModal() {
</div>
<div className="grid gap-2">
{projectState.projects.value
.filter((project) => project.name !== 'default-project' && project.repositoryPath)
.filter((project) => project.name !== 'etherealengine/default-project' && project.repositoryPath)
.map((project) => (
<div key={project.id} className="border border-theme-primary bg-theme-surfaceInput px-3.5 py-5">
<Checkbox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { config } from '@etherealengine/common/src/config'
import { avatarPath, userAvatarPath, UserID } from '@etherealengine/common/src/schema.type.module'
import { useFind, useGet } from '@etherealengine/spatial/src/common/functions/FeathersHooks'

export const DEFAULT_PROFILE_IMG_PLACEHOLDER = `${config.client.fileServer}/projects/default-project/assets/default-silhouette.svg`
export const DEFAULT_PROFILE_IMG_PLACEHOLDER = `${config.client.fileServer}/projects/etherealengine/default-project/assets/default-silhouette.svg`

export const useUserAvatarThumbnail = (userId?: UserID) => {
const userAvatar = useFind(userAvatarPath, {
Expand Down
17 changes: 9 additions & 8 deletions packages/common/src/regex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ export const CSS_URL_REGEX = /(@import\s+["']([^"']+)["']|url\((?!['"]?(?:data):
export const ABSOLUTE_URL_PROTOCOL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/

/**
* Captures project name and asset path from a URL.
* Captures org name, project name and asset path from a URL.
* For eg: `/path/to/projects/project123/assets/images/logo.png` will capture following groups
* - `project123` => Group 1
* - `assets/images/logo.png` => Group 2
* - `@org123` => Group 1
* - `project123` => Group 2
* - `assets/images/logo.png` => Group 3
*/
export const STATIC_ASSET_REGEX = /^(?:.*\/(?:projects|static-resources)\/([^\/]*)\/((?:assets\/|).*)$)/
export const STATIC_ASSET_REGEX = /^(?:.*\/(?:projects|static-resources)\/([^\/]*)\/([^\/]*)\/((?:assets\/|).*)$)/

// =====================================================================
// ========================= ID Regex Patterns =========================
Expand Down Expand Up @@ -111,22 +112,22 @@ export const INSTALLATION_SIGNED_REGEX = /https:\/\/oauth2:[\w\d\s\-_][email protected]
/**
* This regex is used to match specific file paths or directory structures that start with `projects/`, followed by one or more valid characters (letters, digits, hyphens, underscores, or forward slashes), and end with `/assets/`
*/
export const ASSETS_REGEX = /projects\/[a-zA-Z0-9-_\/]+\/assets\//
export const ASSETS_REGEX = /projects\/+[a-zA-Z0-9-_@]+\/[a-zA-Z0-9-_]+\/assets\//

/**
* This regex matches strings that start with `projects/`, followed by one or more characters that can be letters, digits, hyphens, underscores, or forward slashes.
*/
export const PROJECT_REGEX = /projects\/[a-zA-Z0-9-_\/]+/
export const PROJECT_REGEX = /projects\/+[a-zA-Z0-9-_@]+\/[a-zA-Z0-9-_]/

/**
* This regex matches strings that start with `projects/`, followed by one or more characters that can be letters, digits, hyphens, underscores, or forward slashes, and then `/public/`.
*/
export const PROJECT_PUBLIC_REGEX = /projects\/[a-zA-Z0-9-_\/]+\/public\//
export const PROJECT_PUBLIC_REGEX = /projects\/+[a-zA-Z0-9-_@]+\/[a-zA-Z0-9-_]+\/public\//

/**
* This regex matches strings that start with `projects/`, followed by one or more characters that can be letters, digits, hyphens, underscores, or forward slashes, and then `/thumbnails/`.
*/
export const PROJECT_THUMBNAIL_REGEX = /projects\/[a-zA-Z0-9-_\/]+\/thumbnails\//
export const PROJECT_THUMBNAIL_REGEX = /projects\/+[a-zA-Z0-9-_@]+\/[a-zA-Z0-9-_]+\/thumbnails\//

export const VALID_PROJECT_NAME = /^(?!\s)[\w\-\s]+$/

Expand Down
67 changes: 36 additions & 31 deletions packages/common/tests/regex.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,39 +252,44 @@ describe('regex.test', () => {
it('should match static asset URLs', () => {
const positiveCases = [
{
url: 'https://example.com/projects/default-project/assets/images/logo.png',
url: 'https://example.com/projects/etherealengine/default-project/assets/images/logo.png',
orgName: 'etherealengine',
projectName: 'default-project',
assetPath: 'assets/images/logo.png'
},
{
url: 'https://example.com/static-resources/default-project/assets/images/logo.png',
url: 'https://example.com/static-resources/etherealengine/default-project/assets/images/logo.png',
orgName: 'etherealengine',
projectName: 'default-project',
assetPath: 'assets/images/logo.png'
},
{
url: 'https://example.com/projects/default-project/assets/animations/emotes.glb',
url: 'https://example.com/projects/etherealengine/default-project/assets/animations/emotes.glb',
orgName: 'etherealengine',
projectName: 'default-project',
assetPath: 'assets/animations/emotes.glb'
},
{
url: 'https://example.com/projects/default-project/assets/animations/locomotion.glb',
url: 'https://example.com/projects/etherealengine/default-project/assets/animations/locomotion.glb',
orgName: 'etherealengine',
projectName: 'default-project',
assetPath: 'assets/animations/locomotion.glb'
}
]
positiveCases.forEach(({ url, projectName, assetPath }) => {
positiveCases.forEach(({ url, orgName, projectName, assetPath }) => {
const match = STATIC_ASSET_REGEX.exec(url)
assert.ok(match, `Expected '${url}' to match STATIC_ASSET_REGEX`)
assert.equal(match?.[1], projectName, `Expected project name '${projectName}' in '${url}'. Found ${match?.[1]}`)
assert.equal(match?.[2], assetPath, `Expected asset path '${assetPath}' in '${url}'. Found ${match?.[2]}`)
assert.equal(match?.[1], orgName, `Expected org name name '${orgName}' in '${url}'. Found ${match?.[1]}`)
assert.equal(match?.[2], projectName, `Expected project name '${projectName}' in '${url}'. Found ${match?.[2]}`)
assert.equal(match?.[3], assetPath, `Expected asset path '${assetPath}' in '${url}'. Found ${match?.[3]}`)
})
})

it('should not match non-static asset URLs', () => {
const negativeCases = [
'https://example.com/static-resources/',
'https://example.com/project/subdir/assets',
'https://example.com/default-project/assets/animations/emotes.glb'
'https://example.com/etherealengine/default-project/assets/animations/emotes.glb'
]
negativeCases.forEach((url) => {
assert.doesNotMatch(url, STATIC_ASSET_REGEX, `Expected '${url}' to not match STATIC_ASSET_REGEX`)
Expand Down Expand Up @@ -581,9 +586,9 @@ describe('regex.test', () => {
describe('ASSETS_REGEX', () => {
it('should match assets URLs', () => {
const positiveCases = [
'https://example.com/projects/default-project/assets/images/logo.png',
'https://example.com/projects/default-project/assets/animations/emotes.glb',
'https://example.com/projects/default-project/assets/animations/locomotion.glb'
'https://example.com/projects/etherealengine/default-project/assets/images/logo.png',
'https://example.com/projects/etherealengine/default-project/assets/animations/emotes.glb',
'https://example.com/projects/etherealengine/default-project/assets/animations/locomotion.glb'
]
positiveCases.forEach((url) => {
assert.match(url, ASSETS_REGEX, `Expected '${url}' to match ASSETS_REGEX`)
Expand All @@ -592,9 +597,9 @@ describe('regex.test', () => {

it('should not match non-assets URLs', () => {
const negativeCases = [
'https://example.com/projects/default-project/scene.json',
'https://example.com/projects/default-project/assets',
'https://example.com/default-project/assets/animations/emotes.glb'
'https://example.com/projects/etherealengine/default-project/scene.json',
'https://example.com/projects/etherealengine/default-project/assets',
'https://example.com/etherealengine/default-project/assets/animations/emotes.glb'
]
negativeCases.forEach((url) => {
assert.doesNotMatch(url, ASSETS_REGEX, `Expected '${url}' to not match ASSETS_REGEX`)
Expand All @@ -605,9 +610,9 @@ describe('regex.test', () => {
describe('PROJECT_REGEX', () => {
it('should match valid project paths', () => {
const positiveCases = [
'projects/project123',
'projects/project-name',
'projects/project_name',
'projects/etherealengine/project123',
'projects/etherealengine/project-name',
'projects/etherealengine/project_name',
'projects/project/123',
'projects/project/abc_def'
]
Expand All @@ -630,9 +635,9 @@ describe('regex.test', () => {
describe('PROJECT_PUBLIC_REGEX', () => {
it('should match valid project paths', () => {
const positiveCases = [
'projects/project123/public/',
'projects/project-name/public/',
'projects/project_name/public/',
'projects/etherealengine/project123/public/',
'projects/etherealengine/project-name/public/',
'projects/etherealengine/project_name/public/',
'projects/project/123/public/',
'projects/project/abc_def/public/'
]
Expand All @@ -643,10 +648,10 @@ describe('regex.test', () => {

it('should not match invalid project paths', () => {
const negativeCases = [
'projects/project123/public', // (missing trailing slash)
'projects/project-name/private/', // (incorrect folder private instead of public)
'projects/project$name/public/', // (contains invalid character $)
'projects/project-@name/public/', // (contains invalid character @)
'projects/etherealengine/project123/public', // (missing trailing slash)
'projects/etherealengine/project-name/private/', // (incorrect folder private instead of public)
'projects/etherealengine/project$name/public/', // (contains invalid character $)
'projects/etherealengine/project-@name/public/', // (contains invalid character @)
'projects/' // (missing project name and /public/)
]
negativeCases.forEach((value) => {
Expand All @@ -658,9 +663,9 @@ describe('regex.test', () => {
describe('PROJECT_THUMBNAIL_REGEX', () => {
it('should match valid project thumbnail paths', () => {
const positiveCases = [
'projects/project123/thumbnails/',
'projects/project-name/thumbnails/',
'projects/project_name/thumbnails/',
'projects/etherealengine/project123/thumbnails/',
'projects/etherealengine/project-name/thumbnails/',
'projects/etherealengine/project_name/thumbnails/',
'projects/project/123/thumbnails/',
'projects/project/abc_def/thumbnails/'
]
Expand All @@ -671,10 +676,10 @@ describe('regex.test', () => {

it('should not match invalid project thumbnail paths', () => {
const negativeCases = [
'projects/project123/thumbnails', // (missing trailing slash)
'projects/project-name/private/', // (incorrect folder private instead of public)
'projects/project$name/thumbnails/', // (contains invalid character $)
'projects/project-@name/thumbnails/', // (contains invalid character @)
'projects/etherealengine/project123/thumbnails', // (missing trailing slash)
'projects/etherealengine/project-name/private/', // (incorrect folder private instead of public)
'projects/etherealengine/project$name/thumbnails/', // (contains invalid character $)
'projects/etherealengine/project-@name/thumbnails/', // (contains invalid character @)
'projects/' // (missing project name and /thumbnail/)
]
negativeCases.forEach((value) => {
Expand Down
Loading
Loading