mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 09:48:44 +00:00
set meta tag for video
This commit is contained in:
1 parent
e0ec0118e9
commit
bbdc307cb6
3 files changed
+26
-1
No files matched your search
+7
-1
@@ -47,12 +47,18 @@ interface State {
|
||||
textBuffer: string,
|
||||
}
|
||||
|
||||
function newVocodes() {
|
||||
const discord = /discord/i.test(navigator.userAgent || "");
|
||||
const alphaCookie = document.cookie.includes("enable-alpha");
|
||||
return discord || alphaCookie;
|
||||
}
|
||||
|
||||
class App extends React.Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
||||
const enableAlpha = document.cookie.includes("enable-alpha");
|
||||
const enableAlpha = newVocodes();
|
||||
|
||||
const migrationMode = enableAlpha ? MigrationMode.NEW_VOCODES : MigrationMode.OLD_VOCODES;
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Manipulate meta tags on the document.
|
||||
export class MetaTags {
|
||||
|
||||
static setVideoUrl(url: string) {
|
||||
let metaTag = document.head.querySelector('meta[property="og:video"]');
|
||||
if (!metaTag) {
|
||||
metaTag = document.createElement('meta');
|
||||
metaTag.setAttribute('property', 'og:video')
|
||||
document.head.appendChild(metaTag);
|
||||
}
|
||||
metaTag.setAttribute('content', url);
|
||||
}
|
||||
|
||||
static clearVideoUrl() {
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import { VisibleIconFc } from '../../_icons/VisibleIcon';
|
||||
import { FrontendUrlConfig } from '../../../../common/FrontendUrlConfig';
|
||||
import { DownloadIcon } from '../../_icons/DownloadIcon';
|
||||
import { GetW2lResult, W2lResult } from '../../../api/w2l/GetW2lResult';
|
||||
import { MetaTags } from '../../../../common/MetaTags';
|
||||
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper,
|
||||
@@ -38,6 +39,8 @@ function W2lResultViewFc(props: Props) {
|
||||
let templateLink = `/w2l/${w2lInferenceResult.maybe_w2l_template_token}`;
|
||||
let videoDownloadFilename = `vocodes-${w2lInferenceResult.w2l_result_token.replace(':', '')}.mp4`;
|
||||
|
||||
MetaTags.setVideoUrl(videoLink);
|
||||
|
||||
let durationSeconds = w2lInferenceResult?.duration_millis / 1000;
|
||||
|
||||
let templateName = w2lInferenceResult.template_title;
|
||||
|
||||
Reference in new issue
Block a user