Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@轻合集.晓@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi6L275ZCI6ZuGLuaZkyIsImF1dGhvciI6Iui9u+WQiOmbhueUn+aIkOWZqCIsInVybCI6Imhpa2VyOi8vZW1wdHkiLCJ2ZXJzaW9uIjo3MiwiY29sX3R5cGUiOiJpY29uXzJfcm91bmQiLCJjbGFzc19uYW1lIjoiIiwiY2xhc3NfdXJsIjoiIiwiYXJlYV9uYW1lIjoiIiwiYXJlYV91cmwiOiIiLCJzb3J0X25hbWUiOiIiLCJ5ZWFyX25hbWUiOiIiLCJzb3J0X3VybCI6IiIsInllYXJfdXJsIjoiIiwiZmluZF9ydWxlIjoianM6XG5sZXQgZWwgPSBbe1xuICAgIHRpdGxlOiAn5riF6Zmk57yT5a2YLOeri+WNs+abtOaWsCA8c21hbGw+KOWfuuS6jui/nOeoi+S7k+W6kyzkuI3opoHpopHnuYHngrnlh7spJyxcbiAgICB1cmw6ICQoKS5sYXp5UnVsZSgoKSA9PiB7XG4gICAgICAgIGNsZWFySXRlbSgndXBkYXRldGltZScpXG4gICAgICAgIHJlZnJlc2hQYWdlKHRydWUpXG4gICAgICAgIHJldHVybiAndG9hc3Q6Ly/lt7Lmm7TmlrAnXG4gICAgfSksXG4gICAgaW1nOiAnaGlrZXI6Ly9pbWFnZXMvaWNvbjEnLFxuICAgIGNvbF90eXBlOiAnYXZhdGFyJ1xufV1cbmVsLnB1c2goe1xuICAgIHVybDogJ1wiaGlrZXI6Ly9zZWFyY2g/cz1cIitpbnB1dCtcIiZydWxlPScgKyBnZXRJdGVtKCdteUNvbGxlY3Rpb24nKSArICdcIicsXG4gICAgZGVzYzogJ+aQnOS9oOaDs+imgeeahC4uLicsXG4gICAgdGl0bGU6ICfmkJzntKInLFxuICAgIGNvbF90eXBlOiAnaW5wdXQnXG59KVxuY29uc3Qg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XG4gICAgICAgICAgICBpZiAoIXYudXJsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHZcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuaW5jbHVkZXMoJ0BsYXp5UnVsZT0nKSkge1xuICAgICAgICAgICAgICAgIHYudXJsID0gdi51cmwucmVwbGFjZSgnLmpzOicsICcuanM6XFxuaWYoTVlfUlVMRSlPYmplY3QuYXNzaWduKE1ZX1JVTEUsJyArICQuc3RyaW5naWZ5KHsgdGl0bGU6IE1ZX1JVTEUudGl0bGUsIHBhZ2VzOiBNWV9SVUxFLnBhZ2VzLCBwYWdlTGlzdDogTVlfUlVMRS5wYWdlTGlzdCwgZmluZF9ydWxlOiAnJywgcGFyYW1zOiAnJyB9KSArICcpOycpXG4gICAgICAgICAgICAgICAgcmV0dXJuIHZcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuaW5jbHVkZXMoJ0BydWxlPScpKSB7XG4gICAgICAgICAgICAgICAgbGV0IFtfLCB1cmwsIHJ1bGVdID0gdi51cmwubWF0Y2goL14oW1xcc1xcU10qPylAcnVsZT0oW1xcc1xcU10qKSQvKVxuICAgICAgICAgICAgICAgIHYudXJsID0gdXJsXG4gICAgICAgICAgICAgICAgUlVMRS5kZXRhaWxfZmluZF9ydWxlID0gcnVsZVxuICAgICAgICAgICAgICAgIFJVTEUuZGV0YWlsX2NvbF90eXBlID0gTVlfUlVMRS5jb2xfdHlwZVxuICAgICAgICAgICAgfSBlbHNlIGlmICh2LnVybC5zdGFydHNXaXRoKCdoaWtlcjovL3BhZ2UvJykpIHtcbiAgICAgICAgICAgICAgICBpZiAodi51cmwuaW5jbHVkZXMoJ3J1bGU9JykgfHwgKHYuZXh0cmEgfHwge30pLnJ1bGUpXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XG4gICAgICAgICAgICAgICAgbGV0IHBhdGggPSB2LnVybC5zcGxpdCgnIycpWzBdLm1hdGNoKC9eaGlrZXI6XFwvXFwvc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tMykge1xuICAgICAgICBzZXRSZXN1bHQoYSwgcGFyYW0xLCBwYXJhbTIsIHBhcmFtMylcbiAgICB9XG5cbiAgICBldmFsKE1ZX1JVTEUuZmluZF9ydWxlLnNsaWNlKDMpKVxufSBlbHNlIHtcbiAgICBsZXQgZmluZFJ1bGUgPSBNWV9SVUxFLmZpbmRfcnVsZS5zcGxpdCgnOycpXG4gICAgcGFyc2VEb21Gb3JBcnJheShpbmRleEh0bWwsIGZpbmRSdWxlLnNoaWZ0KCkpLmZvckVhY2goKGRhdGEpID0+IHtcbiAgICAgICAgbGV0IFt0aXRsZSwgdXJsLCBkZXNjLCBjb250ZW50LCBpbWddID0gZmluZFJ1bGUubWFwKCh2LCBpKSA9PiB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHYgPT0gJyonKSByZXR1cm4gJydcbiAgICAgICAgICAgICAgICAgICAgZWxzZSB2ID0gKGkgPT0gMSB8fCBpID09IDQpID9cbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tKGRhdGEsIHYpIDpcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tRm9ySHRtbChkYXRhLCB2KVxuICAgICAgICAgICAgICAgICAgICBpZiAoaSAhPSAxKSB2ID0gcnVuQ29kZSh2KVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdlxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHt9XG4gICAgICAgICAgICB9KSxcbiAgICAgICAgICAgIHJlcyA9IHtcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXG4gICAgICAgICAgICAgICAgdXJsOiB1cmwsXG4gICAgICAgICAgICAgICAgZGVzYzogZGVzYyxcbiAgICAgICAgICAgICAgICBjb250ZW50OiBjb250ZW50LFxuICAgICAgICAgICAgICAgIGltZzogaW1nXG4gICAgICAgICAgICB9XG4gICAgICAgIGlmIChyZXMudXJsKSB7XG4gICAgICAgICAgICBpZiAoc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9lbXB0eSdcXG4gICAgICAgICAgICB9LCB0aGlzLnNpZ24sIGZvbGRlZCksXFxuICAgICAgICAgICAgY29sX3R5cGU6ICdzY3JvbGxfYnV0dG9uJ1xcbiAgICAgICAgfSlcXG4gICAgICAgIGxldCBhcnIgPSBmb2xkZWQgPyBbdGhpcy5hcnJbMF1dIDogdGhpcy5hcnJcXG4gICAgICAgIGFyci5mb3JFYWNoKCh2KSA9PiB7XFxuICAgICAgICAgICAgbGV0IHsgaWQsIGNsYXNzX25hbWUsIGNsYXNzX3VybCB9ID0gdixcXG4gICAgICAgICAgICAgICAgc2VsZWN0ZWQgPSBKU09OLnN0cmluZ2lmeSh0aGlzLmdldENsYXNzKGlkKSlcXG4gICAgICAgICAgICBjbGFzc19uYW1lLmZvckVhY2goKG5hbWUsIGkpID0+IHtcXG4gICAgICAgICAgICAgICAgbGV0IHVybCA9IGNsYXNzX3VybFtpXSxcXG4gICAgICAgICAgICAgICAgICAgIG5vdyA9IEpTT04uc3RyaW5naWZ5KHsgbmFtZTogbmFtZSwgdXJsOiB1cmwgfSlcXG4gICAgICAgICAgICAgICAgZWwucHVzaCh7XFxuICAgICAgICAgICAgICAgICAgICB0aXRsZTogKHNlbGVjdGVkID09IG5vdyA/ICfigJzigJzigJ3igJ08c3BhbiBzdHlsZT1cXFwiY29sb3I6JyArIHRoaXMuY29sb3IgKyAnXFxcIj48Yj4nIDogJycpICsgbmFtZSxcXG4gICAgICAgICAgICAgICAgICAgIHVybDogJCgnI25vTG9hZGluZyMnKS5sYXp5UnVsZSgoc2lnbiwgaWQsIG5vdykgPT4ge1xcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dFZhcihzaWduICsgaWQsIG5vdylcXG4gICAgICAgICAgICAgICAgICAgICAgICBwdXRWYXIoc2lnbiwgbm93KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlZnJlc2hQYWdlKGZhbHNlKVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAnaGlrZXI6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YSwgcGFyYW0xLCBwYXJhbTIsIHBhcmFtMykge1xcbiAgICAgICAgc2V0UmVzdWx0KGEsIHBhcmFtMSwgcGFyYW0yLCBwYXJhbTMpXFxuICAgIH1cXG5cXG4gICAgZnVuY3Rpb24gc2V0U2VhcmNoUmVzdWx0KGEsIHBhcmFtMSwgcGFyYW0yLCBwYXJhbTMpIHtcXG4gICAgICAgIHNldFJlc3VsdChhLCBwYXJhbTEsIHBhcmFtMiwgcGFyYW0zKVxcbiAgICB9XFxuXFxuICAgIGV2YWwoTVlfUlVMRS5maW5kX3J1bGUuc2xpY2UoMykpXFxufSBlbHNlIHtcXG4gICAgbGV0IGZpbmRSdWxlID0gTVlfUlVMRS5maW5kX3J1bGUuc3BsaXQoJzsnKVxcbiAgICBwYXJzZURvbUZvckFycmF5KGluZGV4SHRtbCwgZmluZFJ1bGUuc2hpZnQoKSkuZm9yRWFjaCgoZGF0YSkgPT4ge1xcbiAgICAgICAgbGV0IFt0aXRsZSwgaW1nLCBkZXNjLCB1cmxdID0gZmluZFJ1bGUubWFwKCh2LCBpKSA9PiB7XFxuICAgICAgICAgICAgICAgIHRyeSB7XFxuICAgICAgICAgICAgICAgICAgICBpZiAodiA9PSAnKicpIHJldHVybiAnJ1xcbiAgICAgICAgICAgICAgICAgICAgZWxzZSB2ID0gKGkgPT0gMSB8fCBpID09IDMpID9cXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZURvbShkYXRhLCB2KSA6XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VEb21Gb3JIdG1sKGRhdGEsIHYpXFxuICAgICAgICAgICAgICAgICAgICBpZiAoaSAhPSAzKSB2ID0gcnVuQ29kZSh2KVxcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZcXG4gICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge31cXG4gICAgICAgICAgICB9KSxcXG4gICAgICAgICAgICByZXMgPSB7XFxuICAgICAgICAgICAgICAgIHRpdGxlOiB0aXRsZSx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vKVxcbiAgICAgICAgICAgICAgICB2LnVybCA9IHVybFxcbiAgICAgICAgICAgICAgICBSVUxFLmRldGFpbF9maW5kX3J1bGUgPSBydWxlXFxuICAgICAgICAgICAgICAgIFJVTEUuZGV0YWlsX2NvbF90eXBlID0gTVlfUlVMRS5jb2xfdHlwZVxcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuc3RhcnRzV2l0aCgnaGlrZXI6Ly9wYWdlLycpKSB7XFxuICAgICAgICAgICAgICAgIGlmICh2LnVybC5pbmNsdWRlcygncnVsZT0nKSB8fCAodi5leHRyYSB8fCB7fSkucnVsZSlcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgICAgIGxldCBwYXRoID0gdi51cmwuc3BsaXQoJyMnKVswXS5tYXRjaCgvXmhpa2VyOlxcXFwvXFxcXC9wYWdlXFxcXC8oLis/KSg/OlxcXFw/LiopPyQvKVsxXSxcXG4gICAgICAgICAgICAgICAgICAgIHN1YlBhZ2UgPSBNWV9SVUxFLnBhZ2VMaXN0LmZpbmQoKHYpID0+IHYucGF0aCA9PSBwYXRoKVxcbiAgICAgICAgICAgICAgICBSVUxFLmRldGFpbF9maW5kX3J1bGUgPSBzdWJQYWdlLnJ1bGVcXG4gICAgICAgICAgICAgICAgUlVMRS5kZXRhaWxfY29sX3R5cGUgPSBzdWJQYWdlLmNvbF90eXBlXFxuICAgICAgICAgICAgICAgIFJVTEUucGFyYW1zID0gdi5leHRyYSB8fCB7fVxcbiAgICAgICAgICAgIH0gZWxzZSB7IHJldHVybiB2IH1cXG4gICAgICAgICAgICB2LmV4dHJhID0geyB1cmw6IHYudXJsLCBSVUxFOiBSVUxFIH1cXG4gICAgICAgICAgICB2LnVybCA9ICdoaWtlcjovL3BhZ2UvZGV0YWlsTG9hZD9ydWxlPScgKyBnZXRJdGVtKCdteUNvbGxlY3Rpb24nKVxcbiAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICB9KSlcXG4gICAg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OlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tRm9ySHRtbChkYXRhLCB2KVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgIT0gMykgdiA9IHJ1bkNvZGUodilcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxuICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgcmVzID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLFxcbiAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IE1ZX1JVTEUuY29sX3R5cGVcXG4gICAgICAgICAgICB9XFxuICAgICAgICBpZiAocmVzLnVybCAmJiByZXMudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpXFxuICAgICAgICAgICAgcmVzLnVybCA9IHJlcy51cmwucmVwbGFjZSgnLmpzOicsICcuanM6XFxcXG5pZihNWV9SVUxFKU9iamVjdC5hc3NpZ24oTVlfUlVMRSwnICsgJC5zdHJpbmdpZnkoeyB0aXRsZTogTVlfUlVMRS50aXRsZSwgcGFnZXM6IE1ZX1JVTEUucGFnZXMsIHBhZ2VMaXN0OiBNWV9SVUxFLnBhZ2VMaXN0LCBmaW5kX3J1bGU6ICcnLCBwYXJhbXM6ICcnIH0pICsgJyk7JylcXG4gICAgICAgIG15Q29sbGVjdGlvbl9lbC5wdXNoKHJlcylcXG4gICAgfSlcXG4gICAgc2V0UmVzdWx0KG15Q29sbGVjdGlvbl9lbClcXG59XFxuXCJ9LHtcImNvbF90eXBlXCI6XCJtb3ZpZV8zXCIsXCJuYW1lXCI6XCLmlbDmja7ovb3lhaVcIixcInBhdGhcIjpcImRhdGFMb2FkXCIsXCJydWxlXCI6XCIvL+ecn+ato+iOt+WPluaVsO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gICAgICAgIGxldCBvcHRpb25zID0geyBoZWFkZXJzOiB7ICdDb250ZW50LVR5cGUnOiAndGV4dC9wbGFpbjsgY2hhcnN0PVVURi04JyB9LCBtZXRob2Q6IHVybFsxXSB9XFxuICAgICAgICAvLyBwb3N05pa55rOV5pe26L2s5o2i5Y+C5pWwXFxuICAgICAgICBpZiAoL15wb3N0JC9pLnRlc3Qob3B0aW9uc1snbWV0aG9kJ10pKSB7XFxuICAgICAgICAgICAgbGV0IFtvcmlVcmwsIGJvZHldID0gdXJsWzBdLnNwbGl0KCc/JylcXG4gICAgICAgICAgICB1cmxbMF0gPSBvcmlVcmwucmVwbGFjZSgv77yf77yfL2csICc/JylcXG4gICAgICAgICAgICBpZiAoYm9keS5zdGFydHNXaXRoKCdKc29uQm9keT0nKSkgYm9keSA9IGJvZHkuc2xpY2UoOSlcXG4gICAgICAgICAgICBvcHRpb25zWydib2R5J10gPSBib2R5XFxuICAgICAgICB9XFxuICAgICAgICBpZiAodXJsWzJdKSBvcHRpb25zLmhlYWRlcnNbJ0NvbnRlbnQtVHlwZSddID0gb3B0aW9ucy5oZWFkZXJzWydDb250ZW50LVR5cGUnXS5zbGljZSgwLCAxOSkgKyB1cmxbMl1cXG4gICAgICAgIGlmICh1cmxbM10pIHVybFszXS5tYXRjaCgveyguKil9LylbMV0uc3BsaXQoJyYmJykuZm9yRWFjaCgodikgPT4ge1xcbiAgICAgICAgICAgIGxldCBba2V5LCB2YWx1ZV0gPSB2LnNwbGl0KCdAJylcXG4gICAgICAgICAgICBvcHRpb25zLmhlYWRlcnNba2V5XSA9IHJ1bkNvZGUodmFsdWUpXFxuICAgICAgICB9KVxcbiAgICAgICAgLy8g5re75Yqg5YWo5bGAVUFcXG4gICAgICAgIGlmICghb3B0aW9ucy5oZWFkZXJzWydVc2VyLUFnZW50J10pIHtcXG4gICAgICAgICAgICBpZiAoTVlfUlVMRS51YSA9PSAncGMnKVxcbiAgICAgICAgICAgICAgICBvcHRpb25zLmhlYWRlcnNbJ1VzZXItQWdlbnQnXSA9IFBDX1VBXFxuICAgICAgICAgICAgZWxzZSBpZiAoTVlfUlVMRS51YSA9PSAnbW9iaWxlJylcXG4gICAgICAgICAgICAgICAgb3B0aW9ucy5oZWFkZXJzWydVc2VyLUFnZW50J10gPSBNT0JJTEVfVUFcXG4gICAgICAgIH1cXG4gICAgICAgIHJldHVybiB7IE1ZX1VSTDogdXJsWzBdLCBpbmRleEh0bWw6IGZldGNoKHVybFswXSwgb3B0aW9ucykgfVxcbiAgICB9XFxufVxcblwifV0ifQ==
Add Comment
Please, Sign In to add comment