🎨 Unified code style
This commit is contained in:
9
src-tauri/src/inject/component.js
vendored
9
src-tauri/src/inject/component.js
vendored
@@ -136,8 +136,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
document.body.appendChild(m);
|
||||
setTimeout(function () {
|
||||
const d = 0.5;
|
||||
m.style.transition =
|
||||
'transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
|
||||
m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
|
||||
m.style.opacity = '0';
|
||||
setTimeout(function () {
|
||||
document.body.removeChild(m);
|
||||
@@ -151,14 +150,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
if (window.location.hostname === 'chat.openai.com') {
|
||||
const originFetch = fetch;
|
||||
window.fetch = (url, options) => {
|
||||
return originFetch(url, options).then(async (response) => {
|
||||
return originFetch(url, options).then(async response => {
|
||||
if (url.indexOf('/backend-api/models') === -1) {
|
||||
return response;
|
||||
}
|
||||
const responseClone = response.clone();
|
||||
let res = await responseClone.json();
|
||||
res.models = res.models.map((m) => {
|
||||
m.tags = m.tags.filter((t) => {
|
||||
res.models = res.models.map(m => {
|
||||
m.tags = m.tags.filter(t => {
|
||||
return t !== 'mobile';
|
||||
});
|
||||
if (m.slug === 'gpt-4-mobile') {
|
||||
|
||||
22
src-tauri/src/inject/event.js
vendored
22
src-tauri/src/inject/event.js
vendored
@@ -82,14 +82,14 @@ async function invoke(cmd, args) {
|
||||
|
||||
// Judgment of file download.
|
||||
function isDownloadLink(url) {
|
||||
const fileExtensions = [
|
||||
'3gp', '7z', 'ai', 'apk', 'avi', 'bmp', 'csv', 'dmg', 'doc', 'docx', 'fla', 'flv', 'gif', 'gz', 'gzip',
|
||||
'ico', 'iso', 'indd', 'jar', 'jpeg', 'jpg', 'm3u8', 'mov', 'mp3', 'mp4', 'mpa', 'mpg',
|
||||
'mpeg', 'msi', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'raw', 'rss', 'svg',
|
||||
'swf', 'tar', 'tif', 'tiff', 'ts', 'txt', 'wav', 'webm', 'webp', 'wma', 'wmv', 'xls', 'xlsx', 'xml', 'zip'
|
||||
];
|
||||
const downloadLinkPattern = new RegExp(`\\.(${fileExtensions.join('|')})$`, 'i');
|
||||
return downloadLinkPattern.test(url);
|
||||
const fileExtensions = [
|
||||
'3gp', '7z', 'ai', 'apk', 'avi', 'bmp', 'csv', 'dmg', 'doc', 'docx', 'fla', 'flv', 'gif', 'gz', 'gzip',
|
||||
'ico', 'iso', 'indd', 'jar', 'jpeg', 'jpg', 'm3u8', 'mov', 'mp3', 'mp4', 'mpa', 'mpg',
|
||||
'mpeg', 'msi', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'raw', 'rss', 'svg',
|
||||
'swf', 'tar', 'tif', 'tiff', 'ts', 'txt', 'wav', 'webm', 'webp', 'wma', 'wmv', 'xls', 'xlsx', 'xml', 'zip',
|
||||
];
|
||||
const downloadLinkPattern = new RegExp(`\\.(${fileExtensions.join('|')})$`, 'i');
|
||||
return downloadLinkPattern.test(url);
|
||||
}
|
||||
|
||||
// No need to go to the download link.
|
||||
@@ -185,7 +185,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// Rewrite the window.open function.
|
||||
const originalWindowOpen = window.open;
|
||||
window.open = function (url, name, specs) {
|
||||
window.open = function(url, name, specs) {
|
||||
// Apple login and google login
|
||||
if (name === 'AppleAuthentication') {
|
||||
//do nothing
|
||||
@@ -278,7 +278,7 @@ function downloadFromBlobUrl(blobUrl, filename) {
|
||||
function detectDownloadByCreateAnchor() {
|
||||
const createEle = document.createElement;
|
||||
document.createElement = (el) => {
|
||||
if (el !== "a") return createEle.call(document, el);
|
||||
if (el !== 'a') return createEle.call(document, el);
|
||||
const anchorEle = createEle.call(document, el);
|
||||
|
||||
// use addEventListener to avoid overriding the original click event.
|
||||
@@ -290,5 +290,5 @@ function detectDownloadByCreateAnchor() {
|
||||
});
|
||||
|
||||
return anchorEle;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
2
src-tauri/src/inject/style.js
vendored
2
src-tauri/src/inject/style.js
vendored
@@ -1,4 +1,4 @@
|
||||
window.addEventListener('DOMContentLoaded', (_event) => {
|
||||
window.addEventListener('DOMContentLoaded', _event => {
|
||||
const css = `
|
||||
#page #footer-wrapper,
|
||||
.drawing-board .toolbar .toolbar-action,
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
"dangerousRemoteDomainIpcAccess": [
|
||||
{
|
||||
"domain": "weread.qq.com",
|
||||
"windows": [
|
||||
"pake"
|
||||
],
|
||||
"windows": ["pake"],
|
||||
"enableTauriAPI": true
|
||||
}
|
||||
]
|
||||
@@ -27,9 +25,7 @@
|
||||
"all": true,
|
||||
"fs": {
|
||||
"all": true,
|
||||
"scope": [
|
||||
"$DOWNLOAD/*"
|
||||
]
|
||||
"scope": ["$DOWNLOAD/*"]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
"copyright": "",
|
||||
"deb": {
|
||||
"depends": ["curl", "wget"],
|
||||
"files": {"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"}
|
||||
"files": {
|
||||
"/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
|
||||
}
|
||||
},
|
||||
"externalBin": [],
|
||||
"longDescription": "",
|
||||
|
||||
Reference in New Issue
Block a user