Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] added blacklist for shared folders #691

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions assets/jsons/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "Die Festplatte ist voll, machen Sie Platz und versuchen Sie es erneut.",
"UNKNOWN_ERROR": "Ein unbekannter Fehler ist beim Verknüpfen des Ordners aufgetreten."
}
},
"adding-error": {
"title": "Das Hinzufügen des freigegebenen Ordners ist fehlgeschlagen",
"msg": "Sie können \"{folder}\" nicht zu freigegebenen Ordnern hinzufügen."
}
},
"create-launch-shortcut": {
Expand Down Expand Up @@ -805,6 +809,10 @@
"link-all": "Alle verlinken"
}
},
"adding-shared-folder": {
"title": "Freigegebenen Ordner hinzufügen",
"description": "Beim Verknüpfen des Ordners \"{folder}\" können Probleme auftreten. Möchten Sie ihn wirklich hinzufügen?"
},
"create-launch-shortcut": {
"title": "Verknüpfung erstellen",
"desc": "Das Erstellen einer Verknüpfung ermöglicht es dir, Beat Saber mit den ausgewählten Optionen zu starten, ohne durch BSManager zu gehen.",
Expand Down
8 changes: 8 additions & 0 deletions assets/jsons/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "The disk is full, make some space and try again.",
"UNKNOWN_ERROR": "An unknown error has occurred while linking the folder."
}
},
"adding-error": {
"title": "Adding shared folder failed",
"msg": "You can't add \"{folder}\" to shared folders."
}
},
"create-launch-shortcut": {
Expand Down Expand Up @@ -805,6 +809,10 @@
"link-all": "Link all"
}
},
"adding-shared-folder": {
"title": "Adding Shared Folder",
"description": "You might experience issues when linking the \"{folder}\" folder. Are you sure you want to add it?"
},
"create-launch-shortcut": {
"title": "Create a shortcut",
"desc": "Creating a shortcut will allow you to start Beat Saber with the chosen options without going through BSManager.",
Expand Down
8 changes: 8 additions & 0 deletions assets/jsons/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "El disco está lleno, libera espacio e inténtalo de nuevo.",
"UNKNOWN_ERROR": "Se ha producido un error desconocido al enlazar la carpeta."
}
},
"adding-error": {
"title": "Error al agregar una carpeta compartida",
"msg": "No puedes agregar \"{folder}\" a las carpetas compartidas."
}
},
"create-launch-shortcut": {
Expand Down Expand Up @@ -805,6 +809,10 @@
"link-all": "Enlazar todo"
}
},
"adding-shared-folder": {
"title": "Agregar una carpeta compartida",
"description": "Es posible que experimentes problemas al vincular la carpeta \"{folder}\". ¿Estás seguro de que deseas agregarla?"
},
"create-launch-shortcut": {
"title": "Crear un atajo",
"desc": "Crear un atajo te permitirá iniciar Beat Saber con las opciones seleccionadas sin pasar por BSManager.",
Expand Down
8 changes: 8 additions & 0 deletions assets/jsons/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "Le disque est plein, faites de la place et réessayez.",
"UNKNOWN_ERROR": "Une erreur inconnue est survenue lors de la liaison du dossier."
}
},
"adding-error": {
"title": "L'ajout du dossier partagé a échoué",
"msg": "Vous ne pouvez pas ajouter \"{folder}\" aux dossiers partagés."
}

},
Expand Down Expand Up @@ -806,6 +810,10 @@
"link-all": "Tout lier"
}
},
"adding-shared-folder": {
"title": "Ajout d'un dossier partagé",
"description": "Vous pourriez rencontrer des problèmes lors de la liaison du dossier \"{folder}\". Êtes-vous sûr de vouloir l'ajouter ?"
},
"create-launch-shortcut": {
"title": "Créer un raccourci",
"desc": "Créer un raccourci te permettra de démarrer Beat Saber avec les options choisies sans passer par BSManager.",
Expand Down
8 changes: 8 additions & 0 deletions assets/jsons/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "ディスクがいっぱいです。空き容量を作ってもう一度試してください。",
"UNKNOWN_ERROR": "フォルダをリンク中に不明なエラーが発生しました。"
}
},
"adding-error": {
"title": "共有フォルダの追加に失敗しました",
"msg": "「{folder}」を共有フォルダに追加することはできません。"
}
},
"create-launch-shortcut": {
Expand Down Expand Up @@ -805,6 +809,10 @@
"link-all": "すべてリンク"
}
},
"adding-shared-folder": {
"title": "共有フォルダの追加",
"description": "「{folder}」フォルダをリンクするときに問題が発生する可能性があります。追加してもよろしいですか?"
},
"create-launch-shortcut": {
"title": "ショートカットを作成",
"desc": "ショートカットを作成すると、BSManagerを起動せずに、直接Beat Saberを起動できます。",
Expand Down
8 changes: 8 additions & 0 deletions assets/jsons/translations/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "디스크가 가득 찼습니다. 공간을 확보하고 다시 시도하세요.",
"UNKNOWN_ERROR": "폴더를 연결하는 중 알 수 없는 오류가 발생했습니다."
}
},
"adding-error": {
"title": "공유 폴더 추가에 실패했습니다.",
"msg": "공유 폴더에 「{folder}」을 추가할 수 없습니다."
}
},
"create-launch-shortcut": {
Expand Down Expand Up @@ -805,6 +809,10 @@
"link-all": "모두 연결"
}
},
"adding-shared-folder": {
"title": "공유 폴더 추가",
"description": "「{folder}」폴더를 연결할 때 문제가 발생할 수 있습니다. 정말 추가하시겠습니까?"
},
"create-launcher-shortcut": {
"title": "런처 바로가기 만들기",
"description": "바탕화면에 실행 파일의 바로가기를 만들어 BSManager를 손쉽게 실행하세요.",
Expand Down
8 changes: 8 additions & 0 deletions assets/jsons/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "Диск заполнен, освободите место и попробуйте снова.",
"UNKNOWN_ERROR": "Произошла неизвестная ошибка при связывании папки."
}
},
"adding-error": {
"title": "Не удалось добавить общую папку.",
"msg": "Вы не можете добавлять \"{folder}\" в общие папки."
}
},
"create-launch-shortcut": {
Expand Down Expand Up @@ -805,6 +809,10 @@
"link-all": "Связать всё"
}
},
"adding-shared-folder": {
"title": "Добавление общей папки",
"description": "У вас могут возникнуть проблемы при связывании папки \"{folder}\". Вы уверены, что хотите ее добавить?"
},
"create-launch-shortcut": {
"title": "Создать ярлык",
"desc": "Ярлык позволит вам запустить Beat Saber без помощи BSManager.",
Expand Down
8 changes: 8 additions & 0 deletions assets/jsons/translations/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "磁碟已滿,請騰出空間後再試。",
"UNKNOWN_ERROR": "連結文件夾時發生未知錯誤。"
}
},
"adding-error": {
"title": "添加共享文件夹失败",
"msg": "您无法将\"{folder}\"添加到共享文件夹。"
}
},
"create-launch-shortcut": {
Expand Down Expand Up @@ -805,6 +809,10 @@
"link-all": "關聯所有"
}
},
"adding-shared-folder": {
"title": "添加共享文件夹",
"description": "链接\"{folder}\"文件夹时可能会遇到问题。您确定要添加它吗?"
},
"create-launch-shortcut": {
"title": "創建捷徑",
"desc": "創建捷徑使得你可以在不通過 BSManager 的情況下以特定選項啟動 BeatSaber",
Expand Down
8 changes: 8 additions & 0 deletions assets/jsons/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,10 @@
"ENOSPC": "磁盘已满,请腾出空间后再试。",
"UNKNOWN_ERROR": "链接文件夹时发生未知错误。"
}
},
"adding-error": {
"title": "添加共享文件夹失败",
"msg": "您无法将\"{folder}\"添加到共享文件夹。"
}
},
"create-launch-shortcut": {
Expand Down Expand Up @@ -805,6 +809,10 @@
"link-all": "关联所有"
}
},
"adding-shared-folder": {
"title": "添加共享文件夹",
"description": "链接\"{folder}\"文件夹时可能会遇到问题。您确定要添加它吗?"
},
"create-launch-shortcut": {
"title": "创建快捷方式",
"desc": "创建快捷方式使得你可以在不通过 BSManager 的情况下以特定选项启动 BeatSaber",
Expand Down
19 changes: 12 additions & 7 deletions src/main/services/folder-linker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,24 @@ export class FolderLinkerService {
private readonly installLocationService = InstallationLocationService.getInstance();
private readonly staticConfig: StaticConfigurationService;

private linkingType: "junction" | "symlink" = "junction";
// Only Windows support "junction", this is disregarded in other os'es
private linkingType: "junction" | "symlink" =
process.platform === "win32" ? "junction" : "symlink";

private constructor() {
this.installLocationService = InstallationLocationService.getInstance();
this.staticConfig = StaticConfigurationService.getInstance();

this.linkingType = this.staticConfig.get("use-symlinks") === true ? "symlink" : "junction";
log.info(`Linking type is set to ${this.linkingType}`);
if (process.platform === "win32") {
// Only Windows support "junction", this is disregarded in other os'es
this.linkingType = this.staticConfig.get("use-symlinks") === true ? "symlink" : "junction";
log.info(`Linking type is set to ${this.linkingType}`);

this.staticConfig.$watch("use-symlinks").subscribe((useSymlink) => {
this.linkingType = useSymlink === true ? "symlink" : "junction";
log.info(`Linking type set to ${this.linkingType}`);
});
this.staticConfig.$watch("use-symlinks").subscribe((useSymlink) => {
this.linkingType = useSymlink === true ? "symlink" : "junction";
log.info(`Linking type set to ${this.linkingType}`);
});
}
}

private async sharedFolder(): Promise<string> {
Expand Down
30 changes: 23 additions & 7 deletions src/renderer/components/modal/basic-modal.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BsmButton, BsmButtonType } from "renderer/components/shared/bsm-button.component";
import { BsmImage } from "renderer/components/shared/bsm-image.component";
import { cn } from "renderer/helpers/css-class.helpers";
import { useTranslation } from "renderer/hooks/use-translation.hook";
import { useTranslationV2 } from "renderer/hooks/use-translation.hook";
import { ModalComponent, ModalExitCode } from "renderer/services/modale.service";

type BasicModalOptions = {
Expand All @@ -12,7 +12,11 @@ type BasicModalOptions = {
id: string;
text: string;
type: BsmButtonType,
isCancel?: boolean;
/**
* true - ModalExitCode.COMPLETED
* undefined/false - ModalExitCode.CANCELED
*/
onClick?: () => boolean;
}[];
buttonsLayout?: "row" | "column";
};
Expand All @@ -21,20 +25,32 @@ export const BasicModal: ModalComponent<BasicModalOptions["buttons"][0]["id"], B
data: { title, image, body, buttons, buttonsLayout = "column" }
} }) => {

const t = useTranslation();
const t = useTranslationV2();

const handleClick = (button: BasicModalOptions["buttons"][0]) => {
resolver({ exitCode: button.isCancel ? ModalExitCode.CANCELED : ModalExitCode.COMPLETED, data: button.id });
resolver({
exitCode: button.onClick?.()
? ModalExitCode.COMPLETED
: ModalExitCode.CANCELED,
data: button.id
});
}

return (
<form className="text-gray-900 dark:text-white">
<h1 className="text-3xl uppercase tracking-wide w-full text-center">{t(title)}</h1>
<h1 className="text-3xl uppercase tracking-wide w-full text-center">{t.text(title)}</h1>
<BsmImage className="mx-auto h-24" image={image} />
{ body && <p className="w-full">{t(body)}</p> }
{ body && <p className="w-full">{t.text(body)}</p> }
<div className={cn("grid gap-2 mt-4")} style={{ gridAutoFlow: buttonsLayout, ...(buttonsLayout === "row" ? { gridTemplateRows: `repeat(${buttons.length}, 1fr)` } : { gridTemplateColumns: `repeat(${buttons.length}, 1fr)` }) }}>
{buttons.map(button => (
<BsmButton key={button.id} typeColor={button.type} className="h-8 rounded-md text-center flex justify-center items-center" onClick={() => handleClick(button)} withBar={false} text={button.text} />
<BsmButton
key={button.id}
typeColor={button.type}
className="h-8 rounded-md text-center flex justify-center items-center"
onClick={() => handleClick(button)}
withBar={false}
text={button.text}
/>
))}
</div>
</form>
Expand Down
Loading
Loading