Remove custom comments server
- Not used by Web. - It's basically a revert of Desktop 5459.
This commit is contained in:
parent
9b7dbc97b2
commit
fe3a55ff95
10 changed files with 3 additions and 124 deletions
|
@ -12,7 +12,6 @@ LBRY_WEB_API=https://api.na-backend.odysee.com
|
||||||
LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
|
||||||
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
|
||||||
COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
COMMENT_SERVER_API=https://comments.odysee.com/api/v2
|
||||||
COMMENT_SERVER_NAME=Odysee
|
|
||||||
SEARCH_SERVER_API_ALT=https://recsys.odysee.com/search
|
SEARCH_SERVER_API_ALT=https://recsys.odysee.com/search
|
||||||
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
SEARCH_SERVER_API=https://lighthouse.odysee.com/search
|
||||||
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
SOCKETY_SERVER_API=wss://sockety.odysee.com/ws
|
||||||
|
|
|
@ -15,7 +15,6 @@ const config = {
|
||||||
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
SEARCH_SERVER_API: process.env.SEARCH_SERVER_API,
|
||||||
SEARCH_SERVER_API_ALT: process.env.SEARCH_SERVER_API_ALT,
|
SEARCH_SERVER_API_ALT: process.env.SEARCH_SERVER_API_ALT,
|
||||||
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
|
||||||
COMMENT_SERVER_NAME: process.env.COMMENT_SERVER_NAME,
|
|
||||||
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
SOCKETY_SERVER_API: process.env.SOCKETY_SERVER_API,
|
||||||
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
WELCOME_VERSION: process.env.WELCOME_VERSION,
|
||||||
DOMAIN: process.env.DOMAIN,
|
DOMAIN: process.env.DOMAIN,
|
||||||
|
|
|
@ -1994,8 +1994,6 @@
|
||||||
"Clear Edits": "Clear Edits",
|
"Clear Edits": "Clear Edits",
|
||||||
"Something not quite right..": "Something not quite right..",
|
"Something not quite right..": "Something not quite right..",
|
||||||
"Failed to fetch comments.": "Failed to fetch comments.",
|
"Failed to fetch comments.": "Failed to fetch comments.",
|
||||||
"Failed to fetch comments. Verify custom server settings.": "Failed to fetch comments. Verify custom server settings.",
|
|
||||||
"Commenting server is not set.": "Commenting server is not set.",
|
|
||||||
"Comments are not currently enabled.": "Comments are not currently enabled.",
|
"Comments are not currently enabled.": "Comments are not currently enabled.",
|
||||||
"See All": "See All",
|
"See All": "See All",
|
||||||
"System": "System",
|
"System": "System",
|
||||||
|
|
|
@ -5,13 +5,6 @@ import { COMMENT_SERVER_API } from 'config';
|
||||||
const Comments = {
|
const Comments = {
|
||||||
url: COMMENT_SERVER_API,
|
url: COMMENT_SERVER_API,
|
||||||
enabled: Boolean(COMMENT_SERVER_API),
|
enabled: Boolean(COMMENT_SERVER_API),
|
||||||
isCustomServer: false,
|
|
||||||
|
|
||||||
setServerUrl: (customUrl: ?string) => {
|
|
||||||
Comments.url = customUrl === undefined ? COMMENT_SERVER_API : customUrl;
|
|
||||||
Comments.enabled = Boolean(Comments.url);
|
|
||||||
Comments.isCustomServer = Comments.url !== COMMENT_SERVER_API;
|
|
||||||
},
|
|
||||||
|
|
||||||
moderation_block: (params: ModerationBlockParams) => fetchCommentsApi('moderation.Block', params),
|
moderation_block: (params: ModerationBlockParams) => fetchCommentsApi('moderation.Block', params),
|
||||||
moderation_unblock: (params: ModerationBlockParams) => fetchCommentsApi('moderation.UnBlock', params),
|
moderation_unblock: (params: ModerationBlockParams) => fetchCommentsApi('moderation.UnBlock', params),
|
||||||
|
@ -38,9 +31,7 @@ const Comments = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function fetchCommentsApi(method: string, params: {}) {
|
function fetchCommentsApi(method: string, params: {}) {
|
||||||
if (!Comments.url) {
|
if (!Comments.enabled) {
|
||||||
return Promise.reject(new Error('Commenting server is not set.'));
|
|
||||||
} else if (!Comments.enabled) {
|
|
||||||
return Promise.reject('Comments are not currently enabled.'); // eslint-disable-line
|
return Promise.reject('Comments are not currently enabled.'); // eslint-disable-line
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import * as SETTINGS from 'constants/settings';
|
|
||||||
import { doSetClientSetting } from 'redux/actions/settings';
|
|
||||||
import { selectClientSetting } from 'redux/selectors/settings';
|
|
||||||
import SettingCommentsServer from './view';
|
|
||||||
|
|
||||||
const select = (state) => ({
|
|
||||||
customServerEnabled: selectClientSetting(state, SETTINGS.CUSTOM_COMMENTS_SERVER_ENABLED),
|
|
||||||
customServerUrl: selectClientSetting(state, SETTINGS.CUSTOM_COMMENTS_SERVER_URL),
|
|
||||||
});
|
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
|
||||||
setCustomServerEnabled: (val) => dispatch(doSetClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_ENABLED, val, true)),
|
|
||||||
setCustomServerUrl: (url) => dispatch(doSetClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_URL, url, true)),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default connect(select, perform)(SettingCommentsServer);
|
|
|
@ -1,72 +0,0 @@
|
||||||
// @flow
|
|
||||||
import { COMMENT_SERVER_NAME } from 'config';
|
|
||||||
import React from 'react';
|
|
||||||
import Comments from 'comments';
|
|
||||||
import { FormField } from 'component/common/form';
|
|
||||||
|
|
||||||
const DEBOUNCE_TEXT_INPUT_MS = 500;
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
customServerEnabled: boolean,
|
|
||||||
customServerUrl: string,
|
|
||||||
setCustomServerEnabled: (boolean) => void,
|
|
||||||
setCustomServerUrl: (string) => void,
|
|
||||||
};
|
|
||||||
|
|
||||||
function SettingCommentsServer(props: Props) {
|
|
||||||
const { customServerEnabled, customServerUrl, setCustomServerEnabled, setCustomServerUrl } = props;
|
|
||||||
const [url, setUrl] = React.useState(customServerUrl);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
const timer = setTimeout(() => {
|
|
||||||
Comments.setServerUrl(customServerEnabled ? url : undefined);
|
|
||||||
if (url !== customServerUrl) {
|
|
||||||
setCustomServerUrl(url);
|
|
||||||
}
|
|
||||||
}, DEBOUNCE_TEXT_INPUT_MS);
|
|
||||||
|
|
||||||
return () => clearTimeout(timer);
|
|
||||||
}, [url, customServerUrl, customServerEnabled, setCustomServerUrl]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<React.Fragment>
|
|
||||||
<fieldset-section>
|
|
||||||
<FormField
|
|
||||||
type="radio"
|
|
||||||
name="use_default_comments_server"
|
|
||||||
label={__('Default comments server (%name%)', { name: COMMENT_SERVER_NAME })}
|
|
||||||
checked={!customServerEnabled}
|
|
||||||
onChange={(e) => {
|
|
||||||
if (e.target.checked) {
|
|
||||||
setCustomServerEnabled(false);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<FormField
|
|
||||||
type="radio"
|
|
||||||
name="use_custom_comments_server"
|
|
||||||
label={__('Custom comments server')}
|
|
||||||
checked={customServerEnabled}
|
|
||||||
onChange={(e) => {
|
|
||||||
if (e.target.checked) {
|
|
||||||
setCustomServerEnabled(true);
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{customServerEnabled && (
|
|
||||||
<div className="section__body">
|
|
||||||
<FormField
|
|
||||||
type="text"
|
|
||||||
placeholder="https://comment.mysite.com"
|
|
||||||
value={url}
|
|
||||||
onChange={(e) => setUrl(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</fieldset-section>
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default SettingCommentsServer;
|
|
|
@ -9,7 +9,6 @@ import FileSelector from 'component/common/file-selector';
|
||||||
import I18nMessage from 'component/i18nMessage';
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import SettingAutoLaunch from 'component/settingAutoLaunch';
|
import SettingAutoLaunch from 'component/settingAutoLaunch';
|
||||||
import SettingClosingBehavior from 'component/settingClosingBehavior';
|
import SettingClosingBehavior from 'component/settingClosingBehavior';
|
||||||
import SettingCommentsServer from 'component/settingCommentsServer';
|
|
||||||
import SettingsRow from 'component/settingsRow';
|
import SettingsRow from 'component/settingsRow';
|
||||||
import SettingWalletServer from 'component/settingWalletServer';
|
import SettingWalletServer from 'component/settingWalletServer';
|
||||||
import Spinner from 'component/spinner';
|
import Spinner from 'component/spinner';
|
||||||
|
@ -382,9 +381,6 @@ export default function SettingSystem(props: Props) {
|
||||||
<SettingWalletServer />
|
<SettingWalletServer />
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
|
|
||||||
<SettingsRow title={__('Comments server')} multirow>
|
|
||||||
<SettingCommentsServer />
|
|
||||||
</SettingsRow>
|
|
||||||
{/* @endif */}
|
{/* @endif */}
|
||||||
|
|
||||||
<SettingsRow
|
<SettingsRow
|
||||||
|
|
|
@ -40,8 +40,6 @@ export const SUPPORT_OPTION = 'support_option';
|
||||||
export const TILE_LAYOUT = 'tile_layout';
|
export const TILE_LAYOUT = 'tile_layout';
|
||||||
export const VIDEO_THEATER_MODE = 'video_theater_mode';
|
export const VIDEO_THEATER_MODE = 'video_theater_mode';
|
||||||
export const VIDEO_PLAYBACK_RATE = 'video_playback_rate';
|
export const VIDEO_PLAYBACK_RATE = 'video_playback_rate';
|
||||||
export const CUSTOM_COMMENTS_SERVER_ENABLED = 'custom_comments_server_enabled';
|
|
||||||
export const CUSTOM_COMMENTS_SERVER_URL = 'custom_comments_server_url';
|
|
||||||
|
|
||||||
export const SETTINGS_GRP = {
|
export const SETTINGS_GRP = {
|
||||||
APPEARANCE: 'appearance',
|
APPEARANCE: 'appearance',
|
||||||
|
|
|
@ -102,9 +102,7 @@ export function doCommentList(
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
isError: true,
|
isError: true,
|
||||||
message: Comments.isCustomServer
|
message: __('Failed to fetch comments.'),
|
||||||
? __('Failed to fetch comments. Verify custom server settings.')
|
|
||||||
: __('Failed to fetch comments.'),
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
dispatch({ type: ACTIONS.COMMENT_LIST_FAILED, data: error });
|
dispatch({ type: ACTIONS.COMMENT_LIST_FAILED, data: error });
|
||||||
|
@ -198,9 +196,7 @@ export function doCommentListOwn(
|
||||||
dispatch(
|
dispatch(
|
||||||
doToast({
|
doToast({
|
||||||
isError: true,
|
isError: true,
|
||||||
message: Comments.isCustomServer
|
message: __('Failed to fetch comments.'),
|
||||||
? __('Failed to fetch comments. Verify custom server settings.')
|
|
||||||
: __('Failed to fetch comments.'),
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
dispatch(doToast({ isError: true, message: `${error.message}` }));
|
dispatch(doToast({ isError: true, message: `${error.message}` }));
|
||||||
|
|
|
@ -5,7 +5,6 @@ import moment from 'moment';
|
||||||
import { getSubsetFromKeysArray } from 'util/sync-settings';
|
import { getSubsetFromKeysArray } from 'util/sync-settings';
|
||||||
import { getDefaultLanguage } from 'util/default-languages';
|
import { getDefaultLanguage } from 'util/default-languages';
|
||||||
import { UNSYNCED_SETTINGS } from 'config';
|
import { UNSYNCED_SETTINGS } from 'config';
|
||||||
import Comments from 'comments';
|
|
||||||
|
|
||||||
const { CLIENT_SYNC_KEYS } = SHARED_PREFERENCES;
|
const { CLIENT_SYNC_KEYS } = SHARED_PREFERENCES;
|
||||||
const settingsToIgnore = (UNSYNCED_SETTINGS && UNSYNCED_SETTINGS.trim().split(' ')) || [];
|
const settingsToIgnore = (UNSYNCED_SETTINGS && UNSYNCED_SETTINGS.trim().split(' ')) || [];
|
||||||
|
@ -53,8 +52,6 @@ const defaultState = {
|
||||||
[SETTINGS.VIDEO_THEATER_MODE]: false,
|
[SETTINGS.VIDEO_THEATER_MODE]: false,
|
||||||
[SETTINGS.VIDEO_PLAYBACK_RATE]: 1,
|
[SETTINGS.VIDEO_PLAYBACK_RATE]: 1,
|
||||||
[SETTINGS.DESKTOP_WINDOW_ZOOM]: 1,
|
[SETTINGS.DESKTOP_WINDOW_ZOOM]: 1,
|
||||||
[SETTINGS.CUSTOM_COMMENTS_SERVER_ENABLED]: false,
|
|
||||||
[SETTINGS.CUSTOM_COMMENTS_SERVER_URL]: '',
|
|
||||||
|
|
||||||
[SETTINGS.DARK_MODE_TIMES]: {
|
[SETTINGS.DARK_MODE_TIMES]: {
|
||||||
from: { hour: '21', min: '00', formattedTime: '21:00' },
|
from: { hour: '21', min: '00', formattedTime: '21:00' },
|
||||||
|
@ -175,12 +172,6 @@ reducers[ACTIONS.USER_STATE_POPULATE] = (state, action) => {
|
||||||
const mergedClientSettings = { ...currentClientSettings, ...selectedSettings };
|
const mergedClientSettings = { ...currentClientSettings, ...selectedSettings };
|
||||||
const newSharedPreferences = sharedPreferences || {};
|
const newSharedPreferences = sharedPreferences || {};
|
||||||
|
|
||||||
Comments.setServerUrl(
|
|
||||||
mergedClientSettings[SETTINGS.CUSTOM_COMMENTS_SERVER_ENABLED]
|
|
||||||
? mergedClientSettings[SETTINGS.CUSTOM_COMMENTS_SERVER_URL]
|
|
||||||
: undefined
|
|
||||||
);
|
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
sharedPreferences: newSharedPreferences,
|
sharedPreferences: newSharedPreferences,
|
||||||
clientSettings: mergedClientSettings,
|
clientSettings: mergedClientSettings,
|
||||||
|
|
Loading…
Reference in a new issue