mirror of
https://github.com/RoboSats/robosats.git
synced 2025-08-14 02:17:20 +00:00
Merge pull request #2160 from RoboSats/pre-release-fixes-v0.8.1-2
Pre release fixes v0.8.1 2
This commit is contained in:
@ -105,13 +105,6 @@ class WebAppInterface(private val context: MainActivity, private val webView: We
|
||||
|
||||
@JavascriptInterface
|
||||
fun copyToClipboard(message: String) {
|
||||
// Validate input
|
||||
if (!isValidInput(message)) {
|
||||
Log.e(TAG, "Invalid input for copyToClipboard")
|
||||
Toast.makeText(context, "Invalid content for clipboard", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
// Copy to clipboard
|
||||
val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as android.content.ClipboardManager
|
||||
|
18
api/nostr.py
18
api/nostr.py
@ -1,8 +1,6 @@
|
||||
import pygeohash
|
||||
import hashlib
|
||||
import uuid
|
||||
import random
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from secp256k1 import PrivateKey
|
||||
from asgiref.sync import sync_to_async
|
||||
@ -59,22 +57,6 @@ class Nostr:
|
||||
]
|
||||
),
|
||||
Tag.parse(["status", str(order.status)]),
|
||||
Tag.parse(
|
||||
[
|
||||
"expiration",
|
||||
str(
|
||||
int(
|
||||
(
|
||||
datetime.now()
|
||||
+ timedelta(days=14)
|
||||
+ timedelta(
|
||||
seconds=random.randint(0, 14 * 24 * 60 * 60)
|
||||
)
|
||||
).timestamp()
|
||||
)
|
||||
),
|
||||
]
|
||||
),
|
||||
]
|
||||
|
||||
await client.send_private_msg(PublicKey.parse(robot.nostr_pubkey), text, tags)
|
||||
|
@ -88,9 +88,7 @@ const AuditPGPDialog = ({
|
||||
const [passphrase, setPassphrase] = useState<string>();
|
||||
|
||||
useEffect(() => {
|
||||
const slot = order
|
||||
? garage.getSlotByOrder(order?.shortAlias ?? '', order?.id ?? 0)
|
||||
: garage.getSlot();
|
||||
const slot = garage.getSlot();
|
||||
setSlot(slot);
|
||||
setOwnPubKey(slot?.getRobot()?.pubKey ?? '');
|
||||
setOwnEncPrivKey(slot?.getRobot()?.encPrivKey ?? '');
|
||||
|
@ -86,12 +86,6 @@ const EncryptedChat: React.FC<Props> = ({
|
||||
|
||||
const wrappedEvent = nip17.wrapEvent(slot?.nostrSecKey, recipient, content);
|
||||
|
||||
const fourteenDays = 14 * 24 * 60 * 60;
|
||||
const randomSeconds = Math.floor(Math.random() * fourteenDays);
|
||||
const expirationTime = Math.floor(Date.now() / 1000) + fourteenDays + randomSeconds;
|
||||
|
||||
wrappedEvent.tags.push(['expiration', expirationTime.toString()]);
|
||||
|
||||
federation.roboPool.sendEvent(wrappedEvent);
|
||||
} catch (error) {
|
||||
console.error('Nostr nip17 error:', error);
|
||||
|
@ -60,6 +60,7 @@ export const ChatPrompt = ({
|
||||
const [undoSentButton, setUndoSentButton] = useState<boolean>(false);
|
||||
const [audit, setAudit] = useState<boolean>(false);
|
||||
const [peerPubKey, setPeerPubKey] = useState<string>();
|
||||
const [enableCollaborativeButton, setEnableCollaborativeButton] = useState<boolean>(false);
|
||||
const [enableDisputeButton, setEnableDisputeButton] = useState<boolean>(false);
|
||||
const [enableDisputeTime, setEnableDisputeTime] = useState<Date>(new Date(order.expires_at));
|
||||
const [text, setText] = useState<string>('');
|
||||
@ -92,6 +93,8 @@ export const ChatPrompt = ({
|
||||
|
||||
if (order.status === 9) {
|
||||
// No fiat sent yet
|
||||
setEnableCollaborativeButton(true);
|
||||
|
||||
if (order.is_buyer) {
|
||||
setSentButton(true);
|
||||
setReceivedButton(false);
|
||||
@ -117,6 +120,8 @@ export const ChatPrompt = ({
|
||||
}
|
||||
} else if (order.status === 10) {
|
||||
// Fiat has been sent already
|
||||
setEnableCollaborativeButton(false);
|
||||
|
||||
if (order.is_buyer) {
|
||||
setSentButton(false);
|
||||
setUndoSentButton(true);
|
||||
@ -301,21 +306,28 @@ export const ChatPrompt = ({
|
||||
</Grid>
|
||||
</Tooltip>
|
||||
|
||||
<Grid item xs={1} style={{ width: '100%', marginTop: 20 }}>
|
||||
<Button
|
||||
fullWidth
|
||||
onClick={() => {
|
||||
setOpenOrderOptions(false);
|
||||
onClickCollabCancel();
|
||||
}}
|
||||
size='large'
|
||||
variant='contained'
|
||||
color='secondary'
|
||||
startIcon={<Handshake />}
|
||||
>
|
||||
{t('Collaborative Cancel')}
|
||||
</Button>
|
||||
</Grid>
|
||||
<Tooltip
|
||||
placement='top'
|
||||
enterTouchDelay={0}
|
||||
title={t("Orders can't be cancelled if fiat has been sent.")}
|
||||
>
|
||||
<Grid item xs={1} style={{ width: '100%', marginTop: 20 }}>
|
||||
<Button
|
||||
fullWidth
|
||||
onClick={() => {
|
||||
setOpenOrderOptions(false);
|
||||
onClickCollabCancel();
|
||||
}}
|
||||
size='large'
|
||||
variant='contained'
|
||||
color='secondary'
|
||||
startIcon={<Handshake />}
|
||||
disabled={!enableCollaborativeButton}
|
||||
>
|
||||
{t('Collaborative Cancel')}
|
||||
</Button>
|
||||
</Grid>
|
||||
</Tooltip>
|
||||
</Grid>
|
||||
</DialogContent>
|
||||
</DialogContent>
|
||||
|
@ -58,7 +58,7 @@ class BaseSettings {
|
||||
});
|
||||
|
||||
systemClient.getItem('settings_notifications').then((result) => {
|
||||
this.androidNotifications = result === 'true';
|
||||
this.androidNotifications = !result ? client === 'mobile' : result === 'true';
|
||||
});
|
||||
|
||||
systemClient.getItem('settings_use_proxy').then((result) => {
|
||||
|
Reference in New Issue
Block a user