});
}
-function copyManifest(filePath: string, manifestData: string) {
- fs.writeFileSync(filePath, manifestData);
+function makeFileSync(file: string, data: string) {
+ fs.writeFileSync(file, data);
}
function concatWithBaseUrl(url: string, baseUrl: string) {
let startUrl = concatWithBaseUrl(manifest['start_url'], manifestUrl);
manifest['start_url'] = startUrl;
manifestFile = `${baseWorkingDir}/${appName}/appmanifest.json`;
- copyManifest(manifestFile, JSON.stringify(manifest));
+ makeFileSync(manifestFile, JSON.stringify(manifest));
manifestFile = `${downloadVirtualDir}/${appName}/appmanifest.json`;
refCount++;
return startUrl;
}
-function makeRandomId() {
- return Math.random().toString(36).substring(2, 12);
+function makeAppId(startUrl: string) {
+ let id = Buffer.from(startUrl).toString('base64');
+ id = id.replace(/=/i, '');
+ console.log(`id : ${id}`);
+ return id.substr(2, 12);
}
function convertConfigXml(appName: string, startUrl: string) {
convertedConfigXml = `${baseWorkingDir}/${appName}/config.xml`;
- let id = makeRandomId();
+ let id = makeAppId(startUrl);
let configXml = `<?xml version='1.0' encoding='UTF-8'?>`;
configXml += `<widget xmlns='http://www.w3.org/ns/widgets' xmlns:tizen='http://tizen.org/ns/widgets' id='http://yourdomain/AppManifest' version='1.0.0' viewmodes='maximized'>`;
- configXml += `<tizen:application id='${id}.${appName}' package='${id}' required_version='2.3' />`;
+ configXml += `<tizen:application id='${id}.${appName}' package='${id}' required_version='3.0' />`;
configXml += `<content src='${startUrl}' />`
configXml += `<icon src='${iconName}' />`;
configXml += `<name>${appName}</name>`;
configXml += `<access origin='*' subdomains='true' />`;
configXml += `</widget>`;
- copyManifest(convertedConfigXml, configXml);
+ makeFileSync(convertedConfigXml, configXml);
convertedConfigXml = `${downloadVirtualDir}/${appName}/config.xml`;
refCount++;
}