Skip to content

Commit 6906cc8

Browse files
committed
Merge branch 'dev'
2 parents 27fd357 + da70945 commit 6906cc8

11 files changed

Lines changed: 32 additions & 36 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
"eslint.alwaysShowStatus": true,
2626
"prettier.singleQuote": false,
2727
"editor.codeActionsOnSave": {
28-
"source.fixAll.eslint": true
28+
"source.fixAll.eslint": "explicit"
2929
}
3030
}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ Download the .rpm package from our [Releases](https://github.com/Figma-Linux/fig
110110
sudo dnf install figma-linux-*.x86_64.rpm
111111
```
112112

113+
### Nixos
114+
On Nixos, you may add `figma-linux` in the `environment.systemPackages` list of your `/etc/nixos/configuration.nix` and run:
115+
```bash
116+
sudo nixos-rebuild switch
117+
```
113118

114119
## Building from source
115120

config/rollup.renderer.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ const postcss = require("rollup-plugin-postcss");
1515
const dotenv = require("dotenv");
1616
dotenv.config();
1717

18-
const panelPort = process.env.DEV_PANEL_PORT;
19-
const settingsPort = process.env.DEV_SETTINGS_PORT;
18+
const panelPort = process.env.DEV_PANEL_PORT ?? 3330;
19+
const settingsPort = process.env.DEV_SETTINGS_PORT ?? 3331;
2020
const production = process.env.NODE_ENV !== "dev";
2121
const watch = process.env.ROLLUP_WATCH === "true";
2222
const projectRootDir = path.resolve(__dirname);

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"@typescript-eslint/eslint-plugin": "^5.49.0",
5757
"@typescript-eslint/parser": "^5.49.0",
5858
"dotenv": "^16.0.3",
59-
"electron": "^27.0.4",
59+
"electron": "^27.2.2",
6060
"electron-builder": "^23.6.0",
6161
"electron-rebuild": "^3.2.9",
6262
"eslint": "^8.33.0",

src/main/ExtensionManager.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { dialogs } from "./Dialogs";
88
import { storage } from "Storage";
99
import { logger } from "./Logger";
1010
import { FILE_EXTENSION_WHITE_LIST, FILE_WHITE_LIST, MANIFEST_FILE_NAME } from "Const";
11-
import { ALLOW_CODE_FILES, ALLOW_EXT_FILES, ALLOW_UI_FILES, sanitizeFileName } from "Utils/Common";
11+
import { ALLOW_CODE_FILES, ALLOW_EXT_FILES, ALLOW_UI_FILES } from "Utils/Common";
1212
import { access, mkPath } from "Utils/Main";
1313

1414
type ObserverCallback = (args: any) => void;
@@ -438,8 +438,7 @@ export default class ExtensionManager {
438438
if (
439439
!FILE_WHITE_LIST.includes(file.name) &&
440440
(!FILE_EXTENSION_WHITE_LIST.includes(extname(file.name)) ||
441-
!/^\w+(?:\.\w+)*\.\w+/.test(file.name) ||
442-
file.name !== sanitizeFileName(file.name))
441+
!/^[\w/]+(?:\.\w+)*\.\w+/.test(file.name))
443442
) {
444443
throw new Error(`Filename "${file.name}" not allowed`);
445444
}

src/main/Storage.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from "path";
33
import * as fs from "fs";
44

55
import { DEFAULT_SETTINGS, accessSync } from "Utils/Main";
6+
import { logger } from "./Logger";
67

78
/**
89
* This class has dual initialization: in main process and renderer process
@@ -50,7 +51,16 @@ export class Storage {
5051
private readSync = (): Types.SettingsInterface => {
5152
const content = fs.readFileSync(this.filePath).toString();
5253

53-
return JSON.parse(content);
54+
let settings: Types.SettingsInterface;
55+
try {
56+
settings = JSON.parse(content);
57+
} catch (error) {
58+
logger.error("Parse settings.json file error: ", error);
59+
logger.warn("Apply default settings instead file settings.");
60+
settings = DEFAULT_SETTINGS;
61+
}
62+
63+
return settings;
5464
};
5565
private writeSync = (settings: Types.SettingsInterface): void => {
5666
fs.writeFileSync(this.filePath, JSON.stringify(settings, null, 2));

src/main/Ui/Tab.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,7 @@ export default class Tab {
201201
private windowOpenHandler(details: HandlerDetails) {
202202
const url = details.url;
203203

204-
if (isFigmaUrl(url)) {
205-
shell.openExternal(url);
206-
return { action: "deny" };
207-
}
204+
shell.openExternal(url);
208205

209206
return { action: "deny" };
210207
}

src/renderer/DesktopAPI/ThemesApplier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export class ThemesApplier {
258258
cssRule.style["fill"] = `var(--text-active)`;
259259
}
260260
if (
261-
/search--searchInput__OLD|public-DraftEditorPlaceholder-root|css_builder_color--colorTextSecondary/.test(
261+
/search--searchInput__OLD|type_panel--fontPickerTextStyle|public-DraftEditorPlaceholder-root|css_builder_color--colorTextSecondary/.test(
262262
cssRule.selectorText,
263263
)
264264
) {

src/utils/Common/extensions.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11
export const ALLOW_EXT_FILES = /^(.+\.(html|js|ts)|manifest.json)$/;
22
export const ALLOW_CODE_FILES = /^(.+\.(js|ts))$/;
33
export const ALLOW_UI_FILES = /^(.+\.html)$/;
4-
5-
export function sanitizeFileName(input: string): string {
6-
const illegalRe = /[\/\?<>\\:\*\|":]/g;
7-
const controlRe = /[\x00-\x1f\x80-\x9f]/g;
8-
const reservedRe = /^\.+$/;
9-
const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
10-
const windowsTrailingRe = /[\. ]+$/;
11-
12-
return input
13-
.replace(illegalRe, "")
14-
.replace(controlRe, "")
15-
.replace(reservedRe, "")
16-
.replace(windowsReservedRe, "")
17-
.replace(windowsTrailingRe, "");
18-
}

0 commit comments

Comments
 (0)