@ -23,7 +23,7 @@ import NotificationsHandler from './Components/NotificationsHandler.svelte';
import { fireNotification , getEmbedsFromCache , getSelectedFile } from "./utils" ;
import { fireNotification , getEmbedsFromCache , getSelectedFile } from "./utils" ;
import { getQueryProcessor , QueryProcessor } from "./websites" ;
import { getQueryProcessor , QueryProcessor } from "./websites" ;
import { ifetch , Platform , sendCmd , lqueue , supportedAltDomain , supportedMainDomain , genPort } from "./platform" ;
import { ifetch , Platform , sendCmd , lqueue , supportedAltDomain , supportedMainDomain , genPort , initMainIPC } from "./platform" ;
import TextEmbeddingsSvelte from "./Components/TextEmbeddings.svelte" ;
import TextEmbeddingsSvelte from "./Components/TextEmbeddings.svelte" ;
import { HydrusClient } from "./hydrus" ;
import { HydrusClient } from "./hydrus" ;
import { registerPlugin } from 'linkifyjs' ;
import { registerPlugin } from 'linkifyjs' ;
@ -401,10 +401,10 @@ class CommandProcessor {
const convertToLocalEmbed = ( wef : WorkerEmbeddedFile ) = > {
const convertToLocalEmbed = ( wef : WorkerEmbeddedFile ) = > {
let ret : EmbeddedFileWithPreview ;
let ret : EmbeddedFileWithPreview ;
ret = wef as any ;
ret = { . . . wef } as any ;
// handles bigger files where data is represented as a {url, header} object
// handles bigger files where data is represented as a {url, header} object
if ( typeof wef . data == "object" ) {
if ( typeof wef . data == "object" ) {
if ( ! ( wef . data instanceof Uint8Array ) ) {
if ( 'url' in wef . data ) {
const ref = wef . data ;
const ref = wef . data ;
if ( ! wef . thumbnail )
if ( ! wef . thumbnail )
return wef ;
return wef ;
@ -418,10 +418,10 @@ const convertToLocalEmbed = (wef: WorkerEmbeddedFile) => {
}
}
}
}
if ( wef . data instanceof Uint8Array ) {
if ( typeof wef . data != "string" && ! ( 'url' in wef . data ) ) {
ret . data = Buffer . from ( wef . data ) ;
ret . data = Buffer . from ( wef . data ) ;
}
}
if ( wef . thumbnail instanceof Uint8Array ) {
if ( wef . thumbnail && typeof wef . thumbnail != "string" ) {
ret . thumbnail = Buffer . from ( wef . thumbnail ) ;
ret . thumbnail = Buffer . from ( wef . thumbnail ) ;
}
}
return ret ! ;
return ret ! ;
@ -681,6 +681,9 @@ const startup = async (is4chanX = true) => {
else
else
qp = lqp ;
qp = lqp ;
if ( execution_mode != 'userscript' )
await initMainIPC ( ) ;
const nset = await localLoad ( 'settingsv2' , initial_settings ) ;
const nset = await localLoad ( 'settingsv2' , initial_settings ) ;
settings . set ( nset ) ;
settings . set ( nset ) ;
@ -759,8 +762,6 @@ const startup = async (is4chanX = true) => {
el = [ e ] ;
el = [ e ] ;
if ( el ) {
if ( el ) {
appState . update ( v = > {
appState . update ( v = > {
console . log ( "ADDED FROM MUTATION UPDATE" , el . length ) ;
v . processing += el . length ;
v . processing += el . length ;
return v ;
return v ;
} ) ;
} ) ;
@ -849,9 +850,7 @@ const startup = async (is4chanX = true) => {
//console.log(posts);
//console.log(posts);
const range = ~ ~ ( posts . length / n ) + 1 ;
const range = ~ ~ ( posts . length / n ) + 1 ;
appState . update ( v = > {
appState . update ( v = > {
console . log ( "ADDED FROM INIT" , posts . length ) ;
v . processing += posts . length ;
v . processing += posts . length ;
console . log ( "NOW IS" , v . processing ) ;
return v ;
return v ;
} ) ;
} ) ;