Skip to content

Commit

Permalink
default headers with origin url corrected.
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-leonardo committed Apr 24, 2020
1 parent c227154 commit 4abb8f0
Showing 1 changed file with 44 additions and 35 deletions.
79 changes: 44 additions & 35 deletions pages/_lang/generate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export default class extends Vue {
public activeFormField = null;
public showingIconModal = false;
public ifEntered = false;
public  textareaOutlineColor = '';
public textareaOutlineColor = "";
public showCopy = true;
public isImageBroken: boolean = false;
private zipRequested = false;
Expand Down Expand Up @@ -450,12 +450,14 @@ export default class extends Vue {
var updateFn = helper.debounce(this.update, 3000, false);
document && document.querySelectorAll('.l-generator-input').forEach(item => {
item.addEventListener('keyup', updateFn)
});
document && document.querySelectorAll('.l-generator-textarea').forEach(item => {
item.addEventListener('keyup', updateFn)
});
document &&
document.querySelectorAll(".l-generator-input").forEach(item => {
item.addEventListener("keyup", updateFn);
});
document &&
document.querySelectorAll(".l-generator-textarea").forEach(item => {
item.addEventListener("keyup", updateFn);
});
awa.ct.capturePageView(overrideValues);
}
Expand All @@ -478,12 +480,10 @@ export default class extends Vue {
axios.post(downloadAllUrl, this.icons, {
method: "POST",
// mode: "no-cors",
// cache: "default",
responseType: "blob",
headers: {
"content-type": "application/json; application/octet-stream",
// "Accept":"application/zip",
"Accept":"application/zip",
}
})
// .then(res => res.blob())
Expand Down Expand Up @@ -530,17 +530,15 @@ export default class extends Vue {
public filterIcons(icons): any {
return icons.filter(icon => {
if (!icon.generated || icon.src.indexOf('data') === 0)
{
if (!icon.generated || icon.src.indexOf("data") === 0) {
return icon;
}
});
}
public checkBrokenImage(icons): any {
icons.forEach(icon => {
if (icon.generated && icon.src.indexOf('data') !== 0)
{
if (icon.generated && icon.src.indexOf("data") !== 0) {
this.isImageBroken = true;
}
});
Expand All @@ -549,13 +547,13 @@ export default class extends Vue {
public textareaError(): void {
// This method is called when Enter is pressed in the textarea
this.ifEntered = true; // This property is used to determine whether or not an error message should be displayed
this.textareaOutlineColor = 'red solid 2px';
this.textareaOutlineColor = "red solid 2px";
}
public textareaCheck(): void {
// If the user presses any key other than Enter, then reset ifEntered values to remove error message
// This method is only called on keypress (not when entered is clicked)
this.ifEntered = false;
this.textareaOutlineColor = '';
this.textareaOutlineColor = "";
}
public onClickRemoveIcon(icon: generator.Icon): void {
Expand Down Expand Up @@ -588,22 +586,30 @@ export default class extends Vue {
}
let icons = this.icons.map(icon => {
return `\n\t\t{\n\t\t\t"src": "${icon.src.includes("data:image") ? "[Embedded]" : icon.src}",\n\t\t\t"sizes": "${icon.sizes}"\n\t\t}`;
return `\n\t\t{\n\t\t\t"src": "${
icon.src.includes("data:image") ? "[Embedded]" : icon.src
}",\n\t\t\t"sizes": "${icon.sizes}"\n\t\t}`;
});
return icons.toString();
}
private getScreenshots(): string {
let icons = this.screenshots.map(screenshot => {
return `\n\t\t{\n\t\t\t"src": "${screenshot.src.includes("data:image") ? "[Embedded]" : screenshot.src}",\n\t\t\t"description": "${screenshot.description}",\n\t\t\t"size": "${screenshot.size}"\n\t\t}`;
return `\n\t\t{\n\t\t\t"src": "${
screenshot.src.includes("data:image") ? "[Embedded]" : screenshot.src
}",\n\t\t\t"description": "${screenshot.description}",\n\t\t\t"size": "${
screenshot.size
}"\n\t\t}`;
});
return icons.toString();
}
private relatedApplications(): string {
let relatedApplicationscons = this.manifest.related_applications.map(app => {
return `\n\t\t{\n\t\t\t"platform": "${app.platform}",\n\t\t\t"url": "${app.url}"\n\t\t}`;
});
let relatedApplicationscons = this.manifest.related_applications.map(
app => {
return `\n\t\t{\n\t\t\t"platform": "${app.platform}",\n\t\t\t"url": "${app.url}"\n\t\t}`;
}
);
return relatedApplicationscons.toString();
}
Expand Down Expand Up @@ -633,18 +639,21 @@ export default class extends Vue {
manifest += `\t"screenshots" : [${this.getScreenshots()}],\n`;
break;
case "related_applications":
manifest += `\t"related_applications" : [${this.relatedApplications() || []}],\n`
manifest += `\t"related_applications" : [${this.relatedApplications() ||
[]}],\n`;
break;
case "prefer_related_applications":
manifest += `\t"prefer_related_applications" : ${this.manifest.prefer_related_applications},\n`
manifest += `\t"prefer_related_applications" : ${this.manifest.prefer_related_applications},\n`;
break;
default:
manifest += `\t"${property}" : "${this.manifest[property] ? this.manifest[property] : ''}",\n`;
manifest += `\t"${property}" : "${
this.manifest[property] ? this.manifest[property] : ""
}",\n`;
break;
}
}
// Removing the last ','
manifest = manifest.substring(0, manifest.length-2);
manifest = manifest.substring(0, manifest.length - 2);
manifest += this.getCustomMembers();
return `{\n${manifest}\n}`;
}
Expand Down Expand Up @@ -681,7 +690,7 @@ export default class extends Vue {
await this.uploadIcon(this.iconFile);
this.updateManifest(this.manifest$);
}
this.checkBrokenImage(this.icons)
this.checkBrokenImage(this.icons);
$iconsModal.hide();
$iconsModal.hideLoading();
this.iconFile = null;
Expand Down Expand Up @@ -1081,12 +1090,12 @@ footer a {
}
}
}
#rightSide {
width: 55%;
}
#leftSide {
width: 40%;
}
#rightSide {
width: 55%;
}
#leftSide {
width: 40%;
}
@media (max-width: 1280px) {
#rightSide {
display: none;
Expand Down Expand Up @@ -1120,7 +1129,7 @@ footer a {
}
}
#sideBySide #leftSide .animatedSection input[type="radio"] {
width: auto;
}
#sideBySide #leftSide .animatedSection input[type="radio"] {
width: auto;
}
</style>

0 comments on commit 4abb8f0

Please sign in to comment.