Skip to content

Commit

Permalink
Merge pull request #390 from alanhg/fix/temp
Browse files Browse the repository at this point in the history
fix: path escape conflict
  • Loading branch information
alanhe421 authored Aug 12, 2023
2 parents 5323e82 + 92c0ed0 commit fc8e75b
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 49 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
package-lock.json
yarn.lock
.DS_Store
prefs.plist
223 changes: 177 additions & 46 deletions pic-uploader/src/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>1</integer>
<integer>0</integer>
<key>script</key>
<string>[[ -d "${alfred_workflow_cache}" ]] || mkdir "${alfred_workflow_cache}"
Expand All @@ -416,8 +416,10 @@ extension="${query##*.}"
filename="$d.$extension"
cp "$query" "$alfred_workflow_cache/$filename"
echo -n $filename</string>
<key>scriptargtype</key>
<integer>0</integer>
Expand Down Expand Up @@ -629,9 +631,9 @@ echo -n $filename</string>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<integer>103</integer>
<key>script</key>
<string>/usr/local/bin/node ./compress-image.js {query}</string>
<string>/usr/local/bin/node ./compress-image.js '{query}'</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -1048,23 +1050,14 @@ brew install pngpaste
2. setting tinypng_api_key
3. ensure visit https://tinypng.com is ok
## VPS uploader setting
configure the alfred environment variable
- user
- password
- destination
### connection test
`ssh -p 22 ${process.env.vps_user}@${process.env.vps_server}`
## Imgur Uploader setting
1. https://api.imgur.com/oauth2/addclient
get clientId
2. configure the alfred environment variable
https://apidocs.imgur.com/</string>
<key>uidata</key>
Expand Down Expand Up @@ -1142,7 +1135,7 @@ https://apidocs.imgur.com/</string>
<key>xpos</key>
<real>440</real>
<key>ypos</key>
<real>225</real>
<real>220</real>
</dict>
<key>6EBCE7DB-D4DA-4B3D-A22D-940B6583971A</key>
<dict>
Expand Down Expand Up @@ -1275,42 +1268,180 @@ https://apidocs.imgur.com/</string>
</dict>
</dict>
<key>userconfigurationconfig</key>
<array/>
<key>variables</key>
<dict>
<key>destination</key>
<string></string>
<key>imgur_client_id</key>
<string></string>
<key>imgur_client_secret</key>
<string></string>
<key>imgur_refresh_token</key>
<string></string>
<key>tinypng_api_key</key>
<string></string>
<key>vps_destination</key>
<string></string>
<key>vps_server</key>
<string></string>
<key>vps_url</key>
<string></string>
<key>vps_user</key>
<string></string>
</dict>
<key>variablesdontexport</key>
<array>
<string>imgur_client_id</string>
<string>destination</string>
<string>vps_destination</string>
<string>vps_url</string>
<string>vps_user</string>
<string>vps_server</string>
<string>imgur_client_secret</string>
<string>tinypng_api_key</string>
<string>imgur_refresh_token</string>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>placeholder</key>
<string></string>
<key>required</key>
<true/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>VPS Server</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>vps_server</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>placeholder</key>
<string></string>
<key>required</key>
<true/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>VPS User</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>vps_user</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>placeholder</key>
<string></string>
<key>required</key>
<true/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>VPS URL</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>vps_url</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>placeholder</key>
<string></string>
<key>required</key>
<true/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>VPS Destination</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>vps_destination</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>placeholder</key>
<string></string>
<key>required</key>
<false/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>Imgur Client Id</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>imgur_client_id</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>placeholder</key>
<string></string>
<key>required</key>
<false/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>Imgur Client Secret</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>imgur_client_secret</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>placeholder</key>
<string></string>
<key>required</key>
<false/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string></string>
<key>label</key>
<string>Imgur Refresh Token</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>imgur_refresh_token</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>default</key>
<string></string>
<key>placeholder</key>
<string></string>
<key>required</key>
<false/>
<key>trim</key>
<true/>
</dict>
<key>description</key>
<string>compress image</string>
<key>label</key>
<string>TinyPNG API Key</string>
<key>type</key>
<string>textfield</string>
<key>variable</key>
<string>tinypng_api_key</string>
</dict>
</array>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>2.7</string>
<string>2.8</string>
<key>webaddress</key>
<string>https://github.com/alanhg/alfred-workflows/tree/master/pic-uploader</string>
</dict>
Expand Down
4 changes: 1 addition & 3 deletions pic-uploader/src/upload-vps.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ const { execSync } = require('child_process');
`ssh -p 22 ${process.env.vps_user}@${process.env.vps_server} "mkdir -p ${process.env.vps_destination}/${year}"`
);
execSync(
`scp ${utils.escapeFilePath(
process.env.alfred_workflow_cache
)}/${query} ${process.env.vps_user}@${process.env.vps_server}:${
`scp "${process.env.alfred_workflow_cache}/${query}" ${process.env.vps_user}@${process.env.vps_server}:${
process.env.vps_destination
}/${year}/`
);
Expand Down

0 comments on commit fc8e75b

Please sign in to comment.