Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello, my custom script is almost finished, but I don't know how to pass it to typora #1

Open
ghost opened this issue Jul 16, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 16, 2020

#!/bin/bash

# Various configuration information
# look here,remote_path base_url push_path The last side does not have parameters \
remote_path="temp" # Upload default path
base_url="https://cdn.jsdelivr.net/gh/zygds/cdn@master/img" # Custom domain name
push_path="D:\Github\cdn\img"

# Upload pictures
for i in "$@"; do
	current=`date "+%Y-%m-%d %H:%M:%S"`  
	timeStamp=`date -d "$current" +%s`   
	currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000)) 
	# echo $currentTimeStamp
	# print time
	new_name=$currentTimeStamp.${i##*.}
	# echo $new_name
	# print file.path
	push_paths=$push_path'\'$remote_path'\'$currentTimeStamp.${i##*.}

	# echo $push_paths
	# copy old file to new file
    cp $i $push_paths
    # copy file
done
# TODO Here, I have completed the task of copy, paste and rename. How to pass it to typeora? You can modify it at will
# Output results
echo "Upload Success:"
for file in "$@"; do
    IFS='/' read -r -a array <<< "$file"
    id="${#array[@]}"
    echo "$base_url"'/'"$remote_path"'/'"$new_name"
done
@abnerlee
Copy link
Contributor

Hi, you can check http://support.typora.io/Upload-Image/#custom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant