Skip to content

Commit

Permalink
Permissions page
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxou44 committed Apr 30, 2024
1 parent 02e38ad commit d42654f
Show file tree
Hide file tree
Showing 27 changed files with 353 additions and 46 deletions.
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@brick-a-brack/eagle-animation",
"description": "EagleAnimation is an awesome, modern, free and open-source animation software",
"version": "2.6.1",
"version": "2.6.2",
"private": false,
"author": {
"name": "Brick à Brack",
Expand Down Expand Up @@ -70,7 +70,7 @@
"react-keyboard-event-handler": "^1.5.4",
"react-router-dom": "^6.23.0",
"react-select": "^5.8.0",
"react-tooltip": "^5.26.3",
"react-tooltip": "^5.26.4",
"rimraf": "^5.0.5",
"uuid": "^9.0.1",
"vite-plugin-top-level-await": "^1.4.1"
Expand All @@ -86,14 +86,14 @@
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-simple-import-sort": "^12.1.0",
"globals": "^15.0.0",
"globals": "^15.1.0",
"husky": "^9.0.11",
"i18next-scanner": "^4.4.0",
"lightningcss": "^1.24.1",
"prettier": "^3.2.5",
"process": "^0.11.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"stylelint": "^16.4.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-order": "^6.0.4",
Expand Down
13 changes: 12 additions & 1 deletion resources/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,16 @@
"The exported frames resolution": "Die Auflösung der exportierten Bilder",
"Use project ratio": "Verwenden Sie das Projektverhältnis",
"Normalize all the frames to match the project aspect ratio": "Normalisieren Sie alle Bilder, damit sie dem Seitenverhältnis des Projekts entsprechen",
"Choose a camera": "__NOT_TRANSLATED__"
"Choose a camera": "Wählen Sie eine Kamera",
"Camera access": "Kamerazugriff",
"Microphone access": "Mikrofonzugriff",
"Grant access to the camera to capture photos": "Gewähren Sie Zugriff auf die Kamera, um Fotos aufzunehmen",
"Grant access to the microphone to record voices and sounds": "Gewähren Sie Zugriff auf das Mikrofon, um Stimmen und Geräusche aufzuzeichnen",
"Acces granted": "Zugriff gewährt",
"Grant permission": "Berechtigung erteilen",
"Permissions": "Berechtigungen",
"Permissions setup": "Einrichtung von Berechtigungen",
"Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.": "Eagle Animation benötigt Kamera- und Mikrofonberechtigungen, um zu funktionieren. Wenn Sie dies überspringen, können Sie später in den Einstellungen Zugriff gewähren.",
"Let's go!": "Los geht's!",
"Skip setup": "Einrichtung überspringen"
}
13 changes: 12 additions & 1 deletion resources/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,16 @@
"The exported frames resolution": "The exported frames resolution",
"Use project ratio": "Use project ratio",
"Normalize all the frames to match the project aspect ratio": "Normalize all the frames to match the project aspect ratio",
"Choose a camera": "Choose a camera"
"Choose a camera": "Choose a camera",
"Camera access": "Camera access",
"Microphone access": "Microphone access",
"Grant access to the camera to capture photos": "Grant access to the camera to capture photos",
"Grant access to the microphone to record voices and sounds": "Grant access to the microphone to record voices and sounds",
"Acces granted": "Acces granted",
"Grant permission": "Grant permission",
"Permissions": "Permissions",
"Permissions setup": "Permissions setup",
"Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.": "Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.",
"Let's go!": "Let's go!",
"Skip setup": "Skip setup"
}
13 changes: 12 additions & 1 deletion resources/i18n/eo.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,16 @@
"The exported frames resolution": "La rezolucio de eksportitaj bildoj",
"Use project ratio": "Uzi la projekta proporcio",
"Normalize all the frames to match the project aspect ratio": "Normigi ĉiujn bildojn por ke ili kongruu kun la projekta aspekta proporcio",
"Choose a camera": "__NOT_TRANSLATED__"
"Choose a camera": "Elektu kameron",
"Camera access": "Alirebligo al la kamerao",
"Microphone access": "Alirebligo al la mikrofono",
"Grant access to the camera to capture photos": "Permesi aliron al la kamerao por kapti fotojn",
"Grant access to the microphone to record voices and sounds": "Permesi aliron al la mikrofono por registri voĉojn kaj sonojn",
"Acces granted": "Aliro permesita",
"Grant permission": "Doni permeson",
"Permissions": "Permesoj",
"Permissions setup": "Agordo de permesoj",
"Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.": "Eagle Animation postulas kameraajn kaj mikrofonajn permesojn por funkcii, se vi preterlasas, vi povos doni aliron en la agordoj poste.",
"Let's go!": "Ni ek!",
"Skip setup": "Preterigi agordon"
}
13 changes: 12 additions & 1 deletion resources/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,16 @@
"The exported frames resolution": "La resolución de los fotogramas exportados",
"Use project ratio": "Usar la proporción del proyecto",
"Normalize all the frames to match the project aspect ratio": "Normalizar todos los fotogramas para que coincidan con la proporción del proyecto",
"Choose a camera": "__NOT_TRANSLATED__"
"Choose a camera": "Elige una cámara",
"Camera access": "Acceso a la cámara",
"Microphone access": "Acceso al micrófono",
"Grant access to the camera to capture photos": "Permitir el acceso a la cámara para capturar fotos",
"Grant access to the microphone to record voices and sounds": "Permitir el acceso al micrófono para grabar voces y sonidos",
"Acces granted": "Acceso concedido",
"Grant permission": "Conceder permiso",
"Permissions": "Permisos",
"Permissions setup": "Configuración de permisos",
"Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.": "Eagle Animation requiere permisos de cámara y micrófono para funcionar, si se omite, podrás conceder el acceso en la configuración más tarde.",
"Let's go!": "¡Vamos!",
"Skip setup": "Omitir configuración"
}
13 changes: 12 additions & 1 deletion resources/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,16 @@
"The exported frames resolution": "Résolution des images exportées",
"Use project ratio": "Utiliser le ratio du projet",
"Normalize all the frames to match the project aspect ratio": "Normaliser toutes les images pour qu'elles correspondent au ratio du projet",
"Choose a camera": "Choisir une caméra"
"Choose a camera": "Choisir une caméra",
"Camera access": "Accès à la caméra",
"Microphone access": "Accès au microphone",
"Grant access to the camera to capture photos": "Permettre l'accès à la caméra pour prendre des photos",
"Grant access to the microphone to record voices and sounds": "Permettre l'accès au microphone pour enregistrer des voix et des sons",
"Acces granted": "Accès autorisé",
"Grant permission": "Donner la permission",
"Permissions": "Permissions",
"Permissions setup": "Configuration des permissions",
"Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.": "Eagle Animation requiert l'accès à la caméra et au microphone pour fonctionner. Vous pourrez accorder l'accès dans les paramètres plus tard.",
"Let's go!": "C'est parti",
"Skip setup": "Continuer sans configurer"
}
13 changes: 12 additions & 1 deletion resources/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,16 @@
"The exported frames resolution": "La risoluzione dei fotogrammi esportati",
"Use project ratio": "Usa il rapporto del progetto",
"Normalize all the frames to match the project aspect ratio": "Normalizza tutti i fotogrammi per farli corrispondere al rapporto di aspetto del progetto",
"Choose a camera": "__NOT_TRANSLATED__"
"Choose a camera": "Scegli una fotocamera",
"Camera access": "Accesso alla fotocamera",
"Microphone access": "Accesso al microfono",
"Grant access to the camera to capture photos": "Concedi l'accesso alla fotocamera per scattare foto",
"Grant access to the microphone to record voices and sounds": "Concedi l'accesso al microfono per registrare voci e suoni",
"Acces granted": "Accesso concesso",
"Grant permission": "Concedi il permesso",
"Permissions": "Permessi",
"Permissions setup": "Configurazione dei permessi",
"Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.": "Eagle Animation richiede i permessi per la fotocamera e il microfono per funzionare. Se saltato, sarai in grado di concedere l'accesso nelle impostazioni più tardi.",
"Let's go!": "Andiamo!",
"Skip setup": "Salta configurazione"
}
13 changes: 12 additions & 1 deletion resources/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,16 @@
"The exported frames resolution": "Rozdzielczość eksportowanych klatek",
"Use project ratio": "Użyj proporcji projektu",
"Normalize all the frames to match the project aspect ratio": "Normalizuj wszystkie klatki, aby pasowały do proporcji projektu",
"Choose a camera": "__NOT_TRANSLATED__"
"Choose a camera": "Wybierz kamerę",
"Camera access": "Dostęp do kamery",
"Microphone access": "Dostęp do mikrofonu",
"Grant access to the camera to capture photos": "Zezwól na dostęp do kamery, aby robić zdjęcia",
"Grant access to the microphone to record voices and sounds": "Zezwól na dostęp do mikrofonu, aby nagrywać głosy i dźwięki",
"Acces granted": "Dostęp przyznany",
"Grant permission": "Przyznać uprawnienia",
"Permissions": "Uprawnienia",
"Permissions setup": "Konfiguracja uprawnień",
"Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.": "Eagle Animation wymaga uprawnień do kamery i mikrofonu, aby działać. Jeśli pominiesz, będziesz mógł przyznać dostęp w ustawieniach.",
"Let's go!": "Zaczynajmy!",
"Skip setup": "Pomiń konfigurację"
}
13 changes: 12 additions & 1 deletion resources/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,16 @@
"The exported frames resolution": "A resolução dos quadros exportados",
"Use project ratio": "Use a proporção do projeto",
"Normalize all the frames to match the project aspect ratio": "Normalize todos os quadros para corresponder à proporção do projeto",
"Choose a camera": "__NOT_TRANSLATED__"
"Choose a camera": "Escolha uma câmera",
"Camera access": "Acesso à câmera",
"Microphone access": "Acesso ao microfone",
"Grant access to the camera to capture photos": "Permitir acesso à câmera para capturar fotos",
"Grant access to the microphone to record voices and sounds": "Permitir acesso ao microfone para gravar vozes e sons",
"Acces granted": "Acesso concedido",
"Grant permission": "Conceder permissão",
"Permissions": "Permissões",
"Permissions setup": "Configuração de permissões",
"Eagle Animation requires camera and microphone permissions to work, if skipped, you will be able to grant access in the settings.": "Eagle Animation requer permissões de câmera e microfone para funcionar, se ignorado, você poderá conceder acesso nas configurações mais tarde.",
"Let's go!": "Vamos lá!",
"Skip setup": "Pular configuração"
}
1 change: 1 addition & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const VERSION = json.version;
export const LS_PREFIX = 'ea_';
export const LS_LANGUAGE = `${LS_PREFIX}language`;
export const LS_SETTINGS = `${LS_PREFIX}settings`;
export const LS_PERMISSIONS = `${LS_PREFIX}permissions`;

