mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 13:34:54 +03:00
feat: add option to disable NSFW warning
This commit is contained in:
parent
b09e91a1cf
commit
2f8fe67f9f
@ -38,6 +38,9 @@ export class UserPreferences {
|
||||
@Column("boolean", { default: false })
|
||||
startMinimized: boolean;
|
||||
|
||||
@Column("boolean", { default: false })
|
||||
disableNsfwPopup: boolean;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
|
@ -12,6 +12,7 @@ import { CreateUserSubscription } from "./migrations/20241015235142_create_user_
|
||||
import { AddBackgroundImageUrl } from "./migrations/20241016100249_add_background_image_url";
|
||||
import { AddWinePrefixToGame } from "./migrations/20241019081648_add_wine_prefix_to_game";
|
||||
import { AddStartMinimizedColumn } from "./migrations/20241030171454_add_start_minimized_column";
|
||||
import { AddDisableNsfwPopupColumn } from "./migrations/20241106053733_add_disable_nsfw_popup_column";
|
||||
export type HydraMigration = Knex.Migration & { name: string };
|
||||
|
||||
class MigrationSource implements Knex.MigrationSource<HydraMigration> {
|
||||
@ -28,6 +29,7 @@ class MigrationSource implements Knex.MigrationSource<HydraMigration> {
|
||||
AddBackgroundImageUrl,
|
||||
AddWinePrefixToGame,
|
||||
AddStartMinimizedColumn,
|
||||
AddDisableNsfwPopupColumn,
|
||||
]);
|
||||
}
|
||||
getMigrationName(migration: HydraMigration): string {
|
||||
|
@ -0,0 +1,17 @@
|
||||
import type { HydraMigration } from "@main/knex-client";
|
||||
import type { Knex } from "knex";
|
||||
|
||||
export const AddDisableNsfwPopupColumn: HydraMigration = {
|
||||
name: "AddDisableNsfwPopupColumn",
|
||||
up: (knex: Knex) => {
|
||||
return knex.schema.alterTable("user_preferences", (table) => {
|
||||
return table.boolean("disableNsfwPopup").notNullable().defaultTo(0);
|
||||
});
|
||||
},
|
||||
|
||||
down: async (knex: Knex) => {
|
||||
return knex.schema.alterTable("user_preferences", (table) => {
|
||||
return table.dropColumn("disableNsfwPopup");
|
||||
});
|
||||
},
|
||||
};
|
@ -147,7 +147,7 @@ export function GameDetailsContextProvider({
|
||||
if (
|
||||
result?.content_descriptors.ids.includes(
|
||||
SteamContentDescriptor.AdultOnlySexualContent
|
||||
)
|
||||
) && !userPreferences?.disableNsfwPopup
|
||||
) {
|
||||
setHasNSFWContentBlocked(true);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ export function SettingsBehavior() {
|
||||
preferQuitInsteadOfHiding: false,
|
||||
runAtStartup: false,
|
||||
startMinimized: false,
|
||||
disableNsfwPopup: false,
|
||||
});
|
||||
|
||||
const { t } = useTranslation("settings");
|
||||
@ -28,6 +29,7 @@ export function SettingsBehavior() {
|
||||
preferQuitInsteadOfHiding: userPreferences.preferQuitInsteadOfHiding,
|
||||
runAtStartup: userPreferences.runAtStartup,
|
||||
startMinimized: userPreferences.startMinimized,
|
||||
disableNsfwPopup: userPreferences.disableNsfwPopup,
|
||||
});
|
||||
}
|
||||
}, [userPreferences]);
|
||||
@ -86,6 +88,14 @@ export function SettingsBehavior() {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<CheckboxField
|
||||
label={t("disable_nsfw_popup")}
|
||||
checked={form.disableNsfwPopup}
|
||||
onChange={() =>
|
||||
handleChange({ disableNsfwPopup: !form.disableNsfwPopup })
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -161,6 +161,7 @@ export interface UserPreferences {
|
||||
preferQuitInsteadOfHiding: boolean;
|
||||
runAtStartup: boolean;
|
||||
startMinimized: boolean;
|
||||
disableNsfwPopup: boolean;
|
||||
}
|
||||
|
||||
export interface Steam250Game {
|
||||
|
Loading…
Reference in New Issue
Block a user