chore: cleanup, ci workflows and formatting (#127064)
* ci: setup workflows, dependabot, labeler and commit linting * docs: update README, community files and issue templates * chore: configure prettier, editorconfig and format codebase * chore: restore changes lost during rebase * docs: adjust url for new logo * fix: align badges * chore: resolve conflicts and re-add temp lint
This commit is contained in:
parent
c2d978fd0a
commit
807efd502d
1 changed files with 6790 additions and 3547 deletions
|
|
@ -4,7 +4,6 @@
|
|||
* Interface Controller
|
||||
*/
|
||||
class InterfaceController {
|
||||
|
||||
constructor(props) {
|
||||
this.pupPage = props.pupPage;
|
||||
}
|
||||
|
|
@ -15,8 +14,12 @@ class InterfaceController {
|
|||
*/
|
||||
async openChatWindow(chatId) {
|
||||
return await this.pupPage.evaluate(async (chatId) => {
|
||||
const chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
return await (window.require('WAWebCmd').Cmd).openChatBottom({'chat':chat});
|
||||
const chat = await window.WWebJS.getChat(chatId, {
|
||||
getAsModel: false,
|
||||
});
|
||||
return await window
|
||||
.require('WAWebCmd')
|
||||
.Cmd.openChatBottom({ chat: chat });
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
|
|
@ -25,9 +28,11 @@ class InterfaceController {
|
|||
* @param {string} chatId ID of the chat drawer that will be opened
|
||||
*/
|
||||
async openChatDrawer(chatId) {
|
||||
await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
await (window.require('WAWebCmd').Cmd).openDrawerMid(chat);
|
||||
await this.pupPage.evaluate(async (chatId) => {
|
||||
let chat = await window.WWebJS.getChat(chatId, {
|
||||
getAsModel: false,
|
||||
});
|
||||
await window.require('WAWebCmd').Cmd.openDrawerMid(chat);
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
|
|
@ -36,9 +41,11 @@ class InterfaceController {
|
|||
* @param {string} chatId ID of the chat search that will be opened
|
||||
*/
|
||||
async openChatSearch(chatId) {
|
||||
await this.pupPage.evaluate(async chatId => {
|
||||
let chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
|
||||
await (window.require('WAWebCmd').Cmd).chatSearch(chat);
|
||||
await this.pupPage.evaluate(async (chatId) => {
|
||||
let chat = await window.WWebJS.getChat(chatId, {
|
||||
getAsModel: false,
|
||||
});
|
||||
await window.require('WAWebCmd').Cmd.chatSearch(chat);
|
||||
}, chatId);
|
||||
}
|
||||
|
||||
|
|
@ -48,10 +55,24 @@ class InterfaceController {
|
|||
*/
|
||||
async openChatWindowAt(msgId) {
|
||||
await this.pupPage.evaluate(async (msgId) => {
|
||||
const msg = (window.require('WAWebCollections')).Msg.get(msgId) || (await (window.require('WAWebCollections')).Msg.getMessagesById([msgId]))?.messages?.[0];
|
||||
const chat = (window.require('WAWebCollections')).Chat.get(msg.id.remote) ?? await (window.require('WAWebCollections')).Chat.find(msg.id.remote);
|
||||
const searchContext = await (window.require('WAWebChatMessageSearch')).getSearchContext(chat, msg.id);
|
||||
await (window.require('WAWebCmd').Cmd).openChatAt({ chat: chat, msgContext: searchContext });
|
||||
const msg =
|
||||
window.require('WAWebCollections').Msg.get(msgId) ||
|
||||
(
|
||||
await window
|
||||
.require('WAWebCollections')
|
||||
.Msg.getMessagesById([msgId])
|
||||
)?.messages?.[0];
|
||||
const chat =
|
||||
window.require('WAWebCollections').Chat.get(msg.id.remote) ??
|
||||
(await window
|
||||
.require('WAWebCollections')
|
||||
.Chat.find(msg.id.remote));
|
||||
const searchContext = await window
|
||||
.require('WAWebChatMessageSearch')
|
||||
.getSearchContext(chat, msg.id);
|
||||
await window
|
||||
.require('WAWebCmd')
|
||||
.Cmd.openChatAt({ chat: chat, msgContext: searchContext });
|
||||
}, msgId);
|
||||
}
|
||||
|
||||
|
|
@ -60,9 +81,15 @@ class InterfaceController {
|
|||
* @param {string} msgId ID of the message drawer that will be opened
|
||||
*/
|
||||
async openMessageDrawer(msgId) {
|
||||
await this.pupPage.evaluate(async msgId => {
|
||||
const msg = (window.require('WAWebCollections')).Msg.get(msgId) || (await (window.require('WAWebCollections')).Msg.getMessagesById([msgId]))?.messages?.[0];
|
||||
await (window.require('WAWebCmd').Cmd).msgInfoDrawer(msg);
|
||||
await this.pupPage.evaluate(async (msgId) => {
|
||||
const msg =
|
||||
window.require('WAWebCollections').Msg.get(msgId) ||
|
||||
(
|
||||
await window
|
||||
.require('WAWebCollections')
|
||||
.Msg.getMessagesById([msgId])
|
||||
)?.messages?.[0];
|
||||
await window.require('WAWebCmd').Cmd.msgInfoDrawer(msg);
|
||||
}, msgId);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +98,9 @@ class InterfaceController {
|
|||
*/
|
||||
async closeRightDrawer() {
|
||||
await this.pupPage.evaluate(async () => {
|
||||
await window.require('WAWebDrawerManager').DrawerManager.closeDrawerRight();
|
||||
await window
|
||||
.require('WAWebDrawerManager')
|
||||
.DrawerManager.closeDrawerRight();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -80,8 +109,11 @@ class InterfaceController {
|
|||
*/
|
||||
async getFeatures() {
|
||||
return await this.pupPage.evaluate(() => {
|
||||
if(!(window.require('WAWebCollections')).Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
return (window.require('WAWebCollections')).Features.F;
|
||||
if (!window.require('WAWebCollections').Features)
|
||||
throw new Error(
|
||||
'This version of Whatsapp Web does not support features',
|
||||
);
|
||||
return window.require('WAWebCollections').Features.F;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -91,8 +123,13 @@ class InterfaceController {
|
|||
*/
|
||||
async checkFeatureStatus(feature) {
|
||||
return await this.pupPage.evaluate((feature) => {
|
||||
if(!(window.require('WAWebCollections')).Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
return (window.require('WAWebCollections')).Features.supportsFeature(feature);
|
||||
if (!window.require('WAWebCollections').Features)
|
||||
throw new Error(
|
||||
'This version of Whatsapp Web does not support features',
|
||||
);
|
||||
return window
|
||||
.require('WAWebCollections')
|
||||
.Features.supportsFeature(feature);
|
||||
}, feature);
|
||||
}
|
||||
|
||||
|
|
@ -102,9 +139,14 @@ class InterfaceController {
|
|||
*/
|
||||
async enableFeatures(features) {
|
||||
await this.pupPage.evaluate((features) => {
|
||||
if(!(window.require('WAWebCollections')).Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
if (!window.require('WAWebCollections').Features)
|
||||
throw new Error(
|
||||
'This version of Whatsapp Web does not support features',
|
||||
);
|
||||
for (const feature in features) {
|
||||
(window.require('WAWebCollections')).Features.setFeature(features[feature], true);
|
||||
window
|
||||
.require('WAWebCollections')
|
||||
.Features.setFeature(features[feature], true);
|
||||
}
|
||||
}, features);
|
||||
}
|
||||
|
|
@ -115,9 +157,14 @@ class InterfaceController {
|
|||
*/
|
||||
async disableFeatures(features) {
|
||||
await this.pupPage.evaluate((features) => {
|
||||
if(!(window.require('WAWebCollections')).Features) throw new Error('This version of Whatsapp Web does not support features');
|
||||
if (!window.require('WAWebCollections').Features)
|
||||
throw new Error(
|
||||
'This version of Whatsapp Web does not support features',
|
||||
);
|
||||
for (const feature in features) {
|
||||
(window.require('WAWebCollections')).Features.setFeature(features[feature], false);
|
||||
window
|
||||
.require('WAWebCollections')
|
||||
.Features.setFeature(features[feature], false);
|
||||
}
|
||||
}, features);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue