Skip to content

Commit

Permalink
content type check
Browse files Browse the repository at this point in the history
  • Loading branch information
NickJ202 committed Aug 13, 2024
1 parent 138c639 commit 569eef8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ export const CONTENT_TYPES = {
json: 'application/json',
mp4: 'video/mp4',
textPlain: 'text/plain',
model: 'model/gltf-binary',
audio: 'audio/mpeg',
};

export const AR_WALLETS = [{ type: WalletEnum.arConnect, logo: ASSETS.wallets.arconnect }];
Expand Down Expand Up @@ -345,9 +347,11 @@ export const RENDERERS = {
'3d': {
label: '3D',
domain: 'view_3d-pst',
contentType: CONTENT_TYPES.model,
},
audio: {
label: 'Audio',
domain: 'audio-renderer',
contentType: CONTENT_TYPES.audio,
},
};
14 changes: 11 additions & 3 deletions src/views/Upload/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,24 @@ export default function Upload() {
: uploadReducer.data.description
? uploadReducer.data.description
: stripFileExtension(data.file.name);
const type = data.file.type;
const balance = uploadReducer.data.useFractionalTokens ? Number(uploadReducer.data.contentTokens) : 1;

let contentType = data.file.type;
if (
(!contentType || !contentType.length) &&
uploadReducer.data.renderer &&
uploadReducer.data.renderer.includes('3d')
) {
contentType = CONTENT_TYPES.model;
}

try {
const assetTags: TagType[] = [
{ name: TAGS.keys.contentType, value: type },
{ name: TAGS.keys.contentType, value: contentType },
{ name: TAGS.keys.creator, value: arProvider.profile.id },
{ name: TAGS.keys.ans110.title, value: title },
{ name: TAGS.keys.ans110.description, value: description },
{ name: TAGS.keys.ans110.type, value: type },
{ name: TAGS.keys.ans110.type, value: contentType },
{ name: TAGS.keys.ans110.implements, value: TAGS.values.ansVersion },
{ name: TAGS.keys.dateCreated, value: dateTime },
{ name: 'Action', value: 'Add-Uploaded-Asset' },
Expand Down

0 comments on commit 569eef8

Please sign in to comment.