Skip to content

Commit

Permalink
1.99.1
Browse files Browse the repository at this point in the history
  • Loading branch information
giovannicoppola committed May 18, 2022
1 parent 4e43d85 commit 4de44fb
Show file tree
Hide file tree
Showing 28 changed files with 121 additions and 15,591 deletions.
Binary file added releases/ZotHero1-99-1.alfredworkflow
Binary file not shown.
122 changes: 120 additions & 2 deletions src/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@
<key>vitoclose</key>
<true/>
</dict>
<dict>
<key>destinationuid</key>
<string>C75ABE16-D510-4099-BE4B-7BB579DA8435</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>5CFF0FD7-987C-4910-AD1E-0C40BF66585A</key>
<array>
Expand Down Expand Up @@ -1114,6 +1124,103 @@ python3 zh.py attachments $id "$1"</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>0</integer>
<key>script</key>
<string># THESE VARIABLES MUST BE SET. SEE THE ONEUPDATER README FOR AN EXPLANATION OF EACH.
readonly remote_info_plist='https://raw.githubusercontent.com/giovannicoppola/zothero/master/src/info.plist'
readonly workflow_url='https://github.com/giovannicoppola/zothero'
readonly download_type='github_release'
readonly frequency_check='1'
# FROM HERE ON, CODE SHOULD BE LEFT UNTOUCHED!
function abort {
echo "${1}" &gt;&amp;2
exit 1
}
function url_exists {
curl --silent --location --output /dev/null --fail --range 0-0 "${1}"
}
function notification {
local -r notificator="$(find . -type f -name 'notificator')"
if [[ -f "${notificator}" &amp;&amp; "$(/usr/bin/file --brief --mime-type "${notificator}")" == 'text/x-shellscript' ]]; then
"${notificator}" --message "${1}" --title "${alfred_workflow_name}" --subtitle 'A new version is available'
return
fi
osascript -e "display notification \"${1}\" with title \"${alfred_workflow_name}\" subtitle \"A new version is available\""
}
# Local sanity checks
readonly local_info_plist='info.plist'
readonly local_version="$(/usr/libexec/PlistBuddy -c 'print version' "${local_info_plist}")"
[[ -n "${local_version}" ]] || abort 'You need to set a workflow version in the configuration sheet.'
[[ "${download_type}" =~ ^(direct|page|github_release)$ ]] || abort "'download_type' (${download_type}) needs to be one of 'direct', 'page', or 'github_release'."
[[ "${frequency_check}" =~ ^[0-9]+$ ]] || abort "'frequency_check' (${frequency_check}) needs to be a number."
# Check for updates
if [[ $(find "${local_info_plist}" -mtime +"${frequency_check}"d) ]]; then
# Remote sanity check
if ! url_exists "${remote_info_plist}"; then
abort "'remote_info_plist' (${remote_info_plist}) appears to not be reachable."
fi
readonly tmp_file="$(mktemp)"
curl --silent --location --output "${tmp_file}" "${remote_info_plist}"
readonly remote_version="$(/usr/libexec/PlistBuddy -c 'print version' "${tmp_file}")"
rm "${tmp_file}"
if [[ "${local_version}" == "${remote_version}" ]]; then
touch "${local_info_plist}" # Reset timer by touching local file
exit 0
fi
if [[ "${download_type}" == 'page' ]]; then
notification 'Opening download page…'
open "${workflow_url}"
exit 0
fi
readonly download_url="$(
if [[ "${download_type}" == 'github_release' ]]; then
osascript -l JavaScript -e 'function run(argv) { return JSON.parse(argv[0])["assets"].find(asset =&gt; asset["browser_download_url"].endsWith(".alfredworkflow"))["browser_download_url"] }' "$(curl --silent "https://api.github.com/repos/${workflow_url}/releases/latest")"
else
echo "${workflow_url}"
fi
)"
if url_exists "${download_url}"; then
notification 'Downloading and installing…'
readonly download_name="$(basename "${download_url}")"
curl --silent --location --output "${HOME}/Downloads/${download_name}" "${download_url}"
open "${HOME}/Downloads/${download_name}"
else
abort "'workflow_url' (${download_url}) appears to not be reachable."
fi
fi</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>C75ABE16-D510-4099-BE4B-7BB579DA8435</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -2439,6 +2546,17 @@ Edit the `ZOTERO_DIR` variable to point to Zotero 5's data directory if you aren
<key>ypos</key>
<integer>875</integer>
</dict>
<key>C75ABE16-D510-4099-BE4B-7BB579DA8435</key>
<dict>
<key>colorindex</key>
<integer>12</integer>
<key>note</key>
<string>OneUpdater</string>
<key>xpos</key>
<integer>435</integer>
<key>ypos</key>
<integer>475</integer>
</dict>
<key>C93018EF-4629-4261-B997-453D8F2D6856</key>
<dict>
<key>colorindex</key>
Expand Down Expand Up @@ -2544,7 +2662,7 @@ Edit the `ZOTERO_DIR` variable to point to Zotero 5's data directory if you aren
<key>ATTACHMENTS_DIR</key>
<string></string>
<key>CITE_STYLE</key>
<string>http://www.zotero.org/styles/nature</string>
<string>http://www.zotero.org/styles/elsevier-harvard</string>
<key>COPY_CITEKEY_MOD</key>
<string></string>
<key>LOCALE</key>
Expand All @@ -2560,7 +2678,7 @@ Edit the `ZOTERO_DIR` variable to point to Zotero 5's data directory if you aren
<string>COPY_CITEKEY_MOD</string>
</array>
<key>version</key>
<string>1.99</string>
<string>1.99.1</string>
<key>webaddress</key>
<string>https://github.com/deanishe/zothero</string>
</dict>
Expand Down
Binary file modified src/lib/.DS_Store
Binary file not shown.
Binary file removed src/lib/workflow_old/.DS_Store
Binary file not shown.
Binary file removed src/lib/workflow_old/Notify.tgz
Binary file not shown.
109 changes: 0 additions & 109 deletions src/lib/workflow_old/__init__.py

This file was deleted.

Loading

0 comments on commit 4de44fb

Please sign in to comment.