Skip to content

Commit

Permalink
写入文件增加文件锁
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Jan 3, 2025
1 parent 941464f commit 6a69948
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions back/config/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ export function getPlatform(userAgent: string): 'mobile' | 'desktop' {
let platform = 'desktop';
if (system === 'windows' || system === 'macos' || system === 'linux') {
platform = 'desktop';
} else if (system === 'android' || system === 'ios' || system === 'openharmony' || testUa(/mobile/g)) {
} else if (
system === 'android' ||
system === 'ios' ||
system === 'openharmony' ||
testUa(/mobile/g)
) {
platform = 'mobile';
}

Expand Down Expand Up @@ -616,7 +621,7 @@ async function replaceDomainInFile(
newDomainWithScheme += '/';
}

await fs.writeFile(filePath, updatedContent, 'utf8');
await writeFileWithLock(filePath, updatedContent);
}

async function _updateLinuxMirror(
Expand Down

0 comments on commit 6a69948

Please sign in to comment.