mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-11 10:40:52 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
698c4e9ec3 | ||
|
|
beb8654816 |
@@ -26,13 +26,13 @@ export default class SshKeyService {
|
||||
if (_exist) {
|
||||
config = await fs.readFile(this.sshConfigFilePath, { encoding: 'utf-8' });
|
||||
} else {
|
||||
await writeFileWithLock(this.sshConfigFilePath, '', { mode: 0o600 });
|
||||
await writeFileWithLock(this.sshConfigFilePath, '', { mode: '600' });
|
||||
}
|
||||
if (!config.includes(this.sshConfigHeader)) {
|
||||
await writeFileWithLock(
|
||||
this.sshConfigFilePath,
|
||||
`${this.sshConfigHeader}\n\n${config}`,
|
||||
{ mode: 0o600 },
|
||||
{ mode: '600' },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ export default class SshKeyService {
|
||||
path.join(this.sshPath, alias),
|
||||
`${key}${os.EOL}`,
|
||||
{
|
||||
mode: 0o400,
|
||||
mode: '400',
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
@@ -83,7 +83,7 @@ export default class SshKeyService {
|
||||
config,
|
||||
{
|
||||
encoding: 'utf8',
|
||||
mode: 0o600,
|
||||
mode: '600',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,9 @@ export async function writeFileWithLock(
|
||||
if (typeof options === 'string') {
|
||||
options = { encoding: options };
|
||||
}
|
||||
let isNewFile = false;
|
||||
if (!(await fileExist(filePath))) {
|
||||
// Create the file with the specified mode if provided, otherwise use default
|
||||
const fileMode = options?.mode || 0o666;
|
||||
const fileHandle = await open(filePath, 'w', fileMode);
|
||||
await fileHandle.close();
|
||||
isNewFile = true;
|
||||
const fileHandle = await open(filePath, 'w');
|
||||
fileHandle.close();
|
||||
}
|
||||
const lockfilePath = getUniqueLockPath(filePath);
|
||||
|
||||
@@ -39,8 +35,7 @@ export async function writeFileWithLock(
|
||||
lockfilePath,
|
||||
});
|
||||
await writeFile(filePath, content, { encoding: 'utf8', ...options });
|
||||
// Only chmod if the file already existed (not just created with the correct mode)
|
||||
if (!isNewFile && options?.mode) {
|
||||
if (options?.mode) {
|
||||
await chmod(filePath, options.mode);
|
||||
}
|
||||
await release();
|
||||
|
||||
Generated
+4
-4
@@ -11362,7 +11362,7 @@ snapshots:
|
||||
postcss-preset-env: 7.5.0(postcss@8.5.6)
|
||||
rollup-plugin-visualizer: 5.9.0(rollup@3.29.5)
|
||||
systemjs: 6.15.1
|
||||
vite: 4.5.2(@types/node@17.0.45)(less@4.1.3)(lightningcss@1.22.1)(sass@1.54.0)(terser@5.44.1)
|
||||
vite: 4.5.2(@types/node@17.0.45)(less@4.4.2)(lightningcss@1.22.1)(sass@1.54.0)(terser@5.44.1)
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- lightningcss
|
||||
@@ -11877,7 +11877,7 @@ snapshots:
|
||||
'@babel/plugin-transform-react-jsx-self': 7.27.1(@babel/core@7.28.5)
|
||||
'@babel/plugin-transform-react-jsx-source': 7.27.1(@babel/core@7.28.5)
|
||||
react-refresh: 0.14.2
|
||||
vite: 4.5.2(@types/node@17.0.45)(less@4.1.3)(lightningcss@1.22.1)(sass@1.54.0)(terser@5.44.1)
|
||||
vite: 4.5.2(@types/node@17.0.45)(less@4.4.2)(lightningcss@1.22.1)(sass@1.54.0)(terser@5.44.1)
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -18090,7 +18090,7 @@ snapshots:
|
||||
react: 18.3.1
|
||||
react-dom: 18.3.1(react@18.3.1)
|
||||
|
||||
vite@4.5.2(@types/node@17.0.45)(less@4.1.3)(lightningcss@1.22.1)(sass@1.54.0)(terser@5.44.1):
|
||||
vite@4.5.2(@types/node@17.0.45)(less@4.4.2)(lightningcss@1.22.1)(sass@1.54.0)(terser@5.44.1):
|
||||
dependencies:
|
||||
esbuild: 0.18.20
|
||||
postcss: 8.5.6
|
||||
@@ -18098,7 +18098,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@types/node': 17.0.45
|
||||
fsevents: 2.3.3
|
||||
less: 4.1.3
|
||||
less: 4.4.2
|
||||
lightningcss: 1.22.1
|
||||
sass: 1.54.0
|
||||
terser: 5.44.1
|
||||
|
||||
Reference in New Issue
Block a user