Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@新不太灵@eyJmaXJzdEhlYWRlciI6ImNsYXNzIiwibGFzdF9jaGFwdGVyX3J1bGUiOiIiLCJ0aXRsZSI6IuaWsOS4jeWkqueBtSIsImF1dGhvciI6InpldGFscGhhIiwidXJsIjoiaGlrZXI6Ly9lbXB0eSMjZnlwYWdlIiwidmVyc2lvbiI6MCwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxuJC5yZXF1aXJlKFwiaGlrZXI6Ly9wYWdlL21haW5cIikiLCJzZWFyY2hfdXJsIjoiaGlrZXI6Ly9lbXB0eT9rZXk9KiomcGFnZT1meXBhZ2UiLCJncm91cCI6IkDnj43ol48iLCJzZWFyY2hGaW5kIjoianM6XG52YXIgZCA9IFtdO1xubGV0IGtleSA9IGdldFBhcmFtKCdrZXknKTtcbmNvbnN0IHBhZ2UgPSBNWV9QQUdFO1xuZC5wdXNoKHtcbiAgICB0aXRsZTogXCLngrnmiJHlvIDlp4vmkJzntKJcIiArIGtleSxcbiAgICB1cmw6ICQoXCIjbm9Mb2FkaW5nI1wiKS5sYXp5UnVsZSgoa2V5KSA9PiB7XG4gICAgICAgIHB1dE15VmFyKFwidGVtcF9rZXl3b3JkXCIsIGtleSk7XG4gICAgICAgIHJldHVybiBcImhpa2VyOi8vcGFnZS9tYWluP2Z5cGFnZVwiO1xuICAgIH0sIGtleSksXG4gICAgZXh0cmE6IHtcbiAgICAgICAgcGFnZVRpdGxlOiBcIuaQnOe0ojpcIiArIGtleSxcbiAgICAgICAgbmF2O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0oTVlfUlVMRS5ncm91cCwgXFxcIjBcXFwiKTtcXG4gICAgICAgICAgICBzZXRJdGVtKE1ZX1JVTEUuZ3JvdXAsIGZvbGQgPT09IFxcXCIxXFxcIiA/IFxcXCIwXFxcIiA6IFxcXCIxXFxcIik7XFxuICAgICAgICAgICAgcmVmcmVzaFBhZ2UoKTtcXG4gICAgICAgICAgICByZXR1cm4gXFxcImhpa2VyOi8vZW1wdHlcXFwiO1xcbiAgICAgICAgfSksXFxuICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLph43nva5cXFwiLFxcbiAgICAgICAgICAgICAgICBqczogJC50b1N0cmluZygoKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJrZXl3b3JkXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJjYXRlb2JqXFxcIik7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIH1dXFxuICAgICAgICB9XFxuICAgIH0pXFxuICAgIGhlYWQuZm9yRWFjaCgoeCwgaSkgPT4ge1xcbiAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICB0aXRsZTogJ+KAnOKAnOKAneKAnScgKyAoaGkgPT0gaSA/IG1lLmJhY2tDb2xvcih4LnRpdGxlLCB7IGJjOiBcXFwiI0ZGNjY5OVxcXCIgfSkgOiB4LnRpdGxlKSxcXG4gICAgICAgICAgICBjb2xfdHlwZTogXFxcInNjcm9sbF9idXR0b25cXFwiLFxcbiAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaSkgPT4ge1xcbiAgICAgICAgICAgICAgICBwdXRNeVZhcihcXFwiaGlcXFwiLCBpKTtcXG4gICAgICAgICAgICAgICAgY2xlYXJNeVZhc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IwXFxcIixcXG4gICAgICAgICAgICB2OiB4ICE9IFxcXCJzZ1xcXCIgPyBcXFwiXFxcIiA6IFxcXCIwXFxcIixcXG4gICAgICAgIH1cXG4gICAgfSlcXG59XFxuXFxuaWYgKGZvbGQgPT0gXFxcIjBcXFwiICYmIHBhZ2UgPT0gMSAmJiBuYXYgJiYgIS9ob21lfG5ldy8udGVzdChzYSkpIHtcXG4gICAgdGtleXMuZm9yRWFjaCgodGFnLCBpbmRleCkgPT4ge1xcbiAgICAgICAgaWYgKHRhZyAhPSBcXFwic2dcXFwiKSB7XFxuICAgICAgICAgICAgdGFnc1t0YWddLnVuc2hpZnQoe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuS4jemZkFxcXCIsXFxuICAgICAgICAgICAgICAgIGlkOiBcXFwiXFxcIlxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfVxcbiAgICAgICAgdGFnc1t0YWddLmZvckVhY2goZnVuY3Rpb24gKGl0ZW0sIGkpIHtcXG4gICAgICAgICAgICAvL2xvZyhpdGVtKVxcbiAgICAgICAgICAgIGlmICh0YWcgIT0gXFxcInNnXFxcIikge1xcbiAgICAgICAgICAgICAgICBpdGVtLmlkID0gaXRlbS50aXRsZTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgaWYgKGl0ZW0udGl0bGUgPT0gXFxcIuS4jemZkFxcXCIpIHtcXG4gICAgICAgICAgICAgICAgaXRlbS5pZCA9IFxcXCJcXFwiO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBsZXQgY29sb3IgPSAnI0ZGNjY5OSc7XFxuICAgICAgICAgICAgaWYgKHRhZyBpbiBjb2xvcnMpIHtcXG4gICAgICAgICAgICAgICAgY29sb3IgPSBjb2xvcnNbdGFnXTtcXG4gICAgICAgICAgICB9XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLigJzigJzigJ3igJ1cXFwiICsgKGNhdGVvYmpbdGFnXS5pID09IGkgPyBtZS5iYWNrQ29sb3IoaXRlbS50aXRsZSwgeyBiYzogY29sb3IgfSkgOiBpdGVtLnRpdGxlKSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJyxcXG4gICAgICAgICAgICAgICAgdXJsOiAkKGl0ZW0uaWQgKyAnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoY2F0ZW9iaiwgdGFnLCBpbmRleCwgaSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgY2F0ZW9ialt0YWddID0ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIGk6IGksXFxuICAgICAgICAgICAgICAgICAgICAgICAgdjogaW5wdXRcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIHN0b3JhZ2UwLnB1dE15VmFyKFxcXCJjYXRlb2JqXFxcIiwgY2F0ZW9iaik7XFxuICAgICAgICAgICAgICAgICAgICByZWZyZXNoUGFnZShmYWxzZSk7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gJ2hpa2VyOi8vZW1wdHknXFxuICAgICAgICAgICAgICAgIH0sIGNhdGVvYmosIHRhZywgaW5kZXgsIGkpLFxcbiAgICAgICAgICAgIH0pO1xcbiAgICAgICAgfSk7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIGNvbF90eXBlOiAnYmxhbmtfYmxvY2snXFxuICAgICAgICB9KTtcXG4gICAgfSlcXG59XFxubGV0IHRpdGxlcyA9IFtcXFwi55S15b2xOjFcXFwiLCBcXFwi55S16KeG5YmnOjJcXFwiLCBcXFwi6L+R5pyf54Ot6ZeoOjNcXFwiLCBcXFwi5pys5ZGo54Ot6ZeoOjRcXFwiLCBcXFwi5pys5pyI54Ot6ZeoOjVcXFwiXVxcblxcbmxldCBzYyA9IGdldE15VmFyKFxcXCJob21lQHNjXFxcIiwgXFxcIjFcXFwiKTtcXG5pZiAoL2hvbWV8bmV3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CB8fCBpdGVtLmVxeGQgfHwgaXRlbS5jb250YSxcXG4gICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICB1cmw6IHVybCxcXG4gICAgICAgICAgICBjb2xfdHlwZTogc2EgIT0gXFxcIm5ld1xcXCIgPyBcXFwibW92aWVfM19tYXJxdWVlXFxcIiA6IFxcXCJtb3ZpZV8xX3ZlcnRpY2FsX3BpY1xcXCIsXFxuICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgcGFnZVRpdGxlOiBpdGVtLnRpdGxlLFxcbiAgICAgICAgICAgICAgICBpZDogaWQsXFxuICAgICAgICAgICAgICAgIGltZzogaW1nXFxuICAgICAgICAgICAgfVxcbiAgICAgICAgfSlcXG4gICAgICAgIGlmIChzYSA9PSBcXFwibmV3XFxcIikge1xcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBtZS5mb250c3R5bGUobWUuYmFja0NvbG9yKFxcXCLno4Hlipvpk77mjqVcXFwiLCB7IGJjOiBcXFwiI0M0OWY0N1xcXCIgfSksIHsgdGFnczogXFxcInNtYWxsXFxcIiB9KSxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IFxcXCJ0ZXh0XzNcXFwiLFxcbiAgICAgICAgICAgICAgICB1cmw6IGl0ZW0uemxpbmssXFxuICAgICAgICAgICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgICAgICAgICBsb25nQ2xpY2s6IFt7XFxuICAgICAgICAgICAgICAgICAgICAgICAgdGl0bGU6IFxcXCLlpI3liLbno4Hpk75cXFwiLFxcbiAgICAgICAgICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvcHkoaXRlbS56bGluaylcXG4gICAgICAgICAgICAgICAgICAgICAgICB9LCBpdGVtKSxcXG4gICAgICAgICAgICAgICAgICAgIH0sIHtcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWFtuWug+W6lOeUqOaJk+W8gFxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6IEpTT04uc3RyaW5naWZ5KFxcXCJtYWduZXQ6Ly9cXFwiICsgaXRlbS56bGluayksXFxuICAgICAgICAgICAgICAgICAgICB9XFxuICAgICAgICAgICAgICAgICAgICBdLFxcbiAgICAgICAgICAgICAgICAgICAgbGluZVZpc2libGU6IGZhbHNlXFxuICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBtZS5mb250c3R5bGUobWUuYmFja0NvbG9yKGl0ZW0uenNpemUsIHsgYmM6IFxcXCIjOEU0NEFEXFxcIiB9KSwgeyB0YWdzOiBcXFwic21hbGxcXFwiIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogXFxcImhpa2VyOi8vZW1wdHlcXFwiLFxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IG1lLmZvbnRzdHlsZShtZS5iYWNrQ29sb3IoXFxcIuS4i+i9veenjeWtkFxcXCIsIHsgYmM6IFxcXCIjMzU5OERDXFxcIiB9KSwgeyB0YWdzOiBcXFwic21hbGxcXFwiIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogJChcXFwiI25vTG9hZGluZyNcXFwiKS5sYXp5UnVsZSgoaXRlbSkgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGFwaS5ob3N0ICsgaXRlbS5kb3duXFxuICAgICAgICAgICAgICAgIH0sIGl0ZW0pXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgIH1cXG4gICAgfSlcXG59XFxuXFxuXFxuc2V0UmVzdWx0KGQpXCJ9XSIsImljb24iOiJodHRwczovL2FwaS54aW5hYy5uZXQvaWNvbi8/dXJsPWh0dHA6Ly93d3cuMmJ0MC5jb20vIiwicHJveHkiOiIifQ==
Add Comment
Please, Sign In to add comment