Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@新不太灵@eyJmaXJzdEhlYWRlciI6ImNsYXNzIiwibGFzdF9jaGFwdGVyX3J1bGUiOiIiLCJ0aXRsZSI6IuaWsOS4jeWkqueBtSIsImF1dGhvciI6InpldGFscGhhIiwidXJsIjoiaGlrZXI6Ly9lbXB0eSMjZnlwYWdlIiwidmVyc2lvbiI6MCwiY29sX3R5cGUiOiJtb3ZpZV8zIiwiY2xhc3NfbmFtZSI6IiIsInR5cGUiOiJ2aWRlbyIsImNsYXNzX3VybCI6IiIsImFyZWFfbmFtZSI6IiIsImFyZWFfdXJsIjoiIiwic29ydF9uYW1lIjoiIiwieWVhcl9uYW1lIjoiIiwic29ydF91cmwiOiIiLCJ5ZWFyX3VybCI6IiIsImZpbmRfcnVsZSI6ImpzOlxuJC5yZXF1aXJlKFwiaGlrZXI6Ly9wYWdlL21haW5cIikiLCJzZWFyY2hfdXJsIjoiaGlrZXI6Ly9lbXB0eT9rZXk9KiomcGFnZT1meXBhZ2UiLCJncm91cCI6IuKRoOe9keebmCIsInNlYXJjaEZpbmQiOiJqczpcbnZhciBkID0gW107XG5sZXQga2V5ID0gZ2V0UGFyYW0oJ2tleScpO1xuY29uc3QgcGFnZSA9IE1ZX1BBR0U7XG5kLnB1c2goe1xuICAgIHRpdGxlOiBcIueCueaIkeW8gOWni+aQnOe0olwiICsga2V5LFxuICAgIHVybDogJChcIiNub0xvYWRpbmcjXCIpLmxhenlSdWxlKChrZXkpID0+IHtcbiAgICAgICAgcHV0TXlWYXIoXCJ0ZW1wX2tleXdvcmRcIiwga2V5KTtcbiAgICAgICAgcmV0dXJuIFwiaGlrZXI6Ly9wYWdlL21haW4/ZnlwYWdlXCI7XG4gICAgfSwga2V5KSxcbiAgICBleHRyYToge1xuICAgICAgICBwYWdlVGl0bGU6IFwi5pCc57SiOlwiICsga2V5LFxuICAgICAgICBuYXY6ZmFsc2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cXG4gICAgICAgICAgICByZWZyZXNoUGFnZSgpO1xcbiAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxuICAgICAgICB9KSxcXG4gICAgICAgIGV4dHJhOiB7XFxuICAgICAgICAgICAgbG9uZ0NsaWNrOiBbe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIumHjee9rlxcXCIsXFxuICAgICAgICAgICAgICAgIGpzOiAkLnRvU3RyaW5nKCgpID0+IHtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcImtleXdvcmRcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIGNsZWFyTXlWYXIoXFxcImNhdGVvYmpcXFwiKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgfV1cXG4gICAgICAgIH1cXG4gICAgfSlcXG4gICAgaGVhZC5mb3JFYWNoKCh4LCBpKSA9PiB7XFxuICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgIHRpdGxlOiAn4oCc4oCc4oCd4oCdJyArIChoaSA9PSBpID8gbWUuYmFja0NvbG9yKHgudGl0bGUsIHsgYmM6IFxcXCIjRkY2Njk5XFxcIiB9KSA6IHgudGl0bGUpLFxcbiAgICAgICAgICAgIGNvbF90eXBlOiBcXFwic2Nyb2xsX2J1dHRvblxcXCIsXFxuICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChpKSA9PiB7XFxuICAgICAgICAgICAgICAgIHB1dE15VmFyKFxcXCJoaVxcXCIsIGkpO1xcbiAgICAgICAgICAgICAgICBjbGVhck15VmFyKFxcXCJrZXl3b3JkXFxcIik7XFxuICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKCk7XFxuICAgICAgICAgICAgICAgIHJldHVybiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCI7XFxu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sZCA9PSBcXFwiMFxcXCIgJiYgcGFnZSA9PSAxICYmIG5hdiAmJiAhL2hvbWV8bmV3Ly50ZXN0KHNhKSkge1xcbiAgICB0a2V5cy5mb3JFYWNoKCh0YWcsIGluZGV4KSA9PiB7XFxuICAgICAgICBpZiAodGFnICE9IFxcXCJzZ1xcXCIpIHtcXG4gICAgICAgICAgICB0YWdzW3RhZ10udW5zaGlmdCh7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5LiN6ZmQXFxcIixcXG4gICAgICAgICAgICAgICAgaWQ6IFxcXCJcXFwiXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9XFxuICAgICAgICB0YWdzW3RhZ10uZm9yRWFjaChmdW5jdGlvbiAoaXRlbSwgaSkge1xcbiAgICAgICAgICAgIC8vbG9nKGl0ZW0pXFxuICAgICAgICAgICAgaWYgKHRhZyAhPSBcXFwic2dcXFwiKSB7XFxuICAgICAgICAgICAgICAgIGl0ZW0uaWQgPSBpdGVtLnRpdGxlO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBpZiAoaXRlbS50aXRsZSA9PSBcXFwi5LiN6ZmQXFxcIikge1xcbiAgICAgICAgICAgICAgICBpdGVtLmlkID0gXFxcIlxcXCI7XFxuICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIGxldCBjb2xvciA9ICcjRkY2Njk5JztcXG4gICAgICAgICAgICBpZiAodGFnIGluIGNvbG9ycykge1xcbiAgICAgICAgICAgICAgICBjb2xvciA9IGNvbG9yc1t0YWddO1xcbiAgICAgICAgICAgIH1cXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuKAnOKAnOKAneKAnVxcXCIgKyAoY2F0ZW9ialt0YWddLmkgPT0gaSA/IG1lLmJhY2tDb2xvcihpdGVtLnRpdGxlLCB7IGJjOiBjb2xvciB9KSA6IGl0ZW0udGl0bGUpLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogJ3Njcm9sbF9idXR0b24nLFxcbiAgICAgICAgICAgICAgICB1cmw6ICQoaXRlbS5pZCArICcjbm9Mb2FkaW5nIycpLmxhenlSdWxlKChjYXRlb2JqLCB0YWcsIGluZGV4LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICBjYXRlb2JqW3RhZ10gPSB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgaTogaSxcXG4gICAgICAgICAgICAgICAgICAgICAgICB2OiBpbnB1dFxcbiAgICAgICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgICAgICAgICAgc3RvcmFnZTAucHV0TXlWYXIoXFxcImNhdGVvYmpcXFwiLCBjYXRlb2JqKTtcXG4gICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKTtcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6Ly9lbXB0eSdcXG4gICAgICAgICAgICAgICAgfSwgY2F0ZW9iaiwgdGFnLCBpbmRleCwgaSksXFxuICAgICAgICAgICAgfSk7XFxuICAgICAgICB9KTtcXG4gICAgICAgIGQucHVzaCh7XFxuICAgICAgICAgICAgY29sX3R5cGU6ICdibGFua19ibG9jaydcXG4gICAgICAgIH0pO1xcbiAgICB9KVxcbn1cXG5sZXQgdGl0bGVzID0gW1xcXCLnlLXlvbE6MVxcXCIsIFxcXCLnlLXop4bliac6MlxcXCIsIFxcXCLov5HmnJ/ng63pl6g6M1xcXCIsIFxcXCLmnKzlkajng63pl6g6NFxcXCIsIFxcXCLmnKzmnIjng63pl6g6NVxcXCJdXFxuXFxubGV0IHNjID0gZ2V0TXlWYXIoXFxcImhvbWVAc2NcXFwiLCBcXFwiMVxcXCIpO1xcbmlmICgvaG9tZXxuZXcvLnRlc3Qoc2EpICYmIG5hdiAmJiBwYWdlID09IDEpIHtcXG4gICAgdGl0bGVzLmZvckVhY2goeCA9PiB7XFxuICAgICAgICBsZXQgW2ssIHZdID0geC5zcGxpdChcXFwiOlxcXCIpO1xcb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IixcXG4gICAgICAgICAgICBleHRyYToge1xcbiAgICAgICAgICAgICAgICBwYWdlVGl0bGU6IGl0ZW0udGl0bGUsXFxuICAgICAgICAgICAgICAgIGlkOiBpZCxcXG4gICAgICAgICAgICAgICAgaW1nOiBpbWdcXG4gICAgICAgICAgICB9XFxuICAgICAgICB9KVxcbiAgICAgICAgaWYgKHNhID09IFxcXCJuZXdcXFwiKSB7XFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IG1lLmZvbnRzdHlsZShtZS5iYWNrQ29sb3IoXFxcIuejgeWKm+mTvuaOpVxcXCIsIHsgYmM6IFxcXCIjQzQ5ZjQ3XFxcIiB9KSwgeyB0YWdzOiBcXFwic21hbGxcXFwiIH0pLFxcbiAgICAgICAgICAgICAgICBjb2xfdHlwZTogXFxcInRleHRfM1xcXCIsXFxuICAgICAgICAgICAgICAgIHVybDogaXRlbS56bGluayxcXG4gICAgICAgICAgICAgICAgZXh0cmE6IHtcXG4gICAgICAgICAgICAgICAgICAgIGxvbmdDbGljazogW3tcXG4gICAgICAgICAgICAgICAgICAgICAgICB0aXRsZTogXFxcIuWkjeWItuejgemTvlxcXCIsXFxuICAgICAgICAgICAgICAgICAgICAgICAganM6ICQudG9TdHJpbmcoKGl0ZW0pID0+IHtcXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgY29weShpdGVtLnpsaW5rKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIH0sIGl0ZW0pLFxcbiAgICAgICAgICAgICAgICAgICAgfSwge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHRpdGxlOiBcXFwi5YW25a6D5bqU55So5omT5byAXFxcIixcXG4gICAgICAgICAgICAgICAgICAgICAgICBqczogSlNPTi5zdHJpbmdpZnkoXFxcIm1hZ25ldDovL1xcXCIgKyBpdGVtLnpsaW5rKSxcXG4gICAgICAgICAgICAgICAgICAgIH1cXG4gICAgICAgICAgICAgICAgICAgIF0sXFxuICAgICAgICAgICAgICAgICAgICBsaW5lVmlzaWJsZTogZmFsc2VcXG4gICAgICAgICAgICAgICAgfVxcbiAgICAgICAgICAgIH0pXFxuICAgICAgICAgICAgZC5wdXNoKHtcXG4gICAgICAgICAgICAgICAgdGl0bGU6IG1lLmZvbnRzdHlsZShtZS5iYWNrQ29sb3IoaXRlbS56c2l6ZSwgeyBiYzogXFxcIiM4RTQ0QURcXFwiIH0pLCB7IHRhZ3M6IFxcXCJzbWFsbFxcXCIgfSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8zXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiBcXFwiaGlrZXI6Ly9lbXB0eVxcXCIsXFxuICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICBkLnB1c2goe1xcbiAgICAgICAgICAgICAgICB0aXRsZTogbWUuZm9udHN0eWxlKG1lLmJhY2tDb2xvcihcXFwi5LiL6L2956eN5a2QXFxcIiwgeyBiYzogXFxcIiMzNTk4RENcXFwiIH0pLCB7IHRhZ3M6IFxcXCJzbWFsbFxcXCIgfSksXFxuICAgICAgICAgICAgICAgIGNvbF90eXBlOiBcXFwidGV4dF8zXFxcIixcXG4gICAgICAgICAgICAgICAgdXJsOiAkKFxcXCIjbm9Mb2FkaW5nI1xcXCIpLmxhenlSdWxlKChpdGVtKSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gYXBpLmhvc3QgKyBpdGVtLmRvd25cXG4gICAgICAgICAgICAgICAgfSwgaXRlbSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgfVxcbiAgICB9KVxcbn1cXG5cXG5cXG5zZXRSZXN1bHQoZClcIn1dIiwiaWNvbiI6Imh0dHBzOi8vYXBpLnhpbmFjLm5ldC9pY29uLz91cmw9aHR0cDovL3d3dy4yYnQwLmNvbS8iLCJwcm94eSI6IiJ9
Add Comment
Please, Sign In to add comment