Sticker improvements
This commit is contained in:
parent
b5e1e3a345
commit
fd06ac9d57
3 changed files with 11 additions and 6 deletions
|
@ -666,10 +666,7 @@ function getStickerPackStatus(packId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSticker(packId, stickerId) {
|
function getSticker(packId, stickerId) {
|
||||||
const state = reduxStore.getState();
|
const pack = getStickerPack(packId);
|
||||||
const { stickers } = state;
|
|
||||||
const { packs } = stickers;
|
|
||||||
const pack = packs[packId];
|
|
||||||
|
|
||||||
if (!pack || !pack.stickers) {
|
if (!pack || !pack.stickers) {
|
||||||
return null;
|
return null;
|
||||||
|
|
4
main.js
4
main.js
|
@ -1384,7 +1384,9 @@ function handleSgnlHref(incomingHref) {
|
||||||
console.log('Opening sticker pack from sgnl protocol link');
|
console.log('Opening sticker pack from sgnl protocol link');
|
||||||
const packId = args.get('pack_id');
|
const packId = args.get('pack_id');
|
||||||
const packKeyHex = args.get('pack_key');
|
const packKeyHex = args.get('pack_key');
|
||||||
const packKey = Buffer.from(packKeyHex, 'hex').toString('base64');
|
const packKey = packKeyHex
|
||||||
|
? Buffer.from(packKeyHex, 'hex').toString('base64')
|
||||||
|
: '';
|
||||||
mainWindow.webContents.send('show-sticker-pack', { packId, packKey });
|
mainWindow.webContents.send('show-sticker-pack', { packId, packKey });
|
||||||
} else {
|
} else {
|
||||||
console.error('Unhandled sgnl link');
|
console.error('Unhandled sgnl link');
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { Agent } from 'https';
|
||||||
import { escapeRegExp } from 'lodash';
|
import { escapeRegExp } from 'lodash';
|
||||||
|
|
||||||
import is from '@sindresorhus/is';
|
import is from '@sindresorhus/is';
|
||||||
import { redactPackId } from '../../js/modules/stickers';
|
import { isPackIdValid, redactPackId } from '../../js/modules/stickers';
|
||||||
import { getRandomValue } from '../Crypto';
|
import { getRandomValue } from '../Crypto';
|
||||||
import MessageSender from './SendMessage';
|
import MessageSender from './SendMessage';
|
||||||
|
|
||||||
|
@ -1344,6 +1344,9 @@ export function initialize({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getSticker(packId: string, stickerId: string) {
|
async function getSticker(packId: string, stickerId: string) {
|
||||||
|
if (!isPackIdValid(packId)) {
|
||||||
|
throw new Error('getSticker: pack ID was invalid');
|
||||||
|
}
|
||||||
return _outerAjax(
|
return _outerAjax(
|
||||||
`${cdnUrlObject['0']}/stickers/${packId}/full/${stickerId}`,
|
`${cdnUrlObject['0']}/stickers/${packId}/full/${stickerId}`,
|
||||||
{
|
{
|
||||||
|
@ -1358,6 +1361,9 @@ export function initialize({
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getStickerPackManifest(packId: string) {
|
async function getStickerPackManifest(packId: string) {
|
||||||
|
if (!isPackIdValid(packId)) {
|
||||||
|
throw new Error('getStickerPackManifest: pack ID was invalid');
|
||||||
|
}
|
||||||
return _outerAjax(
|
return _outerAjax(
|
||||||
`${cdnUrlObject['0']}/stickers/${packId}/manifest.proto`,
|
`${cdnUrlObject['0']}/stickers/${packId}/manifest.proto`,
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue