Commit a2faab4b authored by Mihkel Putrinš's avatar Mihkel Putrinš
parents
## Language Resource Uploader for Centre of Estonian Language Resources
### Latest binaries
- [win32](../../raw/master/bin/setup.exe)
- [osx](../../raw/master/bin/Panustaja.dmg)
- [linux32](../../tree/master/bin/linux32.zip)
- [linux64](../../tree/master/bin/linux64.zip)
## 0.1.0 @ 2015-06-07:
[win32](../../raw/d832267aa10a0717a5794f407ea34e8e9178cd7c/bin/setup.exe) |
[osx](../../raw/d832267aa10a0717a5794f407ea34e8e9178cd7c/bin/Panustaja.dmg) |
[linux32](../../raw/d832267aa10a0717a5794f407ea34e8e9178cd7c/bin/linux32.zip) |
[linux64](../../raw/d832267aa10a0717a5794f407ea34e8e9178cd7c/bin/linux64.zip)
### 0.1.0-rc.2 @ 2015-04-20:
[win32](../../raw/9fc969ec11cd71df4e108d74474fe029485394ea/bin/setup.exe) |
[osx](../../raw/9fc969ec11cd71df4e108d74474fe029485394ea/bin/Panustaja.dmg) |
[linux32](../../raw/9fc969ec11cd71df4e108d74474fe029485394ea/bin/linux32.zip) |
[linux64](../../raw/9fc969ec11cd71df4e108d74474fe029485394ea/bin/linux64.zip)
### 0.1.0-rc.1 @ 2015-04-02:
[win32](../../raw/3b9d5f07fd463ae4211383499e6c06e12e496065/bin/setup.exe) |
[osx](../../raw/e999305d98e3a2e3dd8c8a597884cd47d252953c/bin/Panustaja.dmg) |
[linux32](../../raw/e999305d98e3a2e3dd8c8a597884cd47d252953c/bin/linux32.zip) |
[linux64](../../raw/e999305d98e3a2e3dd8c8a597884cd47d252953c/bin/linux64.zip)
### 0.1.0-alpha.5 @ 2015-03-10:
[win32](../../raw/2c3850a28e1997e2c35be95a74a176c2911db4c7/bin/setup.exe) |
[osx](../../raw/2c3850a28e1997e2c35be95a74a176c2911db4c7/bin/LRUploader.dmg) |
[linux32](../../raw/2c3850a28e1997e2c35be95a74a176c2911db4c7/bin/linux32.zip) |
[linux64](../../raw/2c3850a28e1997e2c35be95a74a176c2911db4c7/bin/linux64.zip)
### 0.1.0-alpha.4 @ 2015-03-04:
[win32](../../raw/bf20a69cb2960a76b1f629250e52b1a57c9e27a7/bin/setup.exe) |
[osx](../../raw/bf20a69cb2960a76b1f629250e52b1a57c9e27a7/bin/LRUploader.dmg) |
[linux32](../../raw/bf20a69cb2960a76b1f629250e52b1a57c9e27a7/bin/linux32.zip) |
[linux64](../../raw/bf20a69cb2960a76b1f629250e52b1a57c9e27a7/bin/linux64.zip)
### 0.1.0-alpha.3 @ 2015-02-15:
[win32](../../raw/5a7f3910b9a35fa63bc6a2bd63bd60cf10ead124/bin/setup.exe) |
[osx](../../raw/5a7f3910b9a35fa63bc6a2bd63bd60cf10ead124/bin/LRUploader.dmg)
### 0.1.0-alpha.2 @ 2015-02-15:
[win32](../../raw/e5bba6fdb13e98da80239048cfd22d5a8d9f18f0/bin/setup.exe) |
[osx](../../raw/e5bba6fdb13e98da80239048cfd22d5a8d9f18f0/bin/LRUploader.dmg)
47c47
< <string>node-webkit</string>
---
> <string>Panustaja</string>
51c51
< <string>30.0.1599.66</string>
---
> <string>1.0.0-rc.1</string>
53c53
< <string>1599.66</string>
---
> <string>Release Candidate</string>
var NwBuilder = require('node-webkit-builder')
var nw = new NwBuilder({
files: [
'../node_modules/**',
'../source/**',
'../package.json'
], // use the glob format
// platforms: ['osx64'],
platforms: ['linux'],
buildDir: '../bin',
cacheDir: '../../../nwbuilder/cache',
version: '0.8.6',
macZip: true,
appVersion: true,
macIcns: '../EKRK/uploader/source/images/murakas.icns'
})
//Log stuff you want
nw.on('log', console.log)
// Build returns a promise
nw.build().then(function () {
console.log('all done!')
}).catch(function (error) {
console.error(error)
})
#!/bin/sh
# Make osx32
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )
cd ${DIR}
workingDir="${DIR}/bin/osx32"
applicationName="Panustaja.app"
DMGName="${DIR}/bin/temp.dmg"
finalDMGName="${DIR}/bin/Panustaja.dmg"
sizeOfDmg="200M"
diskTitle="Panustaja installer"
nwAppPath="${workingDir}/${applicationName}"
backgroundPictureName="arrow.png"
rm -rf "${workingDir}" "${finalDMGName}"
mkdir -p "${workingDir}"
cp -r "${DIR}/source" "${workingDir}"
# cp -r "${DIR}/imgs" "${workingDir}"
cp -r "${DIR}/node_modules" "${workingDir}"
cp -r "${DIR}/index.html" "${workingDir}"
cp -r "${DIR}/package.json" "${workingDir}"
cp -r "${DIR}/LICENSE.md" "${workingDir}"
pushd "${workingDir}"
zip -r ../app.nw ./*
rm -r *
popd
cp -r "${DIR}/../../nwbuilder/cache/0.8.6/osx32/node-webkit.app" "${nwAppPath}"
# cp "${DIR}/ffmpegsumo for 0.8.6/ffmpegsumo.so" "${nwAppPath}/Contents/Frameworks/node-webkit Framework.framework/Libraries/"
mv "${DIR}/bin/app.nw" "${nwAppPath}/Contents/resources/"
cp "${DIR}/source/images/murakas.icns" "${nwAppPath}/Contents/resources/nw.icns"
# Replace information in Node-Webkit's Info.plist
patch "${nwAppPath}/Contents/Info.plist" "make/info_plist.patch"
# Create a R/W DMG
hdiutil create -srcfolder "${workingDir}" -volname "${diskTitle}" \
-fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${sizeOfDmg} "${DMGName}"
# Mount the image
device=$(hdiutil attach -readwrite -noverify -noautoopen "${DMGName}" | \
egrep '^/dev/' | sed 1q | awk '{print $1}')
# Prepare for ascript
pushd "/Volumes/${diskTitle}"
mkdir -p .background
cp "${DIR}/make/${backgroundPictureName}" .background
popd
# Run ascript
echo '
tell application "Finder"
tell disk "'${diskTitle}'"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 885, 330}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 72
set background picture of theViewOptions to file ".background:'${backgroundPictureName}'"
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
set position of item "'${applicationName}'" of container window to {100, 100}
set position of item "Applications" of container window to {375, 100}
update without registering applications
delay 5
close
end tell
end tell
' | osascript
chmod -Rf go-w "/Volumes/${diskTitle}"
sync
hdiutil detach ${device}
hdiutil convert "${DMGName}" -format UDZO -imagekey zlib-level=9 -o "${finalDMGName}"
rm -f "${DMGName}"
rm -rf "${workingDir}"
#!/bin/sh
# Make win32
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. && pwd )
cd ${DIR}
diskTitle="Panustaja"
workingDir="${DIR}/bin/${diskTitle}"
rm -rf "${workingDir}"
mkdir -p "${workingDir}"
cp -r "${DIR}/source" "${workingDir}"
cp -r "${DIR}/node_modules" "${workingDir}"
cp -r "${DIR}/package.json" "${workingDir}"
cp -r "${DIR}/LICENSE.md" "${workingDir}"
pushd "${workingDir}"
echo "zip -r ../app.nw ./*"
zip -r ../app.nw ./*
rm -r *
popd
cp "${DIR}/../../nwbuilder/cache/0.12.2/win32/icudtl.dat" "${workingDir}"
cp "${DIR}/../../nwbuilder/cache/0.12.2/win32/libEGL.dll" "${workingDir}"
cp "${DIR}/../../nwbuilder/cache/0.12.2/win32/libGLESv2.dll" "${workingDir}"
cp "${DIR}/../../nwbuilder/cache/0.12.2/win32/nw.exe" "${workingDir}"
cp "${DIR}/../../nwbuilder/cache/0.12.2/win32/nw.pak" "${workingDir}"
echo "cat \"${workingDir}/nw.exe\" \"${DIR}/bin/app.nw\" > \"${workingDir}/Panustaja.exe\""
cat "${workingDir}/nw.exe" "${DIR}/bin/app.nw" > "${workingDir}/Panustaja.exe"
rm -f "${workingDir}/nw.exe" "${DIR}/bin/app.nw"
# pushd "${DIR}/bin"
# zip -r "panustaja_win32".zip "${diskTitle}"/*
# popd
# cat "${DIR}/make/unzipsfx.exe" "${DIR}/bin/panustaja_win32.zip" > "${DIR}/bin/panustaja_setup.exe"
# zip -A "${DIR}/bin/panustaja_setup.exe"
echo '
tell application "Finder"
tell disk "Screenwerk"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {400, 100, 885, 430}
set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 72
set background picture of theViewOptions to file ".background:'${backgroundPictureName}'"
make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
set position of item "'${applicationName}'" of container window to {100, 100}
set position of item "Applications" of container window to {375, 100}
update without registering applications
delay 5
close
end tell
end tell
' | osascript
\ No newline at end of file
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{B2A00D3D-669C-4305-A22C-002D647E5E1A}
AppName=Panustaja
AppVersion=1.0.0
AppVerName=Panustaja 1.0.0
AppPublisher=ekrk
DefaultDirName={pf}\Panustaja
DisableDirPage=yes
DefaultGroupName=Panustaja
DisableProgramGroupPage=yes
OutputDir=Y:\EKRK\uploader\bin
OutputBaseFilename=setup
SetupIconFile=Y:\EKRK\uploader\source\images\murakas.ico
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "Y:\EKRK\uploader\bin\Panustaja\Panustaja.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Y:\EKRK\uploader\bin\Panustaja\icudtl.dat"; DestDir: "{app}"; Flags: ignoreversion
Source: "Y:\EKRK\uploader\bin\Panustaja\nw.pak"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\Panustaja"; Filename: "{app}\Panustaja.exe"
Name: "{group}\{cm:UninstallProgram,Panustaja}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Panustaja"; Filename: "{app}\Panustaja.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Panustaja"; Filename: "{app}\Panustaja.exe"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\Panustaja.exe"; Description: "{cm:LaunchProgram,Panustaja}"; Flags: nowait postinstall skipifsilent
{
"name": "Panustaja",
"description": "Ressursikataloogi upitamiseks keeleressurside Entu repositooriumisse.",
"version": "1.0.0",
"main": "./source/index.html",
"license": "CC-SA",
"private": true,
"repository": {
"type": "git",
"url": "git@gitlab.keeleressursid.ee:indrek-jentson/uploader.git"
},
"dependencies": {
"os-utils": "*",
"jquery": "2.1.3",
"moment": "2.9.0",
"marked": "0.3.3",
"font-awesome": "4.3.0"
},
"window": {
"show_in_taskbar": true,
"icon": "./source/images/murakas.png",
"toolbar": false,
"frame": true,
"show": true,
"position": "center",
"min_width": 1000,
"min_height": 500,
"width": 1100,
"height": 700
},
"platformOverrides": {
"win": {
"window": {
"toolbar": false
}
},
"osx": {
"window": {
"toolbar": false
}
},
"linux": {
"window": {
"toolbar": false
}
}
},
"webkit": {
"plugin": true
},
"chromium-args": "--ignore-gpu-blacklist"
}
var bytesToSize = function bytesToSize(bytes) {
if (bytes === undefined) bytes = 0
var sizes = ['B', 'KB', 'MB', 'GB', 'TB']
if (bytes == 0) return '0 B'
try {
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)))
var decimals = Math.max(0, i-1)
return (bytes / Math.pow(1024, i)).toFixed(decimals) + ' ' + sizes[i]
} catch (exception) {
console.log('Cant convert "' + bytes + '" bytes.')
}
}
module.exports = bytesToSize
{
"__UPLOAD_QUOTA_20G": 21474836480,
"__UPLOAD_QUOTA_100G": 107374182400,
"__MAX_FILESIZE_1G": 1073741824,
"__MAX_FILESIZE_2G": 2147483648,
"__MAX_FILESIZE_4G": 4294967296,
"__CONTACT_EMAIL": "info@keeleressursid.ee",
"__CONTACT_PHONE": "+372 5656 0978",
"__ROOT_EID": 1952,
"__EXCLUDE_FILENAMES": [
".DS_Store",
".dropbox",
".dropbox.cache",
"Icon\r",
"Picasa.ini",
".svn",
".git",
".bin"
]
}
\ No newline at end of file
var gui = window.require('nw.gui')
module.exports.decorate = function decorate() {
var win = gui.Window.get()
var nativeMenuBar = new gui.Menu({ type: "menubar" })
try {
nativeMenuBar.createMacBuiltin(gui.App.manifest.name + ' ' + gui.App.manifest.version, {
// hideEdit: true,
hideWindow: true
})
nativeMenuBar.items[0].label = 'Panustaja'
win.menu = nativeMenuBar
win.menu.items[0].icon = 'source/images/pixel.png'
win.menu.items[0].submenu.items[0].icon = 'source/images/minimura.png'
win.menu.items[0].submenu.items[0].label = 'Panustajast...'
} catch (ex) {
console.log(ex.message)
}
}
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html>
<head>
<title>Keeleressurside Panustaja</title>
<meta charset="UTF-8" />
<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css">
<link href="style.css" rel="stylesheet" />
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.js"></script>
<script src="./script.js" charset="utf-8"></script>
</head>
<body>
<input id="chdir_input" type="file" nwdirectory style="display:none" />
<div>
<table id="cards">
<tr>
<td id="hello_card_label" translate="hello_card" class="card_title current">Hello</td>
<td id="select_card_label" translate="select_card" class="card_title">Select</td>
<td id="upload_card_label" translate="upload_card" class="card_title">Upload</td>
<td id="thankyou_card_label" translate="thankyou_card" class="card_title">Thank You</td>
</tr>
<tr>
<td colspan="4">
<div id="card_contents" style="overflow: auto; height:800px">
<card id="hello_card">
<div translate="hello_text" class="infotext"></div>
<button id="login_button" translate="login_button">.</button>
</card>
<card id="select_card">
<div translate="select_text" class="infotext"></div>
<button id="chdir_button">.</button>
</card>
<card id="upload_card">
<div translate="upload_text" class="infotext"></div>
<div id="upload_stats"></div>
<label translate="resource_name">resource_name</label>
<input id="resource_name" />
<div id="overquota_total" translate="overquota_total" class="warning">
</div>
<div id="overquota_files" class="warning">
</div>
<button id="back_button" style="display:inline;" translate="back_button">.</button>
<button id="upload_button" style="display:inline;" translate="upload_button">.</button>
<div id="local_fs_tree"></div>
</card>
<card id="thankyou_card">
<div translate="thankyou_text" class="infotext">
</div>
</card>
<div id="uploaded_resource_list" style="display:none" translate="uploaded_resource_list"></div>
</div>
</td>
</tr>
</table>
<div id="waitspinner"></div>
<div id="upload_progress">
<div id="upload_back" progress></div>
<div id="upload_front" progress></div>
</div>
</div>
</body>
</html>
\ No newline at end of file
// 1. core modules
var util = require('util')
var fs = require('fs')
var path = require('path')
var gui = global.window.nwDispatcher.requireNwGui()
// 2. public modules from npm
var moment = require('moment')
// 3. Own modules
var bytesToSize = require('./bytesToSize.js')
var msToTime = require('./msToTime.js')
var progress = require('./progress.js')
var configuration = require('./configuration.json')
var translate = require('./translations/estonian.js')
var loadDirs = function loadDirs() {
var my_nodes = {}
var root_node = {}
var rec_counter = 1
var files_total = 0
var dirs_total = 0
var bytes_total = 0
var overquota_total = 0
var overquota_files_total = 0
var decreaseCounter = function decreaseCounter(finalCallback) {
if (rec_counter === 1) {
finalCallback()
} else {
rec_counter --
}
}
// Decrease this, if statusline doesnot refresh often enough
var load_factor = 4.1
var ticker = Math.round((new Date()).getTime() / 1000)
var nodes_per_sec = 0
var loadRec = function(parent_node, full_path, finalCallback) {
if (ticker === Math.round((new Date()).getTime() / 1000)) {
nodes_per_sec ++
} else {
// console.log(ticker + ':' + nodes_per_sec + ' nodes. Active threads: ' + rec_counter)
$('[progress]').text(nodes_per_sec + '/sec;' + displayNodePath(path.dirname(full_path), path.basename(full_path)))
ticker = Math.round((new Date()).getTime() / 1000)
nodes_per_sec = 0
}
var wait_ms = Math.round(rec_counter/load_factor)
setTimeout(function() {
fs.stat(full_path, function(err, stats) {
if(stats === undefined) {
decreaseCounter(finalCallback)
return
}
// console.log('Loading', full_path, finalCallback)
if (my_nodes[stats.ino] !== undefined) {
decreaseCounter(finalCallback)
return
}
var new_node = my_nodes[stats.ino] = {
ino: stats.ino,
full_path: full_path,
dirname: path.dirname(full_path),
basename: path.basename(full_path),
entuname: path.basename(full_path),
size: stats.isDirectory() ? 0 : stats.size,
overquota: (stats.size > configuration.__MAX_FILESIZE_2G ? true : false),
parent: parent_node,
is_dir: stats.isDirectory(),
file_count: 0,
dir_count: 0,
nodes: {}
}
if (parent_node === null) {
root_node = new_node
}
if (parent_node !== null) {
parent_node.nodes[stats.ino] = new_node
}
// console.log('New node ', Object.keys(my_nodes).length, JSON.stringify({count:rec_counter, path:full_path}))
if (stats.isDirectory()) {
if (parent_node !== null) {
parent_node.dir_count ++
}
dirs_total ++
fs.readdir(full_path, function(err, files) {
if (files !== undefined) {
files.forEach(function(childname) {
if (configuration.__EXCLUDE_FILENAMES.indexOf(childname) === -1) {
rec_counter ++
loadRec(my_nodes[stats.ino], path.join(full_path, childname), finalCallback)
}
})
}
decreaseCounter(finalCallback)
})
} else if (stats.isFile()) {
if (parent_node !== null) {
parent_node.file_count ++
}
files_total ++
bytes_total += stats.size
decreaseCounter(finalCallback)
} else {
decreaseCounter(finalCallback)
}
})
}, wait_ms)
}
var displayNodePath = function displayNodePath(dirname_in, basename_in) {
var dirname = dirname_in
var basename = basename_in
var max_length = 40
var node_path = path.resolve(dirname, basename)
var diff = node_path.length - max_length
var half_len = Math.round(max_length / 2)
// console.log(node_path, node_path.length, diff)
if (diff > 0) {
diff += 1
var basename_intact = false
var basename_diff = basename.length - half_len
if (basename_diff > 0) {
var crop_size = Math.min(diff, basename_diff)
basename = basename.slice(crop_size)
diff = diff - crop_size
} else {
basename_intact = true
}
var dirname_diff = dirname.length - half_len + 1
if (dirname_diff > 0) {
var crop_size = Math.min(diff, dirname_diff)
dirname = dirname.slice(0, dirname.length - crop_size)
}
var ret_value = dirname + '' + basename
if (basename_intact)
ret_value = path.resolve(dirname + '', basename)
if (ret_value === undefined)
// console.log(dirname, basename, dirname_in, basename_in)
$('[progress]').text(ret_value)
return ret_value
}
}
return {
bytes_total: function () {
return bytes_total
},
root_node: function () {
return root_node
},
nodes: function () {
return my_nodes
},
load: function (full_path, finalCallback) {
// console.log(my_nodes, 'Loading', full_path)
loadRec(null, full_path, finalCallback)
},
reset: function () {
my_nodes = {}
rec_counter = 1
output_counter = 0
files_total = 0
dirs_total = 0
bytes_total = 0
overquota_total = 0
overquota_files_total = 0
// console.log(my_nodes, 'Resetting')
$('#upload_stats').empty()
$('#overquota_total').empty()
$('#overquota_files').empty()
$('[progress]').text('...')
},
displayNodes: function (ms_so_far) {
var now_ms = (new Date()).getTime()
if (files_total + dirs_total !== Object.keys(my_nodes).length) {
// console.log('Warning: ' + files_total + ' + ' + dirs_total + ' !== ' + Object.keys(my_nodes).length + '!')
}
$('#upload_stats')
.append($('<div>')
.append('<label>' + translate('dirs_total') + '</label>')
.append('<span id="dirs_total">' + dirs_total + '</span>')
)
.append($('<div>')
.append('<label>' + translate('files_total') + '</label>')
.append('<span id="files_total">' + files_total + '</span>')
)
.append($('<div>')
.append('<label>' + translate('bytes_total') + '</label>')
.append('<span id=bytes_total>' + bytesToSize(bytes_total) + '</span>')
)