Update to 1.18.2 (#110)
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "RisuAI",
|
"productName": "RisuAI",
|
||||||
"version": "1.18.1"
|
"version": "1.18.2"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ import { changeLanguage, language } from "src/lang";
|
|||||||
<option value="ja" class="bg-darkbg appearance-none">Japanese</option>
|
<option value="ja" class="bg-darkbg appearance-none">Japanese</option>
|
||||||
<option value="fr" class="bg-darkbg appearance-none">French</option>
|
<option value="fr" class="bg-darkbg appearance-none">French</option>
|
||||||
<option value="es" class="bg-darkbg appearance-none">Spanish</option>
|
<option value="es" class="bg-darkbg appearance-none">Spanish</option>
|
||||||
|
<option value="pt" class="bg-darkbg appearance-none">Portuguese</option>
|
||||||
|
<option value="de" class="bg-darkbg appearance-none">German</option>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
{#if $DataBase.translator}
|
{#if $DataBase.translator}
|
||||||
|
|||||||
28
src/main.ts
28
src/main.ts
@@ -2,34 +2,10 @@ import "./styles.css";
|
|||||||
import "core-js/actual"
|
import "core-js/actual"
|
||||||
import App from "./App.svelte";
|
import App from "./App.svelte";
|
||||||
import { loadData } from "./ts/globalApi";
|
import { loadData } from "./ts/globalApi";
|
||||||
import { ReadableStream, WritableStream, TransformStream } from "web-streams-polyfill/ponyfill/es2018";
|
|
||||||
import { Buffer as BufferPolyfill } from 'buffer'
|
|
||||||
import { initHotkey } from "./ts/hotkey";
|
import { initHotkey } from "./ts/hotkey";
|
||||||
|
import { polyfill } from "./ts/polyfill";
|
||||||
|
|
||||||
const testDom = document.createElement('div');
|
polyfill()
|
||||||
const supports = ('draggable' in testDom) || ('ondragstart' in testDom && 'ondrop' in testDom);
|
|
||||||
const isIos = navigator.userAgent ? (!!navigator.userAgent.match('iPhone OS') || !!navigator.userAgent.match('iPad')) : false
|
|
||||||
testDom.remove()
|
|
||||||
|
|
||||||
if((!supports) || isIos){
|
|
||||||
const dragDrop = await import("mobile-drag-drop")
|
|
||||||
const dragDropBehavior = await import("mobile-drag-drop/scroll-behaviour")
|
|
||||||
|
|
||||||
dragDrop.polyfill({
|
|
||||||
// use this to make use of the scroll behaviour
|
|
||||||
dragImageTranslateOverride: dragDropBehavior.scrollBehaviourDragImageTranslateOverride,
|
|
||||||
holdToDrag: 400,
|
|
||||||
forceApply: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//Polyfills
|
|
||||||
declare var Buffer: typeof BufferPolyfill;
|
|
||||||
globalThis.Buffer = BufferPolyfill
|
|
||||||
//@ts-ignore
|
|
||||||
globalThis.WritableStream = globalThis.WritableStream ?? WritableStream
|
|
||||||
globalThis.ReadableStream = globalThis.ReadableStream ?? ReadableStream
|
|
||||||
globalThis.TransformStream = globalThis.TransformStream ?? TransformStream
|
|
||||||
|
|
||||||
const app = new App({
|
const app = new App({
|
||||||
target: document.getElementById("app"),
|
target: document.getElementById("app"),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { cloneDeep } from 'lodash';
|
|||||||
|
|
||||||
export const DataBase = writable({} as any as Database)
|
export const DataBase = writable({} as any as Database)
|
||||||
export const loadedStore = writable(false)
|
export const loadedStore = writable(false)
|
||||||
export let appVer = '1.18.1'
|
export let appVer = '1.18.2'
|
||||||
|
|
||||||
|
|
||||||
export function setDatabase(data:Database){
|
export function setDatabase(data:Database){
|
||||||
|
|||||||
30
src/ts/polyfill.ts
Normal file
30
src/ts/polyfill.ts
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { ReadableStream, WritableStream, TransformStream } from "web-streams-polyfill/ponyfill/es2018";
|
||||||
|
import { Buffer as BufferPolyfill } from 'buffer'
|
||||||
|
import { polyfill as dragPolyfill} from "mobile-drag-drop"
|
||||||
|
import {scrollBehaviourDragImageTranslateOverride} from 'mobile-drag-drop/scroll-behaviour'
|
||||||
|
|
||||||
|
export function polyfill() {
|
||||||
|
try {
|
||||||
|
const testDom = document.createElement('div');
|
||||||
|
const supports = ('draggable' in testDom) || ('ondragstart' in testDom && 'ondrop' in testDom);
|
||||||
|
const isIos = navigator.userAgent ? (!!navigator.userAgent.match('iPhone OS') || !!navigator.userAgent.match('iPad')) : false
|
||||||
|
testDom.remove()
|
||||||
|
|
||||||
|
if((!supports) || isIos){
|
||||||
|
|
||||||
|
dragPolyfill({
|
||||||
|
// use this to make use of the scroll behaviour
|
||||||
|
dragImageTranslateOverride: scrollBehaviourDragImageTranslateOverride,
|
||||||
|
holdToDrag: 400,
|
||||||
|
forceApply: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
globalThis.Buffer = BufferPolyfill
|
||||||
|
//@ts-ignore
|
||||||
|
globalThis.WritableStream = globalThis.WritableStream ?? WritableStream
|
||||||
|
globalThis.ReadableStream = globalThis.ReadableStream ?? ReadableStream
|
||||||
|
globalThis.TransformStream = globalThis.TransformStream ?? TransformStream
|
||||||
|
}
|
||||||
@@ -65,7 +65,7 @@ async function googleTrans(text:string, reverse:boolean) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = res[0].map((s) => s[0]).filter(Boolean).join('');
|
const result = (res[0].map((s) => s[0]).filter(Boolean).join('') as string).replace(/\* ([^*]+)\*/g, '*$1*').replace(/\*([^*]+) \*/g, '*$1*');
|
||||||
|
|
||||||
cache.origin.push(reverse ? result : text)
|
cache.origin.push(reverse ? result : text)
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":"1.18.1"}
|
{"version":"1.18.2"}
|
||||||
Reference in New Issue
Block a user