Open NSFW streams on xxx host

This commit is contained in:
2023-08-06 15:35:39 +01:00
parent b9f0d349ef
commit d44e4c1a94
4 changed files with 13 additions and 6 deletions

View File

@ -52,7 +52,8 @@
"scripts": { "scripts": {
"start": "webpack serve", "start": "webpack serve",
"build": "webpack --node-env=production", "build": "webpack --node-env=production",
"deploy": "npx wrangler pages publish build" "deploy": "yarn build && npx wrangler pages publish build",
"deploy:xxzap": "__XXX='true' && yarn build && npx wrangler pages publish --project-name xxzap build"
}, },
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [

View File

@ -2,6 +2,7 @@
/// <reference types="@webbtc/webln-types" /> /// <reference types="@webbtc/webln-types" />
declare const __XXX: boolean; declare const __XXX: boolean;
declare const __XXX_HOST: string;
declare module "*.jpg" { declare module "*.jpg" {
const value: unknown; const value: unknown;

View File

@ -7,7 +7,7 @@ import { StreamProvider, StreamProviders } from "providers";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { StreamEditor, StreamEditorProps } from "./stream-editor"; import { StreamEditor, StreamEditorProps } from "./stream-editor";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { eventLink } from "utils"; import { eventLink, findTag } from "utils";
import { NostrProviderDialog } from "./nostr-provider-dialog"; import { NostrProviderDialog } from "./nostr-provider-dialog";
function NewStream({ ev, onFinish }: StreamEditorProps) { function NewStream({ ev, onFinish }: StreamEditorProps) {
@ -35,9 +35,13 @@ function NewStream({ ev, onFinish }: StreamEditorProps) {
onFinish={(ex) => { onFinish={(ex) => {
currentProvider.updateStreamInfo(ex); currentProvider.updateStreamInfo(ex);
if (!ev) { if (!ev) {
if (findTag(ex, "content-warning") && __XXX_HOST) {
location.href = `${__XXX_HOST}/${eventLink(ex)}`;
} else {
navigate(`/${eventLink(ex)}`, { navigate(`/${eventLink(ex)}`, {
state: ev, state: ev,
}); });
}
} else { } else {
onFinish?.(ev); onFinish?.(ev);
} }

View File

@ -67,7 +67,8 @@ const config = {
contextRegExp: /moment$/, contextRegExp: /moment$/,
}), }),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
__XXX: process.env["__XXX"] || JSON.stringify(false) __XXX: process.env["__XXX"] || JSON.stringify(false),
__XXX_HOST: JSON.stringify("https://xxzap.com")
}) })
], ],
module: { module: {