Update, and fix problem where the author patched the previous patch for hosting on other ports

This commit is contained in:
DUOLabs333
2022-04-25 19:29:38 -04:00
parent e2b23cefdc
commit af8387e39e
10 changed files with 16873 additions and 23381 deletions

View File

@@ -128,7 +128,7 @@ def find_and_replace(file,find,replace):
pp.write(file1)
#Allow any port to be used
find_and_replace('code/pp/pp.js','8887','')
find_and_replace('code/pp/pp.js','"\'$!|"))','"\'$!|"))||true')
#Don't load Google Analytics
find_and_replace('index.html','//www.google-analytics.com/analytics.js','')

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
def hi():
return False or True
print(hi())

File diff suppressed because one or more lines are too long

View File

@@ -1,367 +1,472 @@
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://apis.google.com/js/api.js"></script>
</head>
<body onload="go()">
<head>
<script type="text/javascript" src="https://apis.google.com/js/api.js"></script>
<script src="https://accounts.google.com/gsi/client" async defer></script>
</head>
<body onload="go()">
<script type="text/javascript">
<script type="text/javascript">
var sentFalse = false;
var clientId = "463342976776-04ub3ijsr7i5qobn8ha32ap6vsaae75a.apps.googleusercontent.com";
var scope = 'https://www.googleapis.com/auth/drive';
var discoveryDocs = ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest'];
var oauthToken;
var GoogleAuth;
var sentFalse = false;
var clientId = '463342976776-04ub3ijsr7i5qobn8ha32ap6vsaae75a.apps.googleusercontent.com';
var scope = 'https://www.googleapis.com/auth/drive';
var discoveryDocs = 'https://www.googleapis.com/discovery/v1/apis/drive/v3/rest';
function go()
var client;
var isShared = false;
var sharedDrives = null;
function go()
{
var queryString = window.location.search;
var urlParams = new URLSearchParams(queryString);
if(urlParams.get('sharedDrive') == 'true') isShared = true;
window.addEventListener("message", onMessage, false);
gapi.load('client', gapiInit);
}
function saveToken(e)
{
localStorage.setItem("googledriveAccessToken", e.access_token);
localStorage.setItem("googledriveAccessTokenValidUntil", Date.now() + e.expires_in * 1000);
send("ready", true);
}
function gapiInit() {
gapi.client.init({})
.then(function() {
gapi.client.load(discoveryDocs)
.then(function() {
client = google.accounts.oauth2.initTokenClient({
client_id: clientId,
scope: scope,
callback: saveToken,
});
if(Date.now() < localStorage.getItem("googledriveAccessTokenValidUntil"))
{
gapi.client.setToken({ "access_token" : localStorage.getItem("googledriveAccessToken") });
send("ready", true);
}
else
{
send("ready", false);
sentFalse = true;
}
})
.catch(function(e) {handleError(e); });
})
.catch(function(e) {handleError(e); });
}
function handleError(e)
{
console.log(e);
if(e.result && e.result.error && e.result.error.code)
{
gapi.load('client:auth2', {'callback': onAuthApiLoad});
}
function handleError(e)
if(e.result.error.code == 403) {send("ready",false); sentFalse = true;}
if(e.result.error.code == 401) {send("ready",false); sentFalse = true;}
}
else if (e.error)
{
console.log(e);
if(e.result && e.result.error && e.result.error.code)
if(e.error == "access_denied") {send("ready",false); sentFalse = true;}
if(e.error == "popup_closed_by_user") {send("ready",false); sentFalse = true;}
if(e.error == "popup_blocked_by_browser") {send("ready",false); sentFalse = true;}
if(e.error == "multiple_colons") {send(1,"Rename path contains more than one colon.");}
}
}
function authorize(action,prms)
{
sentFalse = false;
client.requestAccessToken();
}
function getSharedDriveId(name)
{
for(var i = 0; i < sharedDrives.length; ++i)
{
if(sharedDrives[i].name == name) return sharedDrives[i].id;
}
return null;
}
function findFile(action, path, id, pageToken, buffer)
{
if(!id)
{
if(!isShared) id = "root";
else if(path.length == 1 && path[0] == "")
{
if(e.result.error.code == 403) {send("ready",false); sentFalse = true;}
if(e.result.error.code == 401) {send("ready",false); sentFalse = true;}
}
else if (e.error)
listDrives(null, []);
return;
}
else
{
if(e.error == "access_denied") {send("ready",false); sentFalse = true;}
if(e.error == "popup_closed_by_user") {send("ready",false); sentFalse = true;}
if(e.error == "popup_blocked_by_browser") {send("ready",false); sentFalse = true;}
if(e.error == "multiple_colons") {send(1,"Rename path contains more than one colon.");}
id = getSharedDriveId(path[0]);
path = path.slice(1);
}
}
function authorize(action,prms)
if(!id) { handleError({"error" : "no_id"}); return; }
if(path.length == 0 || path[0] == '')
{
sentFalse = false;
GoogleAuth.signIn()
.then(function () {
send("ready",true);
if(action) { findFile(action, prms.path.slice(1).split("/"), null, null, prms.buffer); }
})
.catch(function(e) {
handleError(e);
});
if(action == listDir)
{
var query = "'" + id + "' in parents";
action(null, query, []);
}
else { action(id); }
return;
}
if(path.length == 1 && action == createDir)
{
action(id,path[0]);
return;
}
if(path.length == 1 && action == checkFile)
{
action(id, path[0], null, buffer);
return;
}
function onAuthApiLoad()
{
window.addEventListener("message", onMessage, false);
gapi.client.init({
clientId: clientId,
scope: scope,
discoveryDocs :discoveryDocs
})
.then(function () {
GoogleAuth = gapi.auth2.getAuthInstance();
if(!GoogleAuth.isSignedIn.get()) { sentFalse = true; send("ready",false); }
else { send("ready",true); }
})
.catch(handleError);
}
var newFile = null;
if(path.length == 1 && action == renameFile)
{
var prmSplit = path[0].split(":");
if (prmSplit.length > 2) { handleError({"error" : "multiple_colons"}); return; }
else { path[0] = prmSplit[0]; newFile = prmSplit[1]; }
}
function findFile(action, path, id, pageToken, buffer)
{
if(!id) id = "root";
if(path.length == 0 || path[0] == '')
{
if(action == listDir)
{
var query = "'" + id + "' in parents";
action(null, query, []);
}
else { action(id); }
return;
}
if(path.length == 1 && action == createDir)
{
action(id,path[0]);
return;
}
if(path.length == 1 && action == checkFile)
{
action(id, path[0], null, buffer);
return;
}
var query = "'" + id + "' in parents";
var req = {
'q': query,
'pageToken' : pageToken,
'pageSize': 1000,
'fields': "nextPageToken, files(id, name, size, modifiedTime, kind, mimeType, trashed)",};
if(isShared)
{
req['supportsAllDrives'] = true;
req['includeItemsFromAllDrives'] = true;
}
gapi.client.drive.files.list(req)
.then(function(response) {
var files = response.result.files;
pageToken = response.result.nextPageToken;
var found = false;
for (var i = 0; i < files.length; ++i)
{
if(files[i].trashed) continue;
if(files[i].name == path[0])
{
found = true;
if(newFile && action == renameFile) { renameFile(files[i].id, newFile); return; }
else { findFile(action, path.slice(1), files[i].id, null, buffer); return; }
}
}
if(!found && pageToken) findFile(action, path, id, pageToken, buffer);
else if(action == checkFile) newFile(id,path[0],buffer);
else if(action == renameFile) { handleError("Could not find file to rename '"+path[0]+"'"); send(1, "Could not find file to rename '"+path[0]+"'"); }
})
.catch(handleError);
}
var newFile = null;
if(path.length == 1 && action == renameFile)
{
var prmSplit = path[0].split(":");
if (prmSplit.length > 2) { handleError({"error" : "multiple_colons"}); return; }
else { path[0] = prmSplit[0]; newFile = prmSplit[1]; }
}
function listDrives(pageToken, out)
{
gapi.client.drive.drives.list(
{
'pageToken' : pageToken,
'pageSize' : 50,
fields: 'nextPageToken, drives(id, name, createdTime)',})
.then(function(response) {
var drives = response.result.drives;
sharedDrives = response.result.drives;
pageToken = response.result.nextPageToken;
for(var i = 0; i < drives.length; ++i)
{
out.push([drives[i].name, -1, Math.round(Date.parse(drives[i].createdTime)/1000)])
}
if(pageToken) listDir(pageToken,query,out);
else { send(0,out); }
})
.catch(handleError);
}
var query = "'" + id + "' in parents";
gapi.client.drive.files.list({
'q': query,
'pageToken' : pageToken,
'pageSize': 1000,
'fields': "nextPageToken, files(id, name, size, modifiedTime, kind, mimeType)",})
.then(function(response) {
var files = response.result.files;
pageToken = response.result.nextPageToken;
var found = false;
for (var i = 0; i < files.length; ++i)
{
if(files[i].name == path[0])
{
found = true;
if(newFile && action == renameFile) { renameFile(files[i].id, newFile); return; }
else { findFile(action, path.slice(1), files[i].id, null, buffer); return; }
}
}
if(!found && pageToken) findFile(action, path, id, pageToken, buffer);
else if(action == checkFile) newFile(id,path[0],buffer);
else if(action == renameFile) { handleError("Could not find file to rename '"+path[0]+"'"); send(1, "Could not find file to rename '"+path[0]+"'"); }
})
.catch(handleError);
}
function listDir(pageToken, query, out)
{
gapi.client.drive.files.list({
'q': query,
'pageToken' : pageToken,
'pageSize': 1000,
'fields': "nextPageToken, files(id, name, size, modifiedTime, kind, mimeType, thumbnailLink)",})
.then(function(response) {
var files = response.result.files;
pageToken = response.result.nextPageToken;
for(var i = 0; i<files.length; ++i)
{
if(files[i].mimeType == "application/vnd.google-apps.folder") { out.push([files[i].name, -1, Math.round(Date.parse(files[i].modifiedTime)/1000)]); }
else if(files[i].mimeType.includes("application/vnd.google-apps.")) { }
else
{
if(files[i].thumbnailLink) { out.push([files[i].name,files[i].size ? parseInt(files[i].size) : 0, Math.round(Date.parse(files[i].modifiedTime)/1000), files[i].thumbnailLink]); }
function listDir(pageToken, query, out)
{
var req = {
'q': query,
'pageToken' : pageToken,
'pageSize': 1000,
'fields': "nextPageToken, files(id, name, size, modifiedTime, kind, mimeType, thumbnailLink, trashed)",};
if(isShared)
{
req['supportsAllDrives'] = true;
req['includeItemsFromAllDrives'] = true;
}
gapi.client.drive.files.list(req)
.then(function(response) {
var files = response.result.files;
pageToken = response.result.nextPageToken;
for(var i = 0; i<files.length; ++i)
{
if(files[i].trashed) continue;
else if(files[i].mimeType == "application/vnd.google-apps.folder") { out.push([files[i].name, -1, Math.round(Date.parse(files[i].modifiedTime)/1000)]); }
else if(files[i].mimeType.includes("application/vnd.google-apps.")) { }
else
{
if(files[i].thumbnailLink) { out.push([files[i].name,files[i].size ? parseInt(files[i].size) : 0, Math.round(Date.parse(files[i].modifiedTime)/1000), files[i].thumbnailLink]); }
//but maybe we should only show thumbnail to files which Photopea can open - Gdrive also makes thumbnails for spreadsheets etc.
else { out.push([files[i].name,parseInt(files[i].size), Math.round(Date.parse(files[i].modifiedTime)/1000)]); }
}
}
if(pageToken) listDir(pageToken,query,out);
else { send(0,out); }
if(pageToken) listDir(pageToken,query,out);
else { send(0,out); }
})
.catch(handleError);
}
.catch(handleError);
}
function downloadFile(fileId)
{
var xhr = new XMLHttpRequest();
xhr.open('GET', "https://www.googleapis.com/drive/v3/files/" + fileId + "?alt=media");
xhr.responseType = "arraybuffer";
xhr.setRequestHeader('Authorization', 'Bearer ' + GoogleAuth.currentUser.get().getAuthResponse().access_token);
xhr.onload = function(e) {window.parent.postMessage(e.target.response,"*"); };
xhr.onerror = function(e) { console.error(e); };
xhr.send();
}
function downloadFile(fileId)
{
var xhr = new XMLHttpRequest();
var shared = "";
if(isShared) shared = "&supportsAllDrives=true";
xhr.open('GET', "https://www.googleapis.com/drive/v3/files/" + fileId + "?alt=media" + shared);
xhr.responseType = "arraybuffer";
xhr.setRequestHeader('Authorization', 'Bearer ' + gapi.client.getToken().access_token);
xhr.onload = function(e) {window.parent.postMessage(e.target.response,"*"); };
xhr.onerror = function(e) { console.error(e); };
xhr.send();
}
function downloadThumbnail(fileId)
{
var xhr = new XMLHttpRequest();
xhr.open('GET', "https://www.googleapis.com/drive/v3/files/" + fileId + "?fields=thumbnailLink");
xhr.setRequestHeader('Authorization', 'Bearer ' + GoogleAuth.currentUser.get().getAuthResponse().access_token);
xhr.onload = function(e)
{
var link = JSON.parse(e.target.response).thumbnailLink;
console.log(JSON.parse(e.target.response));
if (link)
{
var xhr2 = new XMLHttpRequest();
xhr2.open('GET', link);
xhr2.responseType = "arraybuffer";
xhr2.onload = function(e) {window.parent.postMessage(e.target.response,"*"); };
xhr2.onerror = function(e) { console.error(e); };
xhr2.send();
}
else { console.error("Could not get thumbnailLink."); }
};
xhr.onerror = function(e) { console.error(e); };
xhr.send();
}
function downloadThumbnail(fileId)
{
var xhr = new XMLHttpRequest();
var shared = "";
if(isShared) shared = "&supportsAllDrives=true";
xhr.open('GET', "https://www.googleapis.com/drive/v3/files/" + fileId + "?fields=thumbnailLink" + shared);
xhr.setRequestHeader('Authorization', 'Bearer ' + gapi.client.getToken().access_token);
xhr.onload = function(e)
{
var link = JSON.parse(e.target.response).thumbnailLink;
console.log(JSON.parse(e.target.response));
if (link)
{
var xhr2 = new XMLHttpRequest();
xhr2.open('GET', link);
xhr2.responseType = "arraybuffer";
xhr2.onload = function(e) {window.parent.postMessage(e.target.response,"*"); };
xhr2.onerror = function(e) { console.error(e); };
xhr2.send();
}
else { console.error("Could not get thumbnailLink."); }
};
xhr.onerror = function(e) { console.error(e); };
xhr.send();
}
function deleteFile(fileId)
{
gapi.client.drive.files.delete({
'fileId' : fileId,
})
.then(function(response) {
send(0,"");
})
.catch(function(response) {
send(1,response);
handleError(response);
});
}
function deleteFile(fileId)
{
if(isShared) { trashFile(fileId); return; }
var req = { 'fileId' : fileId, };
if(isShared) req['supportsAllDrives'] = true;
gapi.client.drive.files.delete(req)
.then(function(response) {
send(0,"");
})
.catch(function(response) {
send(1,response);
handleError(response);
});
}
function createDir(parentId, name)
{
gapi.client.drive.files.create(
{
'resource' :
{
'name' : name,
'parents' : [parentId],
'mimeType': 'application/vnd.google-apps.folder',
}
})
.then(function(response) {
send(0,"");
})
.catch(function(response) {
send(1,response);
handleError(response);
});
}
function trashFile(fileId)
{
var req = {
'fileId' : fileId,
'resource' :
{
'trashed' : true,
}
};
if(isShared) req['supportsAllDrives'] = true;
gapi.client.drive.files.update(req)
.then(function(response) {
send(0,"");
})
.catch(function(response) {
send(1,response);
handleError(response);
});
}
function renameFile(fileId, newName)
{
gapi.client.drive.files.update({
'fileId' : fileId,
'resource' :
{
'name' : newName,
}
})
.then(function(response) {
send(0,"");
})
.catch(function(response) {
send(1,response);
handleError(response);
});
}
function createDir(parentId, name)
{
var req = {
'resource' :
{
'name' : name,
'parents' : [parentId],
'mimeType': 'application/vnd.google-apps.folder',
}
}
if(isShared) req['supportsAllDrives'] = true;
gapi.client.drive.files.create( req )
.then(function(response) {
send(0,"");
})
.catch(function(response) {
send(1,response);
handleError(response);
});
}
function renameFile(fileId, newName)
{
var req = {
'fileId' : fileId,
'resource' :
{
'name' : newName,
}
};
if(isShared) req['supportsAllDrives'] = true;
gapi.client.drive.files.update(req)
.then(function(response) {
send(0,"");
})
.catch(function(response) {
send(1,response);
handleError(response);
});
}
//check if file exists, then overwrite, otherwise create new file.
function checkFile(parentId, name, pageToken, buffer)
{
var query = "'" + parentId + "' in parents";
gapi.client.drive.files.list({
'q': query,
'pageToken' : pageToken,
'pageSize': 1000,
'fields': "nextPageToken, files(id, name)",})
.then(function(response) {
var files = response.result.files;
pageToken = response.result.nextPageToken;
var found = false;
for (var i = 0; i < files.length; ++i)
{
if(files[i].name == name)
{
found = true;
uploadFile(files[i].id,parentId,name,buffer);
return;
}
}
if(!found && pageToken) checkFile(parentId, name, pageToken, buffer);
else uploadFile(null,parentId,name,buffer);
})
.catch(handleError);
}
function uploadFile(fileId, parentId, name, buffer)
{
var file = new Blob([buffer]);
var metadata = { 'name': name, };
if(!fileId) metadata['parents'] = [parentId];
var xhr = new XMLHttpRequest();
if(buffer.byteLength > 5000000)
{
var contentType = file.type || 'application/octet-stream';
metadata['mimeType'] = contentType;
metadata['Content-Type'] = contentType;
metadata['Content-Length'] = file.size;
if(!fileId) xhr.open("POST", "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable");
else xhr.open("PATCH", "https://www.googleapis.com/upload/drive/v3/files/" + fileId + "?uploadType=resumable");
xhr.setRequestHeader('Authorization', 'Bearer ' + GoogleAuth.currentUser.get().getAuthResponse().access_token);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('X-Upload-Content-Length', file.size);
xhr.setRequestHeader('X-Upload-Content-Type', contentType);
xhr.onreadystatechange = function() {
if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
var locationUrl = xhr.getResponseHeader('Location');
var reader = new FileReader();
reader.onload = function(e) {
var xhr2 = new XMLHttpRequest();
xhr2.open('PUT', locationUrl, true);
xhr2.setRequestHeader('Content-Type', contentType);
xhr2.setRequestHeader('X-Upload-Content-Type', contentType);
xhr2.onreadystatechange = function() {
if(xhr2.readyState === XMLHttpRequest.DONE && xhr2.status === 200) {
send(0,"");
}
};
xhr2.onerror = function(e) { send(1,e); handleError(e)};
xhr2.send(reader.result);
};
reader.readAsArrayBuffer(file);
}
};
xhr.onerror = function(e) { send(1,e); handleError(e)};
xhr.send(JSON.stringify(metadata));
var req = {
'q': query,
'pageToken' : pageToken,
'pageSize': 1000,
'fields': "nextPageToken, files(id, name, trashed)",};
if(isShared)
{
req['supportsAllDrives'] = true;
req['includeItemsFromAllDrives'] = true;
}
gapi.client.drive.files.list(req)
.then(function(response) {
var files = response.result.files;
pageToken = response.result.nextPageToken;
var found = false;
for (var i = 0; i < files.length; ++i)
{
if(files[i].trashed) continue;
if(files[i].name == name)
{
found = true;
uploadFile(files[i].id,parentId,name,buffer);
return;
}
}
if(!found && pageToken) checkFile(parentId, name, pageToken, buffer);
else uploadFile(null,parentId,name,buffer);
})
.catch(handleError);
}
else
function uploadFile(fileId, parentId, name, buffer)
{
var form = new FormData();
form.append('metadata', new Blob([JSON.stringify(metadata)], { type: 'application/json' }));
form.append('file', file);
if(!fileId) xhr.open('POST', 'https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&fields=id');
else xhr.open('PATCH', 'https://www.googleapis.com/upload/drive/v3/files/' + fileId + '?uploadType=multipart&fields=id');
xhr.setRequestHeader('Authorization', 'Bearer ' + GoogleAuth.currentUser.get().getAuthResponse().access_token);
xhr.onload = function(response) { send(0,""); };
xhr.onerror = function(e) { send(1,e); handleError(e)};
xhr.send(form);
}
}
var file = new Blob([buffer]);
var metadata = { 'name': name, };
if(!fileId) metadata['parents'] = [parentId];
var xhr = new XMLHttpRequest();
if(buffer.byteLength > 5000000)
{
var contentType = file.type || 'application/octet-stream';
metadata['mimeType'] = contentType;
metadata['Content-Type'] = contentType;
metadata['Content-Length'] = file.size;
var shared = "";
if(isShared) shared = "&supportsAllDrives=true";
if(!fileId) xhr.open("POST", "https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable" + shared);
else xhr.open("PATCH", "https://www.googleapis.com/upload/drive/v3/files/" + fileId + "?uploadType=resumable" + shared);
xhr.setRequestHeader('Authorization', 'Bearer ' + gapi.client.getToken().access_token);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('X-Upload-Content-Length', file.size);
xhr.setRequestHeader('X-Upload-Content-Type', contentType);
xhr.onreadystatechange = function() {
if(xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
var locationUrl = xhr.getResponseHeader('Location');
var reader = new FileReader();
reader.onload = function(e) {
var xhr2 = new XMLHttpRequest();
function signOutUser()
{
GoogleAuth.signOut().then(function () {
//console.log('User signed out.');
send(0,"");
})
.catch(handleError);
}
xhr2.open('PUT', locationUrl, true);
xhr2.setRequestHeader('Content-Type', contentType);
xhr2.setRequestHeader('X-Upload-Content-Type', contentType);
xhr2.onreadystatechange = function() {
if(xhr2.readyState === XMLHttpRequest.DONE && xhr2.status === 200) {
send(0,"");
}
};
xhr2.onerror = function(e) { send(1,e); handleError(e)};
xhr2.send(reader.result);
};
reader.readAsArrayBuffer(file);
}
};
xhr.onerror = function(e) { send(1,e); handleError(e)};
xhr.send(JSON.stringify(metadata));
}
else
{
var form = new FormData();
form.append('metadata', new Blob([JSON.stringify(metadata)], { type: 'application/json' }));
form.append('file', file);
var shared = "";
if(isShared) shared = "&supportsAllDrives=true";
if(!fileId) xhr.open('POST', 'https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&fields=id' + shared);
else xhr.open('PATCH', 'https://www.googleapis.com/upload/drive/v3/files/' + fileId + '?uploadType=multipart&fields=id' + shared);
xhr.setRequestHeader('Authorization', 'Bearer ' + gapi.client.getToken().access_token);
xhr.onload = function(response) { send(0,""); };
xhr.onerror = function(e) { send(1,e); handleError(e)};
xhr.send(form);
}
}
function disconnectUser()
{
GoogleAuth.disconnect().then(function () {
//console.log('User account disconnected.');
send(0,"");
})
.catch(handleError);
}
function signOutUser()
{
localStorage.removeItem("googledriveAccessToken");
localStorage.removeItem("googledriveAccessTokenValidUntil");
var cred = gapi.client.getToken();
if (cred !== null) {
google.accounts.oauth2.revoke(cred.access_token, () => {console.log('Revoked: ' + cred.access_token)});
gapi.client.setToken('');
}
}
function doAction(action, prms)
{
if(action == signOutUser) { signOutUser(); }
//if(action == signOutUser) { disconnectUser(); }
else if(sentFalse) { authorize(action, prms); }
else if(!GoogleAuth.isSignedIn.get()) { send("ready", false); sentFalse = true; }
else if(!GoogleAuth.currentUser.get().hasGrantedScopes(scope)) { send("ready", false); sentFalse = true; }
else { findFile(action, prms.path.slice(1).split("/"), null, null, prms.buffer); }
}
function doAction(action, prms)
{
if(action == signOutUser) { signOutUser(); }
else if(sentFalse) { authorize(action, prms); }
else if(!gapi.client.getToken()) { send("ready", false); sentFalse = true; }
else { findFile(action, prms.path.slice(1).split("/"), null, null, prms.buffer); }
}
function onMessage(e) {
if(e.origin && (e.origin == "https://accounts.google.com" || e.origin == "https://content.googleapis.com")) { return; }
if((typeof e.data) == "string") {
var msg = JSON.parse(e.data);
console.log(msg);
function onMessage(e) {
if(e.origin && (e.origin == "https://accounts.google.com" || e.origin == "https://content.googleapis.com")) { return; }
if((typeof e.data) == "string") {
var msg = JSON.parse(e.data);
console.log(msg);
//TODO: cannot list directory if name contains forwardslash
if(msg.code=="show") { doAction(listDir, { "path" : msg.prm }) }
else if(msg.code=="load") { doAction(downloadFile, { "path" : msg.prm }); }
//else if(msg.code=="load") { doAction(downloadThumbnail, { "path" : msg.prm }); }
else if(msg.code=="load") { doAction(downloadFile, { "path" : msg.prm }); }
else if(msg.code=="delete") { doAction(deleteFile, { "path" : msg.prm }); }
else if(msg.code=="save" && msg.prm.endsWith("/")) { doAction(createDir, { "path" : msg.prm.slice(0, -1) }); }
//TODO: will not work if filename contains colon(s)
@@ -378,8 +483,8 @@
window.parent.postMessage(JSON.stringify({"code":code, "prm":prm}),"*");
}
</script>
</script>
</body>
</html>
</html>

View File

@@ -10,29 +10,9 @@
<title>Photopea | Online Photo Editor</title>
<!-- Facebook Pixel Code -->
<script>
window.addEventListener("load",function() {
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'/en_US/fbevents.js');
fbq('init', '2503069689824081');
fbq('track', 'PageView');
},false);
</script>
<noscript><img height="1" width="1" style="display:none"
src="/tr?id=2503069689824081&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
<link rel="apple-touch-icon" href="promo/icon512.png">
<link rel="icon" sizes="256x256" href="promo/thumb256.png">
<link rel="image_src" type="image/png" href="promo/thumb256.png" />
<link rel="icon" sizes="512x512" href="promo/icon512.png">
<link rel="image_src" type="image/png" href="promo/icon512.png" />
<link rel="manifest" href="manifest.json">
<link rel="chrome-webstore-item" href="//chrome.google.com/webstore/detail/fmophgdjdipcbfjiopifpngdjmemonko">
@@ -66,7 +46,7 @@
<!---->
<div id="cap">
<span style="position:absolute;right:0;top:0;font-size:7em;margin:0 0.2em;cursor:pointer;" onclick="hideCap()"></span>
<img style="width:8em; height:8em; margin-top:1em;" src="promo/thumb256.png" alt="Photopea logo" />
<img style="width:8em; height:8em; margin-top:1em;" src="promo/icon512.png" alt="Photopea logo" />
<h1>Photopea: advanced photo editor</h1>
<p style="font-size:1.3em">Free online photo editor supporting <b>PSD</b>, <b>XCF</b>, <b>Sketch</b>, <b>XD</b> and <b>CDR</b> formats.
(<b>Adobe Photoshop</b>, <b>GIMP</b>, <b>Sketch App</b>, <b>Adobe XD</b> and <b>CorelDRAW</b>).</p>
@@ -86,14 +66,14 @@
<script src="code/dbs/DBS.js"></script>
<script src="code/pp/pp.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-4249565-37"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','','ga');
ga('create', 'UA-4249565-37', 'photopea.com');
ga('send', 'pageview');
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag("js", new Date()); gtag("config", "UA-4249565-37");
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -181,10 +181,20 @@
}
.toolbar .tools .toolbtn {
border-radius:3px;
margin:2px 3px 1px 3px;
border-radius:6px;
margin:2px 1px 1px 1px;
padding:4px 4px;
}
.toolbar .tools .toolbtn:hover, .toolbar .tools .active {
background-color: var(--bg-bbtn);
}
.toolbar .tools .active {
border-left-width:3px;
border-left-color: var(--accent);
margin-left:-2px;
border-top-left-radius:0;
border-bottom-left-radius:0;
}
.toolbar .tools button { position:relative; }
.toolbar .tools button img
@@ -301,6 +311,8 @@
}
.block .panelhead .label {
pointer-events: none;
margin: 4px 7px 0 7px;
line-height:1.9em;
}
.mainblock .panelhead, .float .panelhead {
@@ -316,7 +328,8 @@
.block .panelhead div
{
padding:0.2em 0.5em 0.25em 0.5em;
height:26.1px;
/*padding:0.2em 0.5em 0.25em 0.5em;*/
display:inline-block;
border-top-left-radius:4px;
border-top-right-radius:4px;
@@ -343,16 +356,15 @@
.block .panelhead div .cross
{
cursor: pointer;
display:inline-block;
background-image: var(--icon_cross);
filter: invert( var(--icon_cross_invrt) );
background-size: 10px 10px;
background-repeat: no-repeat;
background-position: center;
background-size: cover; /* Generic*/
margin: 0.2em 0.2em 0 0.8em;
display:inline-block;
width: 0.8em;
height: 0.8em;
cursor: pointer;
width: 26px;
height: 26px;
vertical-align:top;
}
@@ -723,11 +735,25 @@
padding: 3px;
box-sizing: border-box;
}
/*
input, textarea, select {
background-color: var(--bg-input);
color: var(--text-color);
border-radius: 3px;
}*/
input, textarea, select {
background-color: var(--bg-input);
color: var(--text-color);
border-radius: 3px;
border: 1px solid var(--bg-input);
transition: border 0.5s;
}
input:hover, textarea:hover, select:hover, input:focus, textarea:focus, select:focus {
border: 1px solid var(--accent); /* perhaps replace with var(--accent-color) */
outline: none!important;
}
textarea { vertical-align:top; }
@@ -740,11 +766,17 @@
/*box-shadow: inset 0 0 60px rgba(0,0,0,0.5)*/
}
.rangecontFloat {
.rangecontFloat, .floatcont {
background-color: var(--base);
border-radius:6px;
box-shadow: 0px 0px 20px rgba(0,0,0,0.25);
}
.rangecontFloat {
padding: 3px 8px 4px 8px;
border-radius:5px;
border-width:1px;
}
.floatcont {
padding:7px;
/*box-shadow: 0px 8px 40px rgba(0,0,0,0.35);*/
}
.mbox input {
@@ -987,11 +1019,12 @@ input[type="checkbox"]:checked + label:before { content: "\2713"; }
z-index: 10;
background-color: var(--base);
/*border: 1px solid;*/
border-radius:6px;
min-width : 3em;
min-height: 2em;
top: 150px;
left: 150px;
box-shadow: 0px 8px 40px rgba(0,0,0,0.2);
box-shadow: 0px 4px 30px rgba(0,0,0,0.25);
}
.wdisabled {
@@ -1005,32 +1038,41 @@ input[type="checkbox"]:checked + label:before { content: "\2713"; }
.window .whead
{
font-size: 1.3em;
color: #ffffff;
background: linear-gradient(to bottom, #595959 0%,#626262 3%,#575757 7%,#3c3c3c 90%,#3a3a3a 97%,#2e2e2e 100%);
border-top-width: 1px;
border-top-color: var(--brdrLgt);
border-bottom-width: 1px;
border-bottom-color:var(--brdrDrk);
height:30px;
font-size: 1.15em;
background: linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.25) 100%);
/*background: linear-gradient(to bottom, #2b2b2b 0%, #282828 50%, #262626 100%);*/
/*background: linear-gradient(to bottom, #595959 0%,#626262 3%,#575757 7%,#3c3c3c 90%,#3a3a3a 97%,#2e2e2e 100%);*/
/*background: linear-gradient(to bottom, #59574e 0%,#626055 3%,#59574f 7%,#403f3a 90%,#41403b 97%,#383734 100%);*/
background-size: auto 100%;
border-top-left-radius:6px;
border-top-right-radius:6px;
}
.window .whead .wname
{
display: inline-block;
padding: 0.3em 0.5em;
text-shadow: 0 -1px 0 rgba(0,0,0,0.45);
font-weight: bold;
}
.window .whead .cross
{
width:0.8em;
height:0.8em;
display:inline-block;
background-size: cover;
font-size: 1.3em;
margin: 0.3em;
position:absolute; right:0;
/*float : right;*/
cursor: pointer;
display:inline-block;
background-image: var(--icon_cross);
background-size: 10px 10px;
background-repeat: no-repeat;
background-position: center;
width:30px;
height:30px;
font-size: 1.3em;
position:absolute; right:0;
}
@@ -1075,6 +1117,7 @@ input[type="checkbox"]:checked + label:before { content: "\2713"; }
height:512px;*/
/*background-color: rgba(0,0,0,0.1);*/
text-shadow:none;
/* keep it because of SVG */
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAAXNSR0IB2cksfwAAAAZQTFRF////yMjIXOIDQgAAABJJREFUeJxjYPjPgBXhEB7uAABycQ/xMT/uAgAAAABJRU5ErkJggg==);
}
@@ -1208,13 +1251,7 @@ input[type="checkbox"]:checked + label:before { content: "\2713"; }
margin-right: 1.2em;
}
.floatcont
{
padding:0.5em;
background-color:var(--base);
border-width: 1px;
/*box-shadow: 0px 8px 40px rgba(0,0,0,0.35);*/
}
/* cyrillic-ext */
@font-face {
font-display: swap;