Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function (result) {
entitlements = plist.parse(result)
if (!entitlements['com.apple.security.app-sandbox']) {
// Only automate when app sandbox enabled by user
return
}
return readFileAsync(appInfoPath, 'utf8')
.then(function (result) {
appInfo = plist.parse(result)
// Use ElectronTeamID in Info.plist if already specified
if (appInfo.ElectronTeamID) {
debuglog('`ElectronTeamID` found in `Info.plist`: ' + appInfo.ElectronTeamID)
} else {
// The team identifier in signing identity should not be trusted
if (opts['provisioning-profile']) {
appInfo.ElectronTeamID = opts['provisioning-profile'].message.Entitlements['com.apple.developer.team-identifier']
debuglog('`ElectronTeamID` not found in `Info.plist`, use parsed from provisioning profile: ' + appInfo.ElectronTeamID)
}).then(file => plist.parse(file))
}
accountDescription: 'Configure your calendar',
dav: {
hostname: 'http://localhost:8080',
port: 8080,
secure: false,
principalurl: 'http://localhost:8080/dav/username',
username: 'username@gmail.com',
password: 'mypass'
},
contentUuid: 'abcdef',
plistUuid: 'ghijklmn'
};
let caldavConfig = plist.parse(mobileconfig.getCalDAVConfig(options));
expect(caldavConfig).to.deep.equal({
PayloadContent: [
{
CalDAVAccountDescription: 'Configure your calendar',
CalDAVPrincipalURL: 'http://localhost:8080/dav/username',
CalDAVHostName: 'http://localhost:8080',
CalDAVPort: 8080,
CalDAVUseSSL: false,
CalDAVUsername: 'username@gmail.com',
CalDAVPassword: 'mypass',
PayloadDescription: 'username@gmail.com calendar events',
PayloadDisplayName: 'username@gmail.com calendar events',
PayloadIdentifier: 'com.my.company',
PayloadOrganization: 'My Company',
PayloadType: 'com.apple.caldav.account',
function getEntitlementsFileContent() {
var pathToFile = pathToEntitlementsFile();
var content;
try {
content = fs.readFileSync(pathToFile, 'utf8');
} catch (err) {
return defaultEntitlementsFile();
}
return plist.parse(content);
}
parse(content: string): any {
return plist.parse(content);
}
function projectPlistJson(context, projectName) {
var plist = require('plist');
var path = projectPlistPath(context, projectName);
return plist.parse(fs.readFileSync(path, 'utf8'));
}
const updateInfoPlist = (infoPlistFile, key, value) => {
const data = plist.parse(fs.readFileSync(infoPlistFile, 'utf8'))
fs.writeFileSync(infoPlistFile, plist.build({ ...data, [key]: value }))
}
plist(file) {
let contents;
try {
contents = fs.readFileSync(file, 'utf-8');
} catch(e) {
contents = plist.build([]);
}
return plist.parse(contents);
}
_parsePlist (buffer) {
let result
const bufferType = buffer[0]
if (bufferType === 60 || bufferType === '<' || bufferType === 239) {
result = parsePlist(buffer.toString())
} else if (bufferType === 98) {
result = parseBplist(buffer)[0]
} else {
throw new Error('Unknow plist buffer type.')
}
return result
}
/**
function parse(aStringOrBuffer, aFile) {
const firstByte = aStringOrBuffer[0]
let results
try {
if (firstByte === 60 || firstByte === '<') {
results = plist.parse(aStringOrBuffer.toString())
} else if (firstByte === 98) {
;[results] = bplistParser.parseBuffer(aStringOrBuffer)
} else if (aFile != null) {
throw new Error(`Unable to determine format for '${aFile}'`)
} else {
throw new Error('Unable to determine format for plist aStringOrBuffer')
}
} catch (error) {
throw new Error(error)
}
return results
}