// Eagle Animation files
export const DIRECTORY_NAME = 'EagleAnimation';
Expand Down
26 changes: 24 additions & 2 deletions src/main/actions.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { existsSync } from 'node:fs';
import { writeFile } from 'node:fs/promises';
import { readFile, writeFile } from 'node:fs/promises';
import { homedir } from 'node:os';

import { shell } from 'electron';
import { shell, systemPreferences } from 'electron';
import envPaths from 'env-paths';
import { mkdirp } from 'mkdirp';
import fetch from 'node-fetch';
Expand Down Expand Up @@ -67,6 +67,25 @@ const computeProject = (data) => {
};

const actions = {
GET_MEDIA_PERMISSIONS: async () => {
if (typeof systemPreferences.getMediaAccessStatus === 'function') {
const [camera, microphone] = await Promise.all([systemPreferences.getMediaAccessStatus('camera'), systemPreferences.getMediaAccessStatus('microphone')]);
return {
camera,
microphone,
};
}
return {
camera: 'granted',
microphone: 'granted',
};
},
ASK_MEDIA_PERMISSION: async (evt, { mediaType }) => {
if (typeof systemPreferences.askForMediaAccess === 'function') {
return systemPreferences.askForMediaAccess(mediaType);
}
return true;
},
GET_LAST_VERSION: async () => {
if (CONTRIBUTE_REPOSITORY) {
const res = await fetch(`https://raw.githubusercontent.com/${CONTRIBUTE_REPOSITORY}/master/package.json`).then((res) => res.json());
Expand All @@ -78,6 +97,9 @@ const actions = {
const projects = await getProjectsList(PROJECTS_PATH);
return projects.map(computeProject);
},
GET_PICTURE: async (evt, { project_id, track, filename }) => {
return readFile(getPictureLink(join(PROJECTS_PATH, project_id), track, filename));
},
NEW_PROJECT: async (evt, { title }) => {
const data = await createProject(PROJECTS_PATH, title);
return computeProject(data);
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { WindowProvider } from './contexts/WindowContext';
import AnimatorView from './views/Animator';
import ExportView from './views/Export';
import HomeView from './views/Home';
import PermissionsView from './views/Permissions';
import SettingsView from './views/Settings';
import ShortcutsView from './views/Shortcuts';

Expand All @@ -16,6 +17,7 @@ const App = () => (
<Route exact path="/" element={<HomeView />} />
<Route exact path="/settings" element={<SettingsView />} />
<Route exact path="/shortcuts" element={<ShortcutsView />} />
<Route exact path="/permissions" element={<PermissionsView />} />
<Route exact path="/animator/:id/:track" element={<AnimatorView />} />
<Route exact path="/export/:id/:track" element={<ExportView />} />
<Route path="*" element={<>404</>} />
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/Exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const generateFakeFrame = (resolution, format) =>
);
});

const ExportFrame = (
export const ExportFrame = (
link,
resolution = null, // {width, height}
format = null, // png | jpg | webp
Expand Down
Loading

0 comments on commit d42654f

Please sign in to comment.