s3-files.js 743 B

12345678910111213141516171819202122232425
  1. hexo.extend.helper.register('get_s3_link', function(link, project){
  2. if(project.files == undefined) return link.url;
  3. for (let i = 0; i < project.files.length; i++) {
  4. const file = project.files[i];
  5. if(file.title == link.file){
  6. if(file.s3 != undefined){
  7. return file.s3.url;
  8. }
  9. }
  10. }
  11. return link.url;
  12. });
  13. hexo.extend.helper.register('has_s3_link', function(link, project){
  14. if(project.files == undefined) return false;
  15. for (let i = 0; i < project.files.length; i++) {
  16. const file = project.files[i];
  17. if(file.title == link.file){
  18. if(file.s3 != undefined){
  19. return true;
  20. }
  21. }
  22. }
  23. return false;
  24. });