Remove Nostr-related stuff
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@@ -79,10 +79,6 @@ const FAVOURITES_EXPAND_FAIL = 'FAVOURITES_EXPAND_FAIL';
|
||||
const REBLOGS_EXPAND_SUCCESS = 'REBLOGS_EXPAND_SUCCESS';
|
||||
const REBLOGS_EXPAND_FAIL = 'REBLOGS_EXPAND_FAIL';
|
||||
|
||||
const ZAP_REQUEST = 'ZAP_REQUEST';
|
||||
const ZAP_SUCCESS = 'ZAP_SUCCESS';
|
||||
const ZAP_FAIL = 'ZAP_FAIL';
|
||||
|
||||
const messages = defineMessages({
|
||||
bookmarkAdded: { id: 'status.bookmarked', defaultMessage: 'Bookmark added.' },
|
||||
bookmarkRemoved: { id: 'status.unbookmarked', defaultMessage: 'Bookmark removed.' },
|
||||
@@ -313,38 +309,6 @@ const undislikeFail = (status: StatusEntity, error: unknown) => ({
|
||||
skipLoading: true,
|
||||
});
|
||||
|
||||
const zap = (status: StatusEntity, amount: number) =>
|
||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||
if (!isLoggedIn(getState)) return;
|
||||
|
||||
dispatch(zapRequest(status));
|
||||
|
||||
api(getState).post(`/api/v1/statuses/${status.id}/zap`, { amount }).then(function(response) {
|
||||
dispatch(zapSuccess(status));
|
||||
}).catch(function(error) {
|
||||
dispatch(zapFail(status, error));
|
||||
});
|
||||
};
|
||||
|
||||
const zapRequest = (status: StatusEntity) => ({
|
||||
type: ZAP_REQUEST,
|
||||
status: status,
|
||||
skipLoading: true,
|
||||
});
|
||||
|
||||
const zapSuccess = (status: StatusEntity) => ({
|
||||
type: ZAP_SUCCESS,
|
||||
status: status,
|
||||
skipLoading: true,
|
||||
});
|
||||
|
||||
const zapFail = (status: StatusEntity, error: unknown) => ({
|
||||
type: ZAP_FAIL,
|
||||
status: status,
|
||||
error: error,
|
||||
skipLoading: true,
|
||||
});
|
||||
|
||||
const bookmark = (status: StatusEntity, folderId?: string) =>
|
||||
(dispatch: AppDispatch, getState: () => RootState) => {
|
||||
const state = getState();
|
||||
@@ -775,8 +739,6 @@ export {
|
||||
FAVOURITES_EXPAND_FAIL,
|
||||
REBLOGS_EXPAND_SUCCESS,
|
||||
REBLOGS_EXPAND_FAIL,
|
||||
ZAP_REQUEST,
|
||||
ZAP_FAIL,
|
||||
reblog,
|
||||
unreblog,
|
||||
toggleReblog,
|
||||
@@ -844,5 +806,4 @@ export {
|
||||
remoteInteractionRequest,
|
||||
remoteInteractionSuccess,
|
||||
remoteInteractionFail,
|
||||
zap,
|
||||
};
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import { nip19 } from 'nostr-tools';
|
||||
|
||||
import { type AppDispatch } from 'soapbox/store';
|
||||
|
||||
import { verifyCredentials } from './auth';
|
||||
|
||||
/** Log in with a Nostr pubkey. */
|
||||
function logInNostr(pubkey: string) {
|
||||
return (dispatch: AppDispatch) => {
|
||||
const npub = nip19.npubEncode(pubkey);
|
||||
return dispatch(verifyCredentials(npub));
|
||||
};
|
||||
}
|
||||
|
||||
/** Log in with a Nostr extension. */
|
||||
function nostrExtensionLogIn() {
|
||||
return async (dispatch: AppDispatch) => {
|
||||
if (!window.nostr) {
|
||||
throw new Error('No Nostr signer available');
|
||||
}
|
||||
const pubkey = await window.nostr.getPublicKey();
|
||||
return dispatch(logInNostr(pubkey));
|
||||
};
|
||||
}
|
||||
|
||||
export { logInNostr, nostrExtensionLogIn };
|
||||
Reference in New Issue
Block a user