Skip to content

TagSpaces is an offline, open source, document manager with tagging support

removing old chrome npapi API

uggrockc99204a444ef
diff --git a/data/chrome/ChromeAllowAccessFileURLs.png b/data/chrome/ChromeAllowAccessFileURLs.png
deleted file mode 100644
index 524e98874..000000000
Binary files a/data/chrome/ChromeAllowAccessFileURLs.png and /dev/null differ
diff --git a/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Info.plist b/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Info.plist
deleted file mode 100644
index d17da57cf..000000000
--- a/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Info.plist
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>BuildMachineOSBuild</key>
- <string>11E53</string>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>NPAPIFileIOforChrome</string>
- <key>CFBundleGetInfoString</key>
- <string>NPAPIFileIOforChrome 1.0.0.0, Copyright 2012 Benryan Software Inc.</string>
- <key>CFBundleIdentifier</key>
- <string>com.NPAPIFileIOforChromeLib.NPAPI File IO for Chrome</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundlePackageType</key>
- <string>BRPL</string>
- <key>CFBundleShortVersionString</key>
- <string>NPAPIFileIOforChrome 1.0.0.0</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0.0.0</string>
- <key>CFPlugInDynamicRegisterFunction</key>
- <string></string>
- <key>CFPlugInDynamicRegistration</key>
- <string>NO</string>
- <key>CFPlugInFactories</key>
- <dict>
- <key>00000000-0000-0000-0000-000000000000</key>
- <string>MyFactoryFunction</string>
- </dict>
- <key>CFPlugInTypes</key>
- <dict>
- <key>00000000-0000-0000-0000-000000000000</key>
- <array>
- <string>00000000-0000-0000-0000-000000000000</string>
- </array>
- </dict>
- <key>CFPlugInUnloadFunction</key>
- <string></string>
- <key>DTCompiler</key>
- <string></string>
- <key>DTPlatformBuild</key>
- <string>4D199</string>
- <key>DTPlatformVersion</key>
- <string>GM</string>
- <key>DTSDKBuild</key>
- <string>11C63</string>
- <key>DTSDKName</key>
- <string>macosx10.7</string>
- <key>DTXcode</key>
- <string>0420</string>
- <key>DTXcodeBuild</key>
- <string>4D199</string>
- <key>WebPluginDescription</key>
- <string>Adds file operations to a javascript api for Chrome</string>
- <key>WebPluginMIMETypes</key>
- <dict>
- <key>application/x-npapifileioforchrome</key>
- <dict>
- <key>WebPluginExtensions</key>
- <array>
- <string></string>
- </array>
- <key>WebPluginTypeDescription</key>
- <string>Adds file operations to a javascript api for Chrome</string>
- </dict>
- </dict>
- <key>WebPluginName</key>
- <string>NPAPI File IO for Chrome</string>
-</dict>
-</plist>
diff --git a/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/MacOS/NPAPIFileIOforChrome b/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/MacOS/NPAPIFileIOforChrome
deleted file mode 100644
index d59edcd73..000000000
Binary files a/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/MacOS/NPAPIFileIOforChrome and /dev/null differ
diff --git a/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Resources/English.lproj/InfoPlist.strings b/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Resources/English.lproj/InfoPlist.strings
deleted file mode 100644
index 496e01a3a..000000000
--- a/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Resources/English.lproj/InfoPlist.strings
+++ /dev/null
@@ -1,4 +0,0 @@
-/* Localized versions of Info.plist keys */
-
-CFBundleName = "NPAPIFileIOforChrome.plugin";
-NSHumanReadableCopyright = "Copyright 2012 Benryan Software Inc.";
diff --git a/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Resources/English.lproj/Localized.rsrc b/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Resources/English.lproj/Localized.rsrc
deleted file mode 100644
index 86c59c9fe..000000000
Binary files a/data/chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin/Contents/Resources/English.lproj/Localized.rsrc and /dev/null differ
diff --git a/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChrome.dll b/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChrome.dll
deleted file mode 100644
index 95f96ea93..000000000
Binary files a/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChrome.dll and /dev/null differ
diff --git a/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChrome.so b/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChrome.so
deleted file mode 100644
index 948aced8c..000000000
Binary files a/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChrome.so and /dev/null differ
diff --git a/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChromex64.so b/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChromex64.so
deleted file mode 100644
index d90f0b85e..000000000
Binary files a/data/chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChromex64.so and /dev/null differ
diff --git a/data/chrome/background.js b/data/chrome/background.js
deleted file mode 100644
index 635c95483..000000000
--- a/data/chrome/background.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (c) 2012-2013 The TagSpaces Authors. All rights reserved.
- * Use of this source code is governed by a AGPL3 license that
- * can be found in the LICENSE file. */
-"use strict";
-
-chrome.browserAction.onClicked.addListener(function() {
- chrome.tabs.create({
- url: 'index.html'
- });
-});
-chrome.runtime.onInstalled.addListener(function(details) {
- if (details.reason == "install") {
- chrome.tabs.create({
- url: "index.html"
- });
- } else if (details.reason == "update") {
- var thisVersion = chrome.runtime.getManifest().version;
- console.log("Updated from " + details.previousVersion + " to " + thisVersion + " !");
- }
-});
diff --git a/data/chrome/chrome.api.js b/data/chrome/chrome.api.js
deleted file mode 100644
index 94ba27b0d..000000000
--- a/data/chrome/chrome.api.js
+++ /dev/null
@@ -1,428 +0,0 @@
-/* Copyright (c) 2012-2015 The TagSpaces Authors. All rights reserved.
- * Use of this source code is governed by a AGPL3 license that
- * can be found in the LICENSE file. */
-/* global define, nativeIO, isWin */
-
-define(function(require, exports, module) {
- "use strict";
-
- // Activating browser specific exports modul
- console.log("Loading chrome.api.js..");
-
- var TSCORE = require("tscore");
-
- var TSPOSTIO = require("tspostioapi");
- /**
- IO-API
-
- bool createDirectory(std::string path);
- bool saveBlobToFile(std::string path, FB::JSObjectPtr dataArray);
- FB::VariantList getDirEntries(std::string path);
- FB::JSAPIPtr contentsAtPath(std::string path);
- int getFileSize(std::string path);
- bool isDirectory(std::string path);
- bool fileExists(std::string path);
- bool removeRecursively(std::string path);
- void launchFolderSelect(FB::JSObjectPtr callback);
- void launchFileSelect(FB::JSObjectPtr callback);
- void watchDirectory(std::string key, std::string path, FB::JSObjectPtr callback);
- void stopWatching(std::string key);
- std::string getChromeDataDir(std::string version);
-
- bool NPAPIFileIOforChromeAPI::renameFile(std::string oldPath, std::string newPath);
- std::time_t NPAPIFileIOforChromeAPI::getFileLastDateModified(std::string strPath);
- void launchFolder(std::string path); -- not implemented yet
-
- */
-
- var plugin = document.createElement("embed");
- plugin.setAttribute("type", "application/x-npapifileioforchrome");
- plugin.setAttribute("id", "npApiPlugin");
- plugin.style.position = "absolute";
- plugin.style.left = "-9999px";
-
- // Add plugin to document
- document.documentElement.appendChild(plugin);
-
- window.nativeIO = document.getElementById("npApiPlugin");
-
- function scanDirectory(dirPath, index) {
- try {
- var dirList = nativeIO.getDirEntries(dirPath);
- for (var i = 0; i < dirList.length; i++) {
- var path = dirPath + TSCORE.dirSeparator + dirList[i];
- var isDir = nativeIO.isDirectory(path);
- var fileSize = 0;
- var lastDateModified = 0;
- if (!isDir) {
- fileSize = nativeIO.getFileSize(path);
- if (isWin) {
- lastDateModified = new Date(nativeIO.getFileLastDateModified(path) * 1000);
- }
- }
- index.push({
- "name": dirList[i],
- "isFile": !isDir,
- "size": fileSize,
- "lmdt": lastDateModified,
- "path": path
- });
- if (isDir) {
- scanDirectory(path, index);
- }
- }
- return index;
- } catch (ex) {
- console.error("Listing directory failed " + ex);
- }
- }
-
- function generateDirectoryTree(dirPath) {
- try {
- var tree = {};
- tree.name = dirPath.substring(dirPath.lastIndexOf(TSCORE.dirSeparator) + 1, dirPath.length);
- tree.type = false;
- tree.lmdt = 0;
- tree.path = dirPath;
- tree.children = [];
- var dirList = nativeIO.getDirEntries(dirPath);
- for (var i = 0; i < dirList.length; i++) {
- var path = dirPath + TSCORE.dirSeparator + dirList[i];
- var isDir = nativeIO.isDirectory(path);
- var fileSize = 0;
- var lastDateModified = 0;
- if (!isDir) {
- fileSize = nativeIO.getFileSize(path);
- if (isWin) {
- lastDateModified = new Date(nativeIO.getFileLastDateModified(path) * 1000);
- }
- tree.children.push({
- "name": dirList[i],
- "isFile": true,
- "size": fileSize,
- "lmdt": lastDateModified,
- "path": path
- });
- } else {
- tree.children.push(generateDirectoryTree(path));
- }
- }
- return tree;
- } catch (ex) {
- console.error("Scanning directory " + dirPath + " failed " + ex);
- }
- }
-
- var checkNewVersion = function() {
- console.log("Checking for new version...");
- var cVer = TSCORE.Config.DefaultSettings.appVersion + "." + TSCORE.Config.DefaultSettings.appBuild;
- $.ajax({
- url: 'http://tagspaces.org/releases/version.json?cVer=' + cVer,
- type: 'GET'
- })
- .done(function(data) {
- TSPOSTIO.checkNewVersion(data);
- })
- .fail(function(data) {
- console.log("AJAX failed " + data);
- });
- };
-
- var loadTextFile = function(filePath) {
- console.log("Loading file: " + filePath);
- TSCORE.showLoadingAnimation();
- if (nativeIO.fileExists(filePath)) {
- var blob;
- var size = nativeIO.getFileSize(filePath);
- if (size) {
- var byteArray = nativeIO.contentsAtPath(filePath);
- blob = new Int8Array(byteArray);
- } else {
- blob = new Int8Array(0);
- }
- var b = new Blob([blob]);
- b.size = size;
- var reader = new FileReader();
- reader.onload = function(e) {
- TSPOSTIO.loadTextFile(e.target.result);
- };
- reader.readAsText(b);
- } else {
- console.error("File does not exists...");
- }
- };
-
- var listDirectory = function(dirPath) {
- console.log("Listing directory: " + dirPath);
- TSCORE.showLoadingAnimation();
-
- /* chrome.fileSystem.chooseEntry({ type: "openDirectory" }, function(d) {
- if (!d) return;
- var reader = d.createReader();
- reader.readEntries(function(list) {
- console.log("Chrome FS: "+list);
- });
- }); */
-
- if (nativeIO.isDirectory(dirPath)) {
- var dirList = nativeIO.getDirEntries(dirPath);
- var anotatedDirList = [];
- for (var i = 0; i < dirList.length; i++) {
- var path = dirPath + TSCORE.dirSeparator + dirList[i];
- var isDir = nativeIO.isDirectory(path);
- var fileSize = 0;
- var lastDateModified = 0;
- if (!isDir) {
- fileSize = nativeIO.getFileSize(path);
- if (isWin) {
- lastDateModified = new Date(nativeIO.getFileLastDateModified(path) * 1000);
- }
- }
- anotatedDirList.push({
- "name": dirList[i],
- "isFile": !isDir,
- "size": fileSize,
- "lmdt": lastDateModified,
- "path": path
- });
- }
- TSPOSTIO.listDirectory(anotatedDirList);
- } else {
- TSPOSTIO.errorOpeningPath();
- console.log("Directory does not exists.");
- }
- };
-
- var listSubDirectories = function(dirPath) {
- console.log("Listing sub directories: " + dirPath);
- TSCORE.showLoadingAnimation();
- if (nativeIO.isDirectory(dirPath)) {
- var dirList = nativeIO.getDirEntries(dirPath);
- var anotatedDirList = [];
- for (var i = 0; i < dirList.length; i++) {
- var path = dirPath + TSCORE.dirSeparator + dirList[i];
- var isDir = nativeIO.isDirectory(path);
- if (isDir) {
- anotatedDirList.push({
- "name": dirList[i],
- "path": path
- });
- }
- }
- TSPOSTIO.listSubDirectories(anotatedDirList, dirPath);
- } else {
- //TSPOSTIO.errorOpeningPath();
- console.log("Directory does not exists.");
- }
- };
-
- var deleteElement = function(path) {
- console.log("Deleting: " + path);
- TSCORE.showLoadingAnimation();
- try {
- if (!nativeIO.isDirectory(path)) {
- nativeIO.removeRecursively(path);
- }
- TSPOSTIO.deleteElement(path);
- } catch (ex) {
- console.error("Deleting file failed " + ex);
- }
- };
-
- var deleteDirectory = function(dirPath) {
- TSCORE.showAlertDialog("Delete directory functionality not implemented on Chrome yet!");
- return false;
- /* console.log("Deleting: "+path);
- TSCORE.showLoadingAnimation();
- try {
- if(!nativeIO.isDirectory(path)) {
- nativeIO.removeRecursively(path);
- }
- TSPOSTIO.deleteElement(path);
- } catch(ex) {
- console.error("Deleting file failed "+ex);
- } */
- };
-
- var createDirectoryIndex = function(dirPath) {
- console.log("Creating index for directory: " + dirPath);
- TSCORE.showLoadingAnimation();
- var directoryIndex = [];
- directoryIndex = scanDirectory(dirPath, directoryIndex);
- //console.log(JSON.stringify(directoryIndex));
- TSPOSTIO.createDirectoryIndex(directoryIndex);
- };
-
- var createDirectoryTree = function(dirPath) {
- TSCORE.showLoadingAnimation();
- console.log("Creating directory index for: " + dirPath);
- var directoyTree = generateDirectoryTree(dirPath);
- //console.log(JSON.stringify(directoyTree));
- TSPOSTIO.createDirectoryTree(directoyTree);
- };
-
- var saveTextFile = function(filePath, content) {
- TSCORE.showLoadingAnimation();
- console.log("Saving file: " + filePath);
- var byteArray = [];
- var contentUTF8 = unescape(encodeURIComponent(content));
- for (var i = 0; i < contentUTF8.length; ++i) {
- byteArray.push(contentUTF8.charCodeAt(i));
- }
- var blobInt8 = new Int8Array(byteArray);
- var blob = new Blob([blobInt8]);
- var reader = new FileReader();
- reader.onloadend = function() {
- var data = Array.prototype.slice.call(new Uint8Array(reader.result), 0);
- nativeIO.saveBlobToFile(filePath, data);
- TSPOSTIO.saveTextFile(filePath);
- };
- reader.readAsArrayBuffer(blob);
- };
-
- var createDirectory = function(dirPath) {
- console.log("Creating directory: " + dirPath);
- TSCORE.showLoadingAnimation();
- try {
- nativeIO.createDirectory(dirPath);
- TSPOSTIO.createDirectory(dirPath);
- } catch (ex) {
- console.error("Deleting file failed " + ex);
- }
- };
-
- var renameDirectory = function(filePath, newFilePath) {
- TSCORE.showAlertDialog("Renaming directory functionality not implemented on chrome yet!");
- };
-
- var renameFile = function(filePath, newFilePath) {
- console.log("Renaming file: " + filePath + " to " + newFilePath);
- TSCORE.showLoadingAnimation();
- if (filePath.toLowerCase() == newFilePath.toLowerCase()) {
- console.log("Initial and target filenames are the same...");
- return false;
- }
- if (nativeIO.fileExists(newFilePath)) {
- console.log("File renaming failed! Target filename already exists.");
- return false;
- }
- if (isWin) {
- if (nativeIO.renameFile(filePath, newFilePath)) {
- TSPOSTIO.renameFile(filePath, newFilePath);
- } else {
- console.error("File renaming failed!");
- }
- } else {
- if (nativeIO.fileExists(filePath)) {
- var blob;
- var size = nativeIO.getFileSize(filePath);
- // TODO remove the 5MB restriction
- if (size > 5 * 1024 * 1024) {
- TSCORE.showAlertDialog("In Chrome, TagSpaces does not support renaming/tagging of files bigger than 5MB!");
- return;
- }
- if (size) {
- var byteArray = nativeIO.contentsAtPath(filePath);
- blob = new Int8Array(byteArray);
- } else {
- blob = new Int8Array(0);
- }
- var b = new Blob([blob]);
- b.size = size;
- var reader = new FileReader();
- reader.onloadend = function(e) {
- var data = Array.prototype.slice.call(new Uint8Array(reader.result), 0);
- nativeIO.saveBlobToFile(newFilePath, data);
- if (nativeIO.fileExists(newFilePath)) {
- nativeIO.removeRecursively(filePath);
- }
- TSPOSTIO.renameFile(filePath, newFilePath);
- };
- reader.readAsArrayBuffer(b);
- } else {
- console.error("File does not exists...");
- }
- }
- };
-
- var selectDirectory = function() {
- console.log("Select directory!");
- nativeIO.launchFolderSelect(function(dirPath) {
- if (dirPath && dirPath.length) {
- TSPOSTIO.selectDirectory(dirPath);
- }
- });
- };
-
- var selectFile = function() {
- console.log("Select file!");
- nativeIO.launchFileSelect(function(filePath) {
- if (filePath && filePath.length) {
- //$("#folderLocation").val(dirPath);
- }
- });
- };
-
- var checkAccessFileURLAllowed = function() {
- chrome.extension.isAllowedFileSchemeAccess(function(isAllowedAccess) {
- if (!isAllowedAccess) {
- TSCORE.showAlertDialog($.i18n.t("ns.dialogs:accessFileURLNotAllowedAlert"));
- }
- });
- };
-
- var openDirectory = function(dirPath) {
- // TODO implement openDirectory
- console.log("Open directory functionality not implemented in chrome yet!");
- TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openContainingDirectoryAlert"));
- };
-
- var openFile = function(filePath) {
- // TODO implement openFile
- console.log("Open file functionality not implemented in chrome yet!");
- TSCORE.showAlertDialog($.i18n.t("ns.dialogs:openFileNativelyAlert"));
- };
-
- var openExtensionsDirectory = function() {
- // TODO implement openExtensionsDirectory
- console.log("Open extensions directory functionality not implemented in chrome yet!");
- TSCORE.showAlertDialog("Open extensions directory functionality not implemented on chrome yet!");
- };
-
- var getFileProperties = function(filePath) {
- var fileSize = nativeIO.getFileSize(filePath);
- var fileProperties = {};
- if (!nativeIO.isDirectory(filePath)) {
- fileProperties.path = filePath;
- fileProperties.size = fileSize;
- fileProperties.lmdt = 0;
- if (isWin) {
- fileProperties.lmdt = new Date(nativeIO.getFileLastDateModified(filePath) * 1000);
- }
- TSPOSTIO.getFileProperties(fileProperties);
- } else {
- console.log("Error getting file properties. " + filePath + " is directory");
- }
- };
-
- exports.createDirectory = createDirectory;
- exports.renameFile = renameFile;
- exports.renameDirectory = renameDirectory;
- exports.loadTextFile = loadTextFile;
- exports.saveTextFile = saveTextFile;
- exports.listDirectory = listDirectory;
- exports.listSubDirectories = listSubDirectories;
- exports.deleteElement = deleteElement;
- exports.deleteDirectory = deleteDirectory;
- exports.createDirectoryIndex = createDirectoryIndex;
- exports.createDirectoryTree = createDirectoryTree;
- exports.selectDirectory = selectDirectory;
- exports.openDirectory = openDirectory;
- exports.openFile = openFile;
- exports.selectFile = selectFile;
- exports.openExtensionsDirectory = openExtensionsDirectory;
- exports.checkAccessFileURLAllowed = checkAccessFileURLAllowed;
- exports.checkNewVersion = checkNewVersion;
- exports.getFileProperties = getFileProperties;
-
-});
diff --git a/data/chrome/chrome.manifest.tmpl.json b/data/chrome/chrome.manifest.tmpl.json
deleted file mode 100644
index 1326320a7..000000000
--- a/data/chrome/chrome.manifest.tmpl.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "name": "@@APPNAME",
- "version": "@@VERSION.@@BUILD",
- "manifest_version": 2,
- "description": "@@APPDESCRIPTION",
- "icons": {
- "16" : "assets/icon16.png",
- "48" : "assets/icon48.png",
- "64" : "assets/icon64.png",
- "128": "assets/icon128.png"
- },
- "background": {
- "scripts": ["chrome/background.js"]
- },
- "browser_action": {
- "default_icon": "assets/icon19.png",
- "default_title": "Launch @@APPNAME"
- },
- "plugins": [
- {"path": "chrome/NPAPI-chrome-file-api/NPAPIFileIOforChrome.plugin", "public": false},
- {"path": "chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChrome.dll", "public": false},
- {"path": "chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChrome.so", "public": false},
- {"path": "chrome/NPAPI-chrome-file-api/npNPAPIFileIOforChromex64.so", "public": false}
- ],
- "permissions": [
- "<all_urls>",
- "storage"
- ],
- "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
- "homepage_url": "http://tagspaces.org"
-}
\ No newline at end of file