Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 海阔视界规则分享,当前分享的是:小程序¥home_rule_v2¥base64://@轻合集.六神@eyJsYXN0X2NoYXB0ZXJfcnVsZSI6IiIsInRpdGxlIjoi6L275ZCI6ZuGLuWFreelniIsImF1dGhvciI6IuWwj+ajieiihPCfjJ4m5rC46L+c44Gu5piO5pelIiwidXJsIjoiaGlrZXI6Ly9lbXB0eSIsInZlcnNpb24iOjcwLCJjb2xfdHlwZSI6Imljb25fMl9yb3VuZCIsImNsYXNzX25hbWUiOiIiLCJjbGFzc191cmwiOiIiLCJhcmVhX25hbWUiOiIiLCJhcmVhX3VybCI6IiIsInNvcnRfbmFtZSI6IiIsInllYXJfbmFtZSI6IiIsInNvcnRfdXJsIjoiIiwieWVhcl91cmwiOiIiLCJmaW5kX3J1bGUiOiJqczpcbmxldCBlbCA9IFt7XG4gICAgdGl0bGU6ICfmuIXpmaTnvJPlrZgs56uL5Y2z5pu05pawIDxzbWFsbD4o5Z+65LqO6L+c56iL5LuT5bqTLOS4jeimgemikee5geeCueWHuyknLFxuICAgIHVybDogJCgpLmxhenlSdWxlKCgpID0+IHtcbiAgICAgICAgY2xlYXJJdGVtKCd1cGRhdGV0aW1lJylcbiAgICAgICAgcmVmcmVzaFBhZ2UodHJ1ZSlcbiAgICAgICAgcmV0dXJuICd0b2FzdDovL+W3suabtOaWsCdcbiAgICB9KSxcbiAgICBpbWc6ICdoaWtlcjovL2ltYWdlcy9pY29uMScsXG4gICAgY29sX3R5cGU6ICdhdmF0YXInXG59XVxuZWwucHVzaCh7XG4gICAgdXJsOiAnXCJoaWtlcjovL3NlYXJjaD9zPVwiK2lucHV0K1wiJnJ1bGU9JyArIGdldEl0ZW0oJ215Q29sbGVjdGlvbicpICsgJ1wiJyxcbiAgICBkZXNjOiAn5pCc5L2g5oOz6KaB55qELi4uJyxcbiAgICB0aXRsZTogJ+aQnOe0oicsXG4gICAgY29sX3R5cGU6ICdpbnB1dCdcbn0pXG5jb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gbG9nKGVsKVxuICAgICAgICBBcnJheS5wcm90b3R5cGUucHVzaC5hcHBseShteUNvbGxlY3Rpb25fZWwsIGVsLm1hcCgodikgPT4ge1xuICAgICAgICAgICAgbGV0IFJVTEUgPSBPYmplY3QuYXNzaWduKHt9LCBNWV9SVUxFKVxuXG4gICAgICAgICAgICBpZiAoIXYudXJsKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHZcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuaW5jbHVkZXMoJ0BsYXp5UnVsZT0nKSkge1xuICAgICAgICAgICAgICAgIHYudXJsID0gdi51cmwucmVwbGFjZSgnQGxhenlSdWxlPS5qczonLCAnQGxhenlSdWxlPS5qczpcXG5PYmplY3QuYXNzaWduKE1ZX1JVTEV8fHt9LCcgKyAkLnN0cmluZ2lmeSh7IHRpdGxlOiBNWV9SVUxFLnRpdGxlLCBwYWdlczogTVlfUlVMRS5wYWdlcywgcGFnZUxpc3Q6IE1ZX1JVTEUucGFnZUxpc3QsIGZpbmRfcnVsZTogJycsIHBhcmFtczogJycgfSkgKyAnKTsnKVxuICAgICAgICAgICAgICAgIHJldHVybiB2XG4gICAgICAgICAgICB9IGVsc2UgaWYgKHYudXJsLmluY2x1ZGVzKCdAcnVsZT0nKSkge1xuICAgICAgICAgICAgICAgIGxldCBbXywgdXJsLCBydWxlXSA9IHYudXJsLm1hdGNoKC9eKFtcXHNcXFNdKj8pQHJ1bGU9KFtcXHNcXFNdKikkLylcbiAgICAgICAgICAgICAgICB2LnVybCA9IHVybFxuICAgICAgICAgICAgICAgIFJVTEUuZGV0YWlsX2ZpbmRfcnVsZSA9IHJ1bGVcbiAgICAgICAgICAgICAgICBSVUxFLmRldGFpbF9jb2xfdHlwZSA9IE1ZX1JVTEUuY29sX3R5cGVcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodi51cmwuc3RhcnRzV2l0aCgnaGlrZXI6Ly9wYWdlLycpKSB7XG4gICAgICAgICAgICAgICAgaWYgKH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dWx0KGEsIHBhcmFtMSwgcGFyYW0yLCBwYXJhbTMpIHtcbiAgICAgICAgc2V0UmVzdWx0KGEsIHBhcmFtMSwgcGFyYW0yLCBwYXJhbTMpXG4gICAgfVxuXG4gICAgZnVuY3Rpb24gc2V0U2VhcmNoUmVzdWx0KGEsIHBhcmFtMSwgcGFyYW0yLCBwYXJhbTMpIHtcbiAgICAgICAgc2V0UmVzdWx0KGEsIHBhcmFtMSwgcGFyYW0yLCBwYXJhbTMpXG4gICAgfVxuXG4gICAgZXZhbChNWV9SVUxFLmZpbmRfcnVsZS5zbGljZSgzKSlcbn0gZWxzZSB7XG4gICAgbGV0IGZpbmRSdWxlID0gTVlfUlVMRS5maW5kX3J1bGUuc3BsaXQoJzsnKVxuICAgIHBhcnNlRG9tRm9yQXJyYXkoaW5kZXhIdG1sLCBmaW5kUnVsZS5zaGlmdCgpKS5mb3JFYWNoKChkYXRhKSA9PiB7XG4gICAgICAgIGxldCBbdGl0bGUsIHVybCwgZGVzYywgY29udGVudCwgaW1nXSA9IGZpbmRSdWxlLm1hcCgodiwgaSkgPT4ge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICh2ID09ICcqJykgcmV0dXJuICcnXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgdiA9IChpID09IDEgfHwgaSA9PSA0KSA/XG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZURvbShkYXRhLCB2KSA6XG4gICAgICAgICAgICAgICAgICAgICAgICBwYXJzZURvbUZvckh0bWwoZGF0YSwgdilcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgIT0gMSkgdiA9IHJ1bkNvZGUodilcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHZcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7fVxuICAgICAgICAgICAgfSksXG4gICAgICAgICAgICByZXMgPSB7XG4gICAgICAgICAgICAgICAgdGl0bGU6IHRpdGxlLFxuICAgICAgICAgICA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ZCwgbm93KSA9PiB7XFxuICAgICAgICAgICAgICAgICAgICAgICAgcHV0VmFyKHNpZ24gKyBpZCwgbm93KVxcbiAgICAgICAgICAgICAgICAgICAgICAgIHB1dFZhcihzaWduLCBub3cpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmVmcmVzaFBhZ2UoZmFsc2UpXFxuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuICdoaWtlcjovL2VtcHR5J1xcbiAgICAgICAgICAgICAgICAgICAgfSwgdGhpcy5zaWduLCBpZCwgbm93KSxcXG4gICAgICAgICAgICAgICAgICAgIGNvbF90eXBlOiAnc2Nyb2xsX2J1dHRvbidcXG4gICAgICAgICAgICAgICAgfSlcXG4gICAgICAgICAgICB9KVxcbiAgICAgICAgICAgIGVsLnB1c2goeyBjb2xfdHlwZTogdGhpcy5ib3VuZGFyeSB9KVxcbiAgICAgICAgfSlcXG4gICAgfSxcXG4gICAgaW5pdChjbGFzc09iamVjdCkge1xcbiAgICAgICAgaWYgKHR5cGVvZiBjbGFzc09iamVjdC5jbGFzc19uYW1lID09ICdzdHJpbmcnKVxcbiAgICAgICAgICAgIGNsYXNzT2JqZWN0LmNsYXNzX25hbWUgPSBjbGFzc09iamVjdC5jbGFzc19uYW1lLnNwbGl0KCcmJylcXG4gICAgICAgIGlmICh0eXBlb2YgY2xhc3NPYmplY3QuY2xhc3NfdXJsID09ICdzdHJpbmcnKVxcbiAgICAgICAgICAgIGNsYXNzT2JqZWN0LmNsYXNzX3VybCA9IGNsYXNzT2JqZWN0LmNsYXNzX3VybC5zcGxpdCgnJicpXFxuICAgICAgICByZXR1cm4gY2xhc3NPYmplY3RcXG4gICAgfSxcXG4gICAgcHVzaChjbGFzc09iamVjdCkge1xcbiAgICAgICAgdGhpcy5hcnIucHVzaCh0aGlzLmluaXQoY2xhc3NPYmplY3QpKVxcbiAgICB9LFxcbiAgICBnZXRDbGFzcyhpZCkge1xcbiAgICAgICAgbGV0IGRlZmF1bHRDbGFzcyA9IH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0cnkge1xcbiAgICAgICAgICAgICAgICAgICAgaWYgKHYgPT0gJyonKSByZXR1cm4gJydcXG4gICAgICAgICAgICAgICAgICAgIGVsc2UgdiA9IChpID09IDEgfHwgaSA9PSAzKSA/XFxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyc2VEb20oZGF0YSwgdikgOlxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhcnNlRG9tRm9ySHRtbChkYXRhLCB2KVxcbiAgICAgICAgICAgICAgICAgICAgaWYgKGkgIT0gMykgdiA9IHJ1bkNvZGUodilcXG4gICAgICAgICAgICAgICAgICAgIHJldHVybiB2XFxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHt9XFxuICAgICAgICAgICAgfSksXFxuICAgICAgICAgICAgcmVzID0ge1xcbiAgICAgICAgICAgICAgICB0aXRsZTogdGl0bGUsXFxuICAgICAgICAgICAgICAgIHVybDogdXJsLFxcbiAgICAgICAgICAgICAgICBkZXNjOiBkZXNjLFxcbiAgICAgICAgICAgICAgICBpbWc6IGltZyxcXG4gICAgICAgICAgICAgICAgY29sX3R5cGU6IE1ZX1JVTEUuY29sX3R5cGVcXG4gICAgICAgICAgICB9XFxuICAgICAgICBpZiAocmVzLnVybCAmJiByZXMudXJsLmluY2x1ZGVzKCdAbGF6eVJ1bGU9JykpXFxuICAgICAgICAgICAgcmVzLnVybCA9IHJlcy51cmwucmVwbGFjZSgnQGxhenlSdWxlPS5qczonLCAnQGxhenlSdWxlPS5qczpcXFxcbk9iamVjdC5hc3NpZ24oTVlfUlVMRXx8e30sJyArICQuc3RyaW5naWZ5KHsgdGl0bGU6IE1ZX1JVTEUudGl0bGUsIHBhZ2VzOiBNWV9SVUxFLnBhZ2VzLCBwYWdlTGlzdDogTVlfUlVMRS5wYWdlTGlzdCwgZmluZF9ydWxlOiAnJywgcGFyYW1zOiAnJyB9KSArICcpOycpXFxuICAgICAgICBteUNvbGxlY3Rpb25fZWwucHVzaChyZXMpXFxuICAgIH0pXFxuICA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ZGVyc1trZXldID0gcnVuQ29kZSh2YWx1ZSlcXG4gICAgICAgIH0pXFxuICAgICAgICAvLyDmt7vliqDlhajlsYBVQVxcbiAgICAgICAgaWYgKCFvcHRpb25zLmhlYWRlcnNbJ1VzZXItQWdlbnQnXSkge1xcbiAgICAgICAgICAgIGlmIChNWV9SVUxFLnVhID09ICdwYycpXFxuICAgICAgICAgICAgICAgIG9wdGlvbnMuaGVhZGVyc1snVXNlci1BZ2VudCddID0gUENfVUFcXG4gICAgICAgICAgICBlbHNlIGlmIChNWV9SVUxFLnVhID09ICdtb2JpbGUnKVxcbiAgICAgICAgICAgICAgICBvcHRpb25zLmhlYWRlcnNbJ1VzZXItQWdlbnQnXSA9IE1PQklMRV9VQVxcbiAgICAgICAgfVxcbiAgICAgICAgcmV0dXJuIHsgTVlfVVJMOiB1cmxbMF0sIGluZGV4SHRtbDogZmV0Y2godXJsWzBdLCBvcHRpb25zKSB9XFxuICAgIH1cXG59XFxuXCJ9XSJ9
Add Comment
Please, Sign In to add comment