Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
b6d5799e62
7 changed files with 21 additions and 10 deletions
|
|
@ -21,6 +21,7 @@ import "./style.css";
|
|||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
import { getIntlMessage } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin, { OptionType } from "@utils/types";
|
||||
import { findByPropsLazy, findStoreLazy } from "@webpack";
|
||||
import { FluxDispatcher } from "@webpack/common";
|
||||
|
|
@ -349,7 +350,13 @@ export default definePlugin({
|
|||
}
|
||||
|
||||
try {
|
||||
return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
|
||||
// can cause hang if intl message is not found
|
||||
const serversIntlMsg = getIntlMessage("SERVERS");
|
||||
if (!serversIntlMsg) {
|
||||
new Logger("BetterFolders").error("Failed to get SERVERS intl message");
|
||||
return true;
|
||||
}
|
||||
return child?.props?.["aria-label"] === serversIntlMsg;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,8 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: "#{intl::REPLY_QUOTE_MESSAGE_BLOCKED}",
|
||||
// Same find as in ValidReply
|
||||
find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}",
|
||||
replacement: {
|
||||
match: /\.onClickReply,.+?}\),(?=\i,\i,\i\])/,
|
||||
replace: "$&$self.ReplyTimestamp(arguments[0]),"
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ function LanguageSelect({ settingsKey, includeAuto }: { settingsKey: typeof Lang
|
|||
|
||||
<SearchableSelect
|
||||
options={options}
|
||||
value={options.find(o => o.value === currentValue)}
|
||||
placeholder={"Select a language"}
|
||||
value={options.find(o => o.value === currentValue)?.value}
|
||||
placeholder="Select a language"
|
||||
maxVisibleItems={5}
|
||||
closeOnSelect={true}
|
||||
onChange={v => settings.store[settingsKey] = v}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export default definePlugin({
|
|||
authors: [Devs.newwares],
|
||||
patches: [
|
||||
{
|
||||
// Same find as in ReplyTimestamp
|
||||
find: "#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}",
|
||||
replacement: {
|
||||
match: /#{intl::REPLY_QUOTE_MESSAGE_NOT_LOADED}\)/,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ function SimplePicker({ voice, voices }: PickerProps) {
|
|||
placeholder="Select a voice"
|
||||
maxVisibleItems={5}
|
||||
options={options}
|
||||
value={options.find(o => o.value === voice)}
|
||||
value={options.find(o => o.value === voice)?.value}
|
||||
onChange={v => settings.store.voice = v}
|
||||
closeOnSelect
|
||||
/>
|
||||
|
|
@ -89,7 +89,7 @@ function ComplexPicker({ voice, voices }: PickerProps) {
|
|||
<SearchableSelect
|
||||
placeholder="Select a language"
|
||||
options={languageOptions}
|
||||
value={languageOptions.find(l => l.value === selectedLanguage)}
|
||||
value={languageOptions.find(l => l.value === selectedLanguage)?.value}
|
||||
onChange={v => setSelectedLanguage(v)}
|
||||
maxVisibleItems={5}
|
||||
closeOnSelect
|
||||
|
|
|
|||
|
|
@ -222,8 +222,8 @@ export const DisplayProfileUtils: t.DisplayProfileUtils = mapMangledModuleLazy(/
|
|||
});
|
||||
|
||||
export const DateUtils: t.DateUtils = mapMangledModuleLazy("millisecondsInUnit:", {
|
||||
calendarFormat: filters.byCode("sameElse"),
|
||||
dateFormat: filters.byCode('":'),
|
||||
calendarFormat: filters.byCode('<-1?"sameElse":'),
|
||||
dateFormat: filters.byCode('<2?"nextDay":"sameElse";'),
|
||||
isSameDay: filters.byCode(/Math\.abs\(\i-\i\)/),
|
||||
diffAsUnits: filters.byCode("days:0", "millisecondsInUnit")
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export const patchTimings = [] as Array<[plugin: string, moduleId: PropertyKey,
|
|||
export const getBuildNumber = makeLazy(() => {
|
||||
try {
|
||||
function matchBuildNumber(factoryStr: string) {
|
||||
const buildNumberMatch = factoryStr.match(/.concat\("(\d+?)"\)/);
|
||||
const buildNumberMatch = factoryStr.match(/"Trying to open a changelog for an invalid build number (\d+?)"\)/);
|
||||
if (buildNumberMatch == null) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -37,13 +37,15 @@ export const getBuildNumber = makeLazy(() => {
|
|||
return Number(buildNumberMatch[1]);
|
||||
}
|
||||
|
||||
const hardcodedFactoryStr = String(wreq.m[128014]);
|
||||
const hardcodedFactoryStr = String(wreq.m[446023]);
|
||||
if (hardcodedFactoryStr.includes("Trying to open a changelog for an invalid build number")) {
|
||||
const hardcodedBuildNumber = matchBuildNumber(hardcodedFactoryStr);
|
||||
|
||||
if (hardcodedBuildNumber !== -1) {
|
||||
return hardcodedBuildNumber;
|
||||
}
|
||||
} else if (IS_DEV || IS_REPORTER) {
|
||||
logger.error("Hardcoded build number module id is invalid");
|
||||
}
|
||||
|
||||
const moduleFactory = findModuleFactory("Trying to open a changelog for an invalid build number");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue