fix double auth and edit playlist

This commit is contained in:
2025-07-31 17:14:33 +03:00
parent 0287055ab9
commit ab45359e32
8 changed files with 54 additions and 31 deletions

8
package-lock.json generated
View File

@@ -22,7 +22,7 @@
"localforage": "^1.10.0",
"mediainfo.js": "^0.3.5",
"moment": "^2.30.1",
"qapp-core": "^1.0.50",
"qapp-core": "^1.0.51",
"quill": "^2.0.2",
"quill-image-resize-module-react": "^3.0.0",
"react": "^19.0.0",
@@ -5104,9 +5104,9 @@
}
},
"node_modules/qapp-core": {
"version": "1.0.50",
"resolved": "https://registry.npmjs.org/qapp-core/-/qapp-core-1.0.50.tgz",
"integrity": "sha512-vk1NAUN7tVAU3BADyvJKY3w0GCp+ddtR1Zly0/qw2tuEEkjUso3y7r+hO+uknQDCE0F4IQ0Ee1PJDVaFGLVFFQ==",
"version": "1.0.51",
"resolved": "https://registry.npmjs.org/qapp-core/-/qapp-core-1.0.51.tgz",
"integrity": "sha512-a61AdMmZbs/AdcDhm6NNtAbxonTQuTcvUTT9fFBzQX/zynmkK3T5bmfdkVS291QIuISpBhpCGOMYaW6dYVcdXQ==",
"license": "MIT",
"dependencies": {
"@tanstack/react-virtual": "^3.13.2",

View File

@@ -24,7 +24,7 @@
"localforage": "^1.10.0",
"mediainfo.js": "^0.3.5",
"moment": "^2.30.1",
"qapp-core": "^1.0.50",
"qapp-core": "^1.0.51",
"quill": "^2.0.2",
"quill-image-resize-module-react": "^3.0.0",
"react": "^19.0.0",

View File

@@ -9,6 +9,9 @@ export const AppWrapper = () => {
config={{
auth: {
authenticateOnMount: true,
balanceSetting: {
interval: 120000,
},
},
publicSalt: 'usVbeM9YpjGCbLrTcc78YJS0ap1AxDkHAOMZrp3+wDY=',
appName: 'Q-Tube',

View File

@@ -177,7 +177,7 @@ export const EditPlaylist = () => {
'Cannot publish without access to your name. Please authenticate.';
}
if (!isNew && editVideoProperties?.user !== username) {
if (!isNew && editVideoProperties?.name !== username) {
errorMsg = "Cannot publish another user's resource";
}
@@ -220,8 +220,7 @@ export const EditPlaylist = () => {
});
const id = uid.rnd();
let commentsId = editVideoProperties?.id;
let commentsId = editVideoProperties?.identifier;
if (isNew) {
commentsId = `${QTUBE_PLAYLIST_BASE}_cm_${id}`;
}
@@ -249,7 +248,7 @@ export const EditPlaylist = () => {
// Description is obtained from raw data
let identifier = editVideoProperties?.id;
let identifier = editVideoProperties?.identifier;
const sanitizeTitle = title
.replace(/[^a-zA-Z0-9\s-]/g, '')
.replace(/\s+/g, '-')

View File

@@ -4,6 +4,11 @@ import { MouseEvent, useEffect, useState } from 'react';
import { darken, styled } from '@mui/material/styles';
import { CustomTooltip, TooltipLine } from './CustomTooltip.tsx';
import { useTranslation } from 'react-i18next';
import {
followListAtom,
hasFetchFollowListAtom,
} from '../../../state/global/names.ts';
import { useAtom } from 'jotai';
interface FollowButtonProps extends ButtonProps {
followerName: string;
@@ -17,7 +22,9 @@ export type FollowData = {
export const FollowButton = ({ followerName, ...props }: FollowButtonProps) => {
const { t } = useTranslation(['core']);
const [followingList, setFollowingList] = useState<string[]>([]);
const [followingList, setFollowingList] = useAtom(followListAtom);
const [hasFetchedFollow, setHasFetchFollow] = useAtom(hasFetchFollowListAtom);
const [followingSize, setFollowingSize] = useState<string>('');
const [followingItemCount, setFollowingItemCount] = useState<string>('');
const isFollowingName = () => {
@@ -25,14 +32,20 @@ export const FollowButton = ({ followerName, ...props }: FollowButtonProps) => {
};
useEffect(() => {
if (hasFetchedFollow !== null) return;
qortalRequest({
action: 'GET_LIST_ITEMS',
list_name: 'followedNames',
}).then((followList) => {
setFollowingList(followList);
});
})
.then((followList) => {
setFollowingList(followList);
setHasFetchFollow(true);
})
.catch(() => {
setHasFetchFollow(false);
});
getFollowSize();
}, []);
}, [hasFetchedFollow]);
const followName = () => {
if (followingList.includes(followerName) === false) {
@@ -147,6 +160,7 @@ export const FollowButton = ({ followerName, ...props }: FollowButtonProps) => {
<>
<CustomTooltip title={tooltipTitle} placement={'top'} arrow>
<Button
disabled={hasFetchedFollow === false}
{...props}
variant={'outlined'}
color="info"

View File

@@ -25,7 +25,6 @@ import {
import BoundedNumericTextField from '../../../utils/BoundedNumericTextField.tsx';
import { numberToInt, truncateNumber } from '../../../utils/numberFunctions.ts';
import { objectToBase64 } from '../../../utils/PublishFormatter.ts';
import { getUserBalance } from '../../../utils/qortalRequestFunctions.ts';
import { MultiplePublish } from '../../Publish/MultiplePublish/MultiplePublishAll.tsx';
import {
CrowdfundActionButton,
@@ -35,7 +34,12 @@ import {
Spacer,
} from '../../Publish/PublishVideo/PublishVideo-styles.tsx';
import { CommentInput } from '../Comments/Comments-styles.tsx';
import { hashWordWithoutPublicSalt, useAuth } from 'qapp-core';
import {
hashWordWithoutPublicSalt,
useAuth,
useQortBalance,
useQortBalance,
} from 'qapp-core';
import { useSetAtom } from 'jotai';
import {
AltertObject,
@@ -56,7 +60,8 @@ export const SuperDislike = ({
const [superDislikeDonationAmount, setSuperdislikeDonationAmount] =
useState<number>(minPriceSuperDislike);
const [currentBalance, setCurrentBalance] = useState<string>('');
const { value: currentBalance } = useQortBalance();
const [comment, setComment] = useState<string>('');
const { name: username } = useAuth();
@@ -176,11 +181,11 @@ export const SuperDislike = ({
}
}
useEffect(() => {
getUserBalance().then((foundBalance) => {
setCurrentBalance(truncateNumber(foundBalance, 2));
});
}, []);
// useEffect(() => {
// getUserBalance().then((foundBalance) => {
// setCurrentBalance(truncateNumber(foundBalance, 2));
// });
// }, []);
const isScreenSmall = !useMediaQuery(`(min-width:400px)`);
const theme = useTheme();

View File

@@ -35,7 +35,7 @@ import {
Spacer,
} from '../../Publish/PublishVideo/PublishVideo-styles.tsx';
import { CommentInput } from '../Comments/Comments-styles.tsx';
import { hashWordWithoutPublicSalt, useAuth } from 'qapp-core';
import { hashWordWithoutPublicSalt, useAuth, useQortBalance } from 'qapp-core';
import { CustomTooltip } from './CustomTooltip.tsx';
import { useSetAtom } from 'jotai';
import {
@@ -60,8 +60,7 @@ export const SuperLike = ({
const [superlikeDonationAmount, setSuperlikeDonationAmount] =
useState<number>(minPriceSuperLike);
const [currentBalance, setCurrentBalance] = useState<string>('');
const { value: currentBalance } = useQortBalance();
const [comment, setComment] = useState<string>('');
const { name: username } = useAuth();
const [isOpenMultiplePublish, setIsOpenMultiplePublish] = useState(false);
@@ -174,11 +173,11 @@ export const SuperLike = ({
}
}
useEffect(() => {
getUserBalance().then((foundBalance) => {
setCurrentBalance(truncateNumber(foundBalance, 2));
});
}, []);
// useEffect(() => {
// getUserBalance().then((foundBalance) => {
// setCurrentBalance(truncateNumber(foundBalance, 2));
// });
// }, []);
const isScreenSmall = !useMediaQuery(`(min-width:400px)`);
const theme = useTheme();

View File

@@ -5,4 +5,7 @@ export interface Name {
export type Names = Name[];
export const namesAtom = atom<Names>([]);
export const namesAtom = atom<Names>([]);
export const followListAtom = atom<string[]>([]);
export const hasFetchFollowListAtom = atom<null | true | false>(null);