CikeyQi erzaozi commited on
Commit
4ee1343
·
1 Parent(s): df359ee

upload Guoba-Plugin (#7)

Browse files

- upload Guoba-Plugin (87e0e109d8904266a40887f339f4be73f9a52aa1)


Co-authored-by: Erzaozi <[email protected]>

This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. Yunzai/plugins/Guoba-Plugin/.gitignore +124 -0
  3. Yunzai/plugins/Guoba-Plugin/CHANGELOG.md +4 -0
  4. Yunzai/plugins/Guoba-Plugin/LICENSE +674 -0
  5. Yunzai/plugins/Guoba-Plugin/README.md +117 -0
  6. Yunzai/plugins/Guoba-Plugin/apps/helper.js +62 -0
  7. Yunzai/plugins/Guoba-Plugin/apps/login.js +53 -0
  8. Yunzai/plugins/Guoba-Plugin/apps/update.js +238 -0
  9. Yunzai/plugins/Guoba-Plugin/apps/v2-adapter.js +34 -0
  10. Yunzai/plugins/Guoba-Plugin/components/Changelog.js +72 -0
  11. Yunzai/plugins/Guoba-Plugin/config/application.yaml +24 -0
  12. Yunzai/plugins/Guoba-Plugin/defSet/application.yaml +24 -0
  13. Yunzai/plugins/Guoba-Plugin/framework/README.md +5 -0
  14. Yunzai/plugins/Guoba-Plugin/framework/index.js +17 -0
  15. Yunzai/plugins/Guoba-Plugin/framework/src/GuobaApplication.js +97 -0
  16. Yunzai/plugins/Guoba-Plugin/framework/src/components/GuobaError.js +18 -0
  17. Yunzai/plugins/Guoba-Plugin/framework/src/components/Pager.js +59 -0
  18. Yunzai/plugins/Guoba-Plugin/framework/src/components/Result.js +124 -0
  19. Yunzai/plugins/Guoba-Plugin/framework/src/components/YamlReader.js +117 -0
  20. Yunzai/plugins/Guoba-Plugin/framework/src/core/Controller.js +16 -0
  21. Yunzai/plugins/Guoba-Plugin/framework/src/core/Decorator.js +13 -0
  22. Yunzai/plugins/Guoba-Plugin/framework/src/core/Interceptor.js +18 -0
  23. Yunzai/plugins/Guoba-Plugin/framework/src/core/Preload.js +47 -0
  24. Yunzai/plugins/Guoba-Plugin/framework/src/core/RestController.js +127 -0
  25. Yunzai/plugins/Guoba-Plugin/framework/src/core/Service.js +10 -0
  26. Yunzai/plugins/Guoba-Plugin/framework/src/helper/injection.js +37 -0
  27. Yunzai/plugins/Guoba-Plugin/framework/src/loader/loadComponents.js +43 -0
  28. Yunzai/plugins/Guoba-Plugin/framework/src/loader/loadDecorator.js +30 -0
  29. Yunzai/plugins/Guoba-Plugin/framework/src/loader/loadHelper.js +21 -0
  30. Yunzai/plugins/Guoba-Plugin/framework/src/loader/loadPreload.js +52 -0
  31. Yunzai/plugins/Guoba-Plugin/framework/src/utils/common.js +95 -0
  32. Yunzai/plugins/Guoba-Plugin/guoba.support.js +127 -0
  33. Yunzai/plugins/Guoba-Plugin/index.js +26 -0
  34. Yunzai/plugins/Guoba-Plugin/lib/compareVersions.js +178 -0
  35. Yunzai/plugins/Guoba-Plugin/lib/diskinfo.js +155 -0
  36. Yunzai/plugins/Guoba-Plugin/lib/v2-js/目录说明.txt +4 -0
  37. Yunzai/plugins/Guoba-Plugin/models/libs.js +2 -0
  38. Yunzai/plugins/Guoba-Plugin/models/platform.js +10 -0
  39. Yunzai/plugins/Guoba-Plugin/models/utils.js +5 -0
  40. Yunzai/plugins/Guoba-Plugin/package.json +33 -0
  41. Yunzai/plugins/Guoba-Plugin/resources/images/help.jpg +0 -0
  42. Yunzai/plugins/Guoba-Plugin/resources/images/icon.png +0 -0
  43. Yunzai/plugins/Guoba-Plugin/resources/images/no-miao.png +0 -0
  44. Yunzai/plugins/Guoba-Plugin/resources/images/readme/001.png +0 -0
  45. Yunzai/plugins/Guoba-Plugin/resources/images/readme/002.png +0 -0
  46. Yunzai/plugins/Guoba-Plugin/resources/images/readme/003.png +0 -0
  47. Yunzai/plugins/Guoba-Plugin/resources/images/readme/004.png +0 -0
  48. Yunzai/plugins/Guoba-Plugin/resources/images/readme/005.png +0 -0
  49. Yunzai/plugins/Guoba-Plugin/resources/json/city.json +1 -0
  50. Yunzai/plugins/Guoba-Plugin/server/constant/Constant.js +11 -0
.gitattributes CHANGED
@@ -45,3 +45,4 @@ Yunzai/plugins/miao-plugin/resources/common/font/HYWH-65W.woff filter=lfs diff=l
45
  Yunzai/plugins/miao-plugin/resources/common/font/NZBZ.ttf filter=lfs diff=lfs merge=lfs -text
46
  Yunzai/plugins/miao-plugin/resources/help/icon.png filter=lfs diff=lfs merge=lfs -text
47
  Yunzai/plugins/miao-plugin/resources/meta/character/莱欧斯利/imgs/splash.webp filter=lfs diff=lfs merge=lfs -text
 
 
45
  Yunzai/plugins/miao-plugin/resources/common/font/NZBZ.ttf filter=lfs diff=lfs merge=lfs -text
46
  Yunzai/plugins/miao-plugin/resources/help/icon.png filter=lfs diff=lfs merge=lfs -text
47
  Yunzai/plugins/miao-plugin/resources/meta/character/莱欧斯利/imgs/splash.webp filter=lfs diff=lfs merge=lfs -text
48
+ Yunzai/plugins/Guoba-Plugin/server/static/assets/HYWH-65W.woff filter=lfs diff=lfs merge=lfs -text
Yunzai/plugins/Guoba-Plugin/.gitignore ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ lerna-debug.log*
8
+
9
+ # Diagnostic reports (https://nodejs.org/api/report.html)
10
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11
+
12
+ # Runtime data
13
+ pids
14
+ *.pid
15
+ *.seed
16
+ *.pid.lock
17
+
18
+ # Directory for instrumented libs generated by jscoverage/JSCover
19
+ lib-cov
20
+
21
+ # Coverage directory used by tools like istanbul
22
+ coverage
23
+ *.lcov
24
+
25
+ # nyc test coverage
26
+ .nyc_output
27
+
28
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29
+ .grunt
30
+
31
+ # Bower dependency directory (https://bower.io/)
32
+ bower_components
33
+
34
+ # node-waf configuration
35
+ .lock-wscript
36
+
37
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
38
+ build/Release
39
+
40
+ # Dependency directories
41
+ node_modules/
42
+ jspm_packages/
43
+
44
+ # Snowpack dependency directory (https://snowpack.dev/)
45
+ web_modules/
46
+
47
+ # TypeScript cache
48
+ *.tsbuildinfo
49
+
50
+ # Optional npm cache directory
51
+ .npm
52
+
53
+ # Optional eslint cache
54
+ .eslintcache
55
+
56
+ # Microbundle cache
57
+ .rpt2_cache/
58
+ .rts2_cache_cjs/
59
+ .rts2_cache_es/
60
+ .rts2_cache_umd/
61
+
62
+ # Optional REPL history
63
+ .node_repl_history
64
+
65
+ # Output of 'npm pack'
66
+ *.tgz
67
+
68
+ # Yarn Integrity file
69
+ .yarn-integrity
70
+
71
+ # dotenv environment variables file
72
+ .env
73
+ .env.test
74
+
75
+ # parcel-bundler cache (https://parceljs.org/)
76
+ .cache
77
+ .parcel-cache
78
+
79
+ # Next.js build output
80
+ .next
81
+ out
82
+
83
+ # Nuxt.js build / generate output
84
+ .nuxt
85
+ dist
86
+
87
+ # Gatsby files
88
+ .cache/
89
+ # Comment in the public line in if your project uses Gatsby and not Next.js
90
+ # https://nextjs.org/blog/next-9-1#public-directory-support
91
+ # public
92
+
93
+ # vuepress build output
94
+ .vuepress/dist
95
+
96
+ # Serverless directories
97
+ .serverless/
98
+
99
+ # FuseBox cache
100
+ .fusebox/
101
+
102
+ # DynamoDB Local files
103
+ .dynamodb/
104
+
105
+ # TernJS port file
106
+ .tern-port
107
+
108
+ # Stores VSCode versions used for testing VSCode extensions
109
+ .vscode-test
110
+
111
+ # yarn v2
112
+ .yarn/cache
113
+ .yarn/unplugged
114
+ .yarn/build-state.yml
115
+ .yarn/install-state.gz
116
+ .pnp.*
117
+ /.idea/
118
+
119
+ # Guoba Ingored
120
+ /lib/test.js
121
+ /lib/v2-js/*
122
+ /config/*
123
+ /test/
124
+ /server/static/preload
Yunzai/plugins/Guoba-Plugin/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # 1.0.0
2
+
3
+ * 嗨害嗨,这是第一个版本呢
4
+ * 哦吼吼`吼吼吼`吼吼吼
Yunzai/plugins/Guoba-Plugin/LICENSE ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <https://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <https://www.gnu.org/licenses/why-not-lgpl.html>.
Yunzai/plugins/Guoba-Plugin/README.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Guoba-Plugin
2
+
3
+ `Guoba-Plugin`是`Yunzai-Bot`的扩展插件,主要提供后台管理界面。
4
+
5
+ > 管理面板仅支持V3版本的Yunzai;V2版本Yunzai仅支持迁移至V3功能。
6
+
7
+ 具体功能可在安装插件后,通过发送`#锅巴帮助`来进行查看。
8
+
9
+ ## 已实现的功能
10
+
11
+ - [x] 主人登录
12
+ - [x] 更新插件
13
+ - [x] 自动升级
14
+ - [x] 配置文件管理
15
+ - [x] plugin插件管理
16
+ - [x] plugin插件配置
17
+ - [x] 编辑喵喵帮助 [@realhuhu](https://github.com/realhuhu)
18
+ - [x] V2云崽丝滑迁移至V3([视频教程](https://www.bilibili.com/video/BV1fP411T7KM))
19
+
20
+ [TODO代办](https://gitee.com/guoba-yunzai/resources/blob/master/other/TODO.md)
21
+
22
+ ## 安装插件
23
+
24
+ #### 第 1 步:下载插件
25
+
26
+ 在云崽根目录下打开终端,运行:
27
+
28
+ * 使用 Gitee
29
+ ``` bash
30
+ git clone --depth=1 https://gitee.com/guoba-yunzai/guoba-plugin.git ./plugins/Guoba-Plugin/
31
+ ```
32
+
33
+ * 使用 Github
34
+ ``` bash
35
+ git clone --depth=1 https://github.com/guoba-yunzai/guoba-plugin.git ./plugins/Guoba-Plugin/
36
+ ```
37
+
38
+ > 注:根据你的网络情况选择不同的仓库地址,在国内使用Gitee相对稳定
39
+
40
+ #### 第 2 步:安装依赖
41
+
42
+ ##### 方式1:采用 pnpm
43
+
44
+ > 注:如果你不是通过`pnpm`安装的云崽,那么请【**不要**】使用此方式,请看`方式2`
45
+
46
+ 如果你是使用`pnpm`安装的云崽,那么只需要在云崽根目录下运行此命令即可:
47
+
48
+ ```bash
49
+ pnpm install --filter=guoba-plugin
50
+ ```
51
+
52
+ > 注:请务必直接复制提供的命令,否则可能会导致依赖丢失的情况,若发生需自行重新安装。<br>
53
+ > `--filter=guoba-plugin`:只安装`guoba-plugin`下的依赖,其他依赖不处理,防止丢失。
54
+
55
+ ##### 方式2:采用 npm 或 cnpm
56
+
57
+ 如果是使用`npm`或`cnpm`等其他依赖安装工具,需要手动安装以下依赖:
58
+
59
+ ```bash
60
+ npm install express multer body-parser jsonwebtoken
61
+ ```
62
+
63
+ 如果以上命令执行失败,可尝试使用`cnpm`进行安装,只需将开头的`npm`替换成`cnpm`即可。
64
+
65
+ > 注:cnpm需要单独安装,已安装的可以忽略,安装命令如下:<br>
66
+ > `npm install cnpm -g --registry=https://registry.npmmirror.com`
67
+
68
+ #### 第 3 步:运行插件
69
+
70
+ 依赖安装完毕之后,直接运行即可,默认运行端口号是:50831
71
+
72
+ > 可在 config/application.yaml 中修改
73
+
74
+ 启动完成之后,可以在控制台中看到网页地址,复制到浏览器中即可访问。
75
+
76
+ 如果访问不到,请发送`#锅巴帮助`指令获取帮助。
77
+
78
+ ## 更新插件
79
+
80
+ 一般会自动更新,如需手动更新,请发送`#锅巴更新`指令
81
+
82
+ # 功能预览
83
+
84
+ - 主界面
85
+ ![001](./resources/images/readme/001.png)
86
+
87
+ - 查看插件README
88
+ ![002](./resources/images/readme/002.png)
89
+
90
+ - 基础配置
91
+ ![003](./resources/images/readme/003.png)
92
+
93
+ - 群组配置
94
+ ![004](./resources/images/readme/004.png)
95
+
96
+ - 编辑喵喵帮助
97
+ ![005](./resources/images/readme/005.png)
98
+
99
+ # 免责声明
100
+
101
+ 1. 功能仅限内部交流与小范围使用,严禁将Guoba-Plugin用于任何商业用途或盈利
102
+ 2. 图片与其他素材均来自于网络,仅供交流学习使用,如有侵权请联系,会立即删除
103
+
104
+ # 其他
105
+
106
+ - 最后求个个star或者[爱发电](https://afdian.net/a/zolay-poi)
107
+ 你的支持是维护本项目的动力~
108
+
109
+ * Yunzai-Bot
110
+ - [gitee](https://gitee.com/Le-niao/Yunzai-Bot)
111
+ - [github](https://github.com/Le-niao/Yunzai-Bot)
112
+ * Yunzai插件索引
113
+ - [gitee](https://gitee.com/yhArcadia/Yunzai-Bot-plugins-index)
114
+ - [github](https://github.com/yhArcadia/Yunzai-Bot-plugins-index)
115
+ * Miao-Plugin
116
+ - [gitee](https://github.com/yoimiya-kokomi/miao-plugin)
117
+ - [github](https://github.com/yoimiya-kokomi/miao-plugin)
Yunzai/plugins/Guoba-Plugin/apps/helper.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import path from 'path'
2
+ import {cfg, _paths} from "#guoba.platform";
3
+ import {sendToMaster} from '#guoba.utils'
4
+
5
+ export class GuobaHelp extends plugin {
6
+
7
+ constructor(e) {
8
+ super({
9
+ name: '锅巴帮助',
10
+ dsc: '锅巴插件帮助',
11
+ event: 'message',
12
+ priority: 100,
13
+ rule: [
14
+ {
15
+ reg: '^#?锅巴(帮助|菜单|说明|功能|指令|命令|使用说明|help)$',
16
+ fnc: 'getHelp',
17
+ permission: 'master',
18
+ },
19
+ {
20
+ reg: '^#锅巴重启$',
21
+ fnc: 'restart',
22
+ permission: 'master',
23
+ },
24
+ ],
25
+ })
26
+ }
27
+
28
+ async init() {
29
+ // 引导用户进行配置
30
+ this.firstGuide()
31
+
32
+ }
33
+
34
+ async getHelp() {
35
+ let msg = [
36
+ '锅巴帮助:\n' +
37
+ 'https://gitee.com/guoba-yunzai/guoba-plugin/wikis/Home'
38
+ ]
39
+ return this.e.reply(msg)
40
+ }
41
+
42
+ async restart() {
43
+ if (Guoba && Guoba.reload) {
44
+ await Guoba.reload()
45
+ return this.e.reply('锅巴重启成功~')
46
+ } else {
47
+ return this.e.reply('奇怪,服务似乎并没有启动……')
48
+ }
49
+ }
50
+
51
+ // 首次安装锅巴时的引导
52
+ async firstGuide() {
53
+ if (!cfg.get('base.guide')) {
54
+ return
55
+ }
56
+ cfg.set('base.guide', false)
57
+ sendToMaster([
58
+ segment.image(path.join(_paths.pluginResources, 'images/help.jpg'))
59
+ ])
60
+ }
61
+
62
+ }
Yunzai/plugins/Guoba-Plugin/apps/login.js ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {autowired} from "#guoba.framework";
2
+ import {makeForwardMsg} from '#guoba.utils'
3
+
4
+ export class GuobaLogin extends plugin {
5
+
6
+ loginService = autowired('loginService')
7
+
8
+ constructor(e) {
9
+ super({
10
+ name: '锅巴登录',
11
+ dsc: '锅巴快捷登录',
12
+ event: 'message',
13
+ priority: 100,
14
+ rule: [
15
+ {
16
+ reg: '^#?锅巴(登录|登陆)$',
17
+ fnc: 'login',
18
+ },
19
+ ],
20
+ }, e)
21
+ }
22
+
23
+ async login() {
24
+ if (!this.e.isMaster) return false
25
+ if (this.e.isGroup) {
26
+ this.e.reply('请私聊使用锅巴~')
27
+ return true
28
+ }
29
+ let webAddress
30
+ try {
31
+ webAddress = await this.loginService.setQuickLogin(this.e.user_id)
32
+ } catch (e) {
33
+ console.error(e)
34
+ return this.reply('锅巴服务启动失败,可能是端口号占用,或者依赖没有安装完整,请发送“#锅巴帮助”获取相关帮助信息。')
35
+ }
36
+ let {custom, local, remote} = webAddress
37
+ let message = [`欢迎回来主人~\n这是您的登录地址:`]
38
+ if (custom && custom.length > 0) {
39
+ message.push(`自定义地址:\n` + custom.join('\n'))
40
+ }
41
+ if (local) {
42
+ let hosts = local.length > 0 ? local.join('\n') : '获取失败……'
43
+ message.push(`内网地址:\n` + hosts)
44
+ }
45
+ if (remote) {
46
+ let hosts = remote.length > 0 ? remote.join('\n') : '获取失败……'
47
+ message.push(`外网地址:\n` + hosts)
48
+ }
49
+ message.push(`临时令牌3分钟内有效(请勿轻易告知他人哦),使用过后会立即失效,若登录成功将会在使用者的浏览器上生成个24小时内有效的令牌,过期后需要重新登录~`)
50
+ return this.reply(await makeForwardMsg(this.e, message))
51
+ }
52
+
53
+ }
Yunzai/plugins/Guoba-Plugin/apps/update.js ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import YAML from 'yaml'
2
+ import fetch from 'node-fetch'
3
+ import {exec} from 'child_process'
4
+ import {cfg, _paths, _version, Constant} from '#guoba.platform'
5
+ import {sendToMaster} from '#guoba.utils'
6
+ import {compareVersions} from '#guoba.libs'
7
+
8
+ const _STATUS = {
9
+ FAIL: 'FAIL',
10
+ SUCCESS: 'SUCCESS',
11
+ CANCEL: 'CANCEL',
12
+ NO_UPDATE: 'NO_UPDATE',
13
+ HAS_UPDATE: 'HAS_UPDATE',
14
+ GIT_NO_UPDATE: 'GIT_NO_UPDATE',
15
+ }
16
+
17
+ let isChecked = false
18
+
19
+ /**
20
+ * 锅巴更新
21
+ */
22
+ export class GuobaUpdate extends plugin {
23
+ constructor(e) {
24
+ super({
25
+ name: '锅巴更新',
26
+ dsc: '锅巴更新、升级',
27
+ event: 'message',
28
+ priority: 100,
29
+ rule: [
30
+ {
31
+ reg: '^#锅巴版本$',
32
+ fnc: 'getVersion',
33
+ },
34
+ {
35
+ reg: '^#锅巴(强制)?(更新|升级|update)$',
36
+ fnc: 'doUpdate',
37
+ permission: 'master',
38
+ },
39
+ ],
40
+ })
41
+ // 创建定时任务
42
+ this.task = {
43
+ // 每天的凌晨4点执行
44
+ cron: '0 0 4 * * ?',
45
+ name: '锅巴自动更新任务',
46
+ fnc: this.doUpdateTask.bind(this),
47
+ }
48
+ // 立即执行一次检查更新
49
+ if (!isChecked) {
50
+ isChecked = true
51
+ setTimeout(this.doCheckUpdate.bind(this, true), 1500)
52
+ }
53
+ }
54
+
55
+ async getVersion() {
56
+ return this.reply(`[Guoba] 当前版本:${_version}`)
57
+ }
58
+
59
+ async doUpdate() {
60
+ let isForce = this.e.msg.includes('强制')
61
+ let response
62
+ if (!isForce) {
63
+ this.reply(`[Guoba] 正在检查更新,请稍候……`)
64
+ response = await this.doAutoUpdate()
65
+ } else {
66
+ this.reply(`[Guoba] 正在检查强制更新,请稍候……`)
67
+ response = await this.doGitPull(true)
68
+ }
69
+ let {status, message} = response
70
+ if (status === _STATUS.NO_UPDATE || status === _STATUS.GIT_NO_UPDATE) {
71
+ return this.reply(`[Guoba] 已经是最新版本啦`)
72
+ } else if (status === _STATUS.SUCCESS) {
73
+ return this.reply(`[Guoba] ${message}`)
74
+ } else {
75
+ if (message) {
76
+ return this.reply(`[Guoba] 更新失败!\n${message}`)
77
+ }
78
+ logger.error(`[Guoba] 更新失败:`, {status, message})
79
+ return this.reply(`[Guoba] 更新失败…… 请查看日志获取更多信息`)
80
+ }
81
+ }
82
+
83
+ // 是否允许检查更新
84
+ get allowCheckUpdate() {
85
+ return cfg.get('base.checkUpdate') === true
86
+ }
87
+
88
+ async doUpdateTask() {
89
+ if (!this.allowCheckUpdate) {
90
+ return
91
+ }
92
+ logger.mark(`[Guoba] 开始执行自动更新任务……`)
93
+ const {status, remote, message} = await this.doAutoUpdate(true)
94
+ if (status === _STATUS.CANCEL) {
95
+ logger.mark(`[Guoba] 自动更新任务执行完毕,没有发现新版本`)
96
+ } else if (status === _STATUS.NO_UPDATE) {
97
+ logger.mark(`[Guoba] 自动更新任务执行完毕,没有发现新版本`)
98
+ } else if (status === _STATUS.SUCCESS) {
99
+ let msg = `[Guoba] 自动${message}`
100
+ if (remote.needRestart) {
101
+ logger.mark(`[Guoba] 自动更新任务执行完毕,需要重启才能生效`)
102
+ } else {
103
+ logger.mark(`[Guoba] 自动更新任务执行完毕,无需重启即可生效`)
104
+ }
105
+ return sendToMaster(msg)
106
+ } else {
107
+ logger.mark(`[Guoba] 自动更新任务执行完毕,更新失败:`, {status, message})
108
+ }
109
+ }
110
+
111
+ async doAutoUpdate(isTask = false) {
112
+ let response = await this.doCheckUpdate()
113
+ let {status, remote} = response
114
+ if (status === _STATUS.NO_UPDATE || status === _STATUS.CANCEL) {
115
+ return response
116
+ }
117
+ // 需要重启的,自动更新模式下不进行git pull
118
+ if (remote.needRestart && isTask) {
119
+ return {
120
+ status: _STATUS.SUCCESS,
121
+ remote,
122
+ message: '检查更新发现新版本,但是需要重启,本次不进行自动升级,请手动升级~'
123
+ }
124
+ }
125
+ // 不是最新版本,执行git pull更新
126
+ response = await this.doGitPull()
127
+ status = response.status
128
+ if (status === _STATUS.GIT_NO_UPDATE) {
129
+ return {status: _STATUS.NO_UPDATE, remote}
130
+ }
131
+ // 更新成功
132
+ if (status === _STATUS.SUCCESS) {
133
+ // needRestart 的意思是需要重启云崽
134
+ // false即不需要重启云崽,可直接重载锅巴服务
135
+ // true即需要重启云崽,此时重载锅巴服务可能会出错,故不重载锅巴服务
136
+ if (!remote.needRestart) {
137
+ Guoba && Guoba.reload && Guoba.reload()
138
+ }
139
+ const restartMsg = '本次更新' + (remote.needRestart ? '需要重启才能生效' : '无需重启即可生效')
140
+ const message = `更新成功,当前版本:${remote.version}\n${restartMsg},更新日志:\n`
141
+ + remote.updateLogs.map((log, index) => `${index + 1}. ${log}`).join('\n')
142
+ return {status: _STATUS.SUCCESS, remote, message}
143
+ }
144
+ return {...response, remote}
145
+ }
146
+
147
+ /**
148
+ * 检查更新
149
+ * @param tell 是否给master发送消息
150
+ */
151
+ async doCheckUpdate(tell = false) {
152
+ if (!this.allowCheckUpdate) {
153
+ return {status: _STATUS.CANCEL, message: '已取消'}
154
+ }
155
+ const remotes = await this.getRemoteVersion()
156
+ if (!remotes || !remotes[0]) {
157
+ return {status: _STATUS.FAIL, message: '获取远程版本信息失败'}
158
+ }
159
+ const remote = remotes[0]
160
+ // 判断远程版本是否小于等于本地版本
161
+ if (compareVersions.compare(remote.version, _version, '<=')) {
162
+ return {status: _STATUS.NO_UPDATE, remote}
163
+ }
164
+ // 判断是否已提醒过
165
+ const checkUpdateRedisKey = Constant.REDIS_PREFIX + 'check-update-version'
166
+ const checkVersion = await redis.get(checkUpdateRedisKey)
167
+ // 一个版本只提醒一次
168
+ if (remote.version !== checkVersion) {
169
+ tell && sendToMaster(`[Guoba] 发现新版本:${remote.version},请发送“#锅巴更新”进行更新`)
170
+ }
171
+ // 判断是否需要重启,不仅要判断当前远程版本,还要判断最近一次需要重启的远程版本是否大于本地版本
172
+ for (let item of remotes) {
173
+ if (!item.needRestart) continue
174
+ if (compareVersions.compare(item.version, _version, '>')) {
175
+ remote.needRestart = true
176
+ break
177
+ }
178
+ }
179
+ await redis.set(checkUpdateRedisKey, remote.version)
180
+ return {status: _STATUS.HAS_UPDATE, remote}
181
+ }
182
+
183
+ /**
184
+ * 获取远程版本信息
185
+ * @return {Promise<{
186
+ * version: string,
187
+ * needRestart: boolean,
188
+ * releaseTime: string,
189
+ * updateLogs: string[],
190
+ * }[]>}
191
+ */
192
+ async getRemoteVersion() {
193
+ let url = 'https://gitee.com/guoba-yunzai/resources/raw/master/yaml/version.yaml'
194
+ let response = await fetch(url)
195
+ if (response.status !== 200) {
196
+ logger.warn(`[Guoba] 获取最新版本信息失败,status: ${response.status}`)
197
+ return null
198
+ }
199
+ let rawText = await response.text()
200
+ try {
201
+ return YAML.parse(rawText)
202
+ } catch (e) {
203
+ logger.error(`[Guoba] 解析最新版本信息失败`)
204
+ console.error(e)
205
+ return null
206
+ }
207
+ }
208
+
209
+ /**
210
+ * 执行git pull更新
211
+ * @param isForce 是否强制更新
212
+ * @return {Promise<{status: number, message: string}>}
213
+ */
214
+ doGitPull(isForce = false) {
215
+ return new Promise((resolve) => {
216
+ let command = 'git pull'
217
+ if (isForce) {
218
+ command = 'git checkout . && git pull'
219
+ } else {
220
+ }
221
+ exec(command, {cwd: _paths.pluginRoot}, function (error, stdout, stderr) {
222
+ if (error) {
223
+ let message = 'Error code: ' + error.code + '\n' + error.stack + '\n 请稍后重试。'
224
+ resolve({status: _STATUS.FAIL, message})
225
+ return
226
+ }
227
+ if (/Already up[ -]to[ -]date/.test(stdout)) {
228
+ resolve({status: _STATUS.GIT_NO_UPDATE})
229
+ return
230
+ }
231
+ resolve({
232
+ status: _STATUS.SUCCESS,
233
+ message: '更新成功' + (isForce ? ',由于是强制更新,本次更新需要重启才能生效' : '')
234
+ });
235
+ })
236
+ })
237
+ }
238
+ }
Yunzai/plugins/Guoba-Plugin/apps/v2-adapter.js ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import lodash from 'lodash'
2
+ import {v2Apps} from '../utils/adapter/loadV2.js'
3
+
4
+ /**
5
+ * 锅巴兼容V2
6
+ */
7
+ export class GuobaV2Adapter extends plugin {
8
+ constructor(e) {
9
+ super({
10
+ name: '锅巴:兼容V2',
11
+ dsc: '兼容V2的单JS插件',
12
+ event: 'message',
13
+ priority: 0,
14
+ rule: [],
15
+ // log: false,
16
+ })
17
+ }
18
+
19
+ async accept(e) {
20
+ for (const v2App of v2Apps) {
21
+ let noCheck = !v2App.reg || v2App.reg === 'noCheck'
22
+ let doLog = () => logger.mark(`[Guoba_V2][${v2App.key}] ${lodash.truncate(e.msg, {length: 12})}`)
23
+ if (noCheck || new RegExp(v2App.reg, 'i').test(e.msg)) {
24
+ noCheck || doLog()
25
+ let res = await v2App.handler(e)
26
+ if (res) {
27
+ noCheck && doLog()
28
+ return 'return'
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+ }
Yunzai/plugins/Guoba-Plugin/components/Changelog.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fs from 'fs'
2
+ import path from 'path'
3
+ import lodash from 'lodash'
4
+ import {_paths} from '#guoba.platform'
5
+
6
+ const _logPath = path.join(_paths.pluginRoot, 'CHANGELOG.md')
7
+
8
+ let logs = {}
9
+ let changelogs = []
10
+ let currentVersion
11
+ let versionCount = 4
12
+
13
+ const getLine = function (line) {
14
+ line = line.replace(/(^\s*\*|\r)/g, '')
15
+ line = line.replace(/\s*`([^`]+`)/g, '<span class="cmd">$1')
16
+ line = line.replace(/`\s*/g, '</span>')
17
+ line = line.replace(/\s*\*\*([^\*]+\*\*)/g, '<span class="strong">$1')
18
+ line = line.replace(/\*\*\s*/g, '</span>')
19
+ line = line.replace(/ⁿᵉʷ/g, '<span class="new"></span>')
20
+ return line
21
+ }
22
+
23
+ try {
24
+ if (fs.existsSync(_logPath)) {
25
+ logs = fs.readFileSync(_logPath, 'utf8') || ''
26
+ logs = logs.split('\n')
27
+
28
+ let temp = {}
29
+ let lastLine = {}
30
+ lodash.forEach(logs, (line) => {
31
+ if (versionCount <= -1) {
32
+ return false
33
+ }
34
+ let versionRet = /^#\s*([0-9\\.~\s]+?)\s*$/.exec(line)
35
+ if (versionRet && versionRet[1]) {
36
+ let v = versionRet[1].trim()
37
+ if (!currentVersion) {
38
+ currentVersion = v
39
+ } else {
40
+ changelogs.push(temp)
41
+ if (/0\s*$/.test(v) && versionCount > 0) {
42
+ versionCount = 0
43
+ } else {
44
+ versionCount--
45
+ }
46
+ }
47
+
48
+ temp = {
49
+ version: v,
50
+ logs: [],
51
+ }
52
+ } else {
53
+ if (!line.trim()) {
54
+ return
55
+ }
56
+ if (/^\*/.test(line)) {
57
+ lastLine = {
58
+ title: getLine(line),
59
+ logs: [],
60
+ }
61
+ temp.logs.push(lastLine)
62
+ } else if (/^\s{2,}\*/.test(line)) {
63
+ lastLine.logs.push(getLine(line))
64
+ }
65
+ }
66
+ })
67
+ }
68
+ } catch (e) {
69
+ // do nth
70
+ }
71
+
72
+ export {currentVersion, changelogs}
Yunzai/plugins/Guoba-Plugin/config/application.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 基础设置
2
+ base:
3
+ # 获取天气的城市
4
+ city: 北京
5
+ guide: false
6
+ # 是否要自动检查更新
7
+ checkUpdate: true
8
+
9
+ # 服务器配置
10
+ server:
11
+ # 启动地址(仅用于控制台输出)
12
+ # auto 为自动获取IP地址
13
+ host: auto
14
+ # 启动端口号
15
+ port: 7860
16
+ # 是否需要拼接端口号
17
+ splicePort: true
18
+ # 网站ICP备案号
19
+ ICPNo: ''
20
+
21
+ # jwt配置
22
+ jwt:
23
+ # JWT 秘钥(随机生成,非必要请勿修改!)
24
+ secret: "1z9echota10kq3vda2mu7s1fd4n8o8uo"
Yunzai/plugins/Guoba-Plugin/defSet/application.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 基础设置
2
+ base:
3
+ # 获取天气的城市
4
+ city: 北京
5
+ guide: true
6
+ # 是否要自动检查更新
7
+ checkUpdate: true
8
+
9
+ # 服务器配置
10
+ server:
11
+ # 启动地址(仅用于控制台输出)
12
+ # auto 为自动获取IP地址
13
+ host: auto
14
+ # 启动端口号
15
+ port: 50831
16
+ # 是否需要拼接端口号
17
+ splicePort: true
18
+ # 网站ICP备案号
19
+ ICPNo: ''
20
+
21
+ # jwt配置
22
+ jwt:
23
+ # JWT 秘钥(随机生成,非必要请勿修改!)
24
+ secret: ""
Yunzai/plugins/Guoba-Plugin/framework/README.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ ## Guoba Framework 说明
2
+
3
+ * nodejs 后端开发框架
4
+ * 基于 express 框架
5
+ * 写法及命名参考 spring boot
Yunzai/plugins/Guoba-Plugin/framework/index.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* -------------- 公共常量 -------------- */
2
+
3
+ /* -------------- 公共组件 -------------- */
4
+ export {autowired, instancesMap} from './src/helper/injection.js';
5
+ export {default as Result} from './src/components/Result.js';
6
+ export {default as Pager} from './src/components/Pager.js'
7
+ export {default as YamlReader} from './src/components/YamlReader.js'
8
+ export {default as GuobaError} from './src/components/GuobaError.js'
9
+
10
+ /* -------------- 框架核心 -------------- */
11
+ export {default as Service} from './src/core/Service.js'
12
+ export {default as Preload} from './src/core/Preload.js'
13
+ export {default as Controller} from './src/core/Controller.js'
14
+ export {default as RestController} from './src/core/RestController.js'
15
+ export {default as Decorator} from './src/core/Decorator.js'
16
+ export {default as Interceptor} from './src/core/Interceptor.js'
17
+ export {default as GuobaApplication} from './src/GuobaApplication.js'
Yunzai/plugins/Guoba-Plugin/framework/src/GuobaApplication.js ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import express from 'express'
2
+ import {useHelper} from './loader/loadHelper.js'
3
+ import {usePreload} from './loader/loadPreload.js'
4
+ import {useDecorator} from "./loader/loadDecorator.js";
5
+ import {useComponents} from './loader/loadComponents.js'
6
+
7
+ /**
8
+ * @typedef PreloadType
9
+ * @property {Function} hook 预加载文件路径
10
+ * @property {String} path 预加载文件路径
11
+ * @property {String} code 预加载代码
12
+ * @property {String} staticPath 静态资源路径
13
+ */
14
+
15
+ /**
16
+ * @typedef DecoratorType
17
+ * @property {String} path 装饰器路径
18
+ * @property {*[]} args 参数
19
+ */
20
+
21
+ /**
22
+ * @typedef GuobaAppArgs
23
+ * @property {Boolean} hotReload TODO 是否热加载
24
+ * @property {Number} port 服务端口
25
+ * @property {String} basePath 项目根路径
26
+ * @property {String} staticPath 静态资源路径
27
+ * @property {String[]} componentPaths 组件路径 - 包括 controller、service等
28
+ * @property {PreloadType[]} preloads 预加载配置
29
+ * @property {DecoratorType[]} decorators 全局预设装饰器
30
+ * @property {Object<String, Function>} overrides 重新默认逻辑
31
+ *
32
+ */
33
+
34
+ /**
35
+ * Guoba Application
36
+ * @class GuobaApplication
37
+ */
38
+ export default class GuobaApplication {
39
+
40
+ /** @type GuobaAppArgs */
41
+ _args
42
+ /** @type Express */
43
+ app
44
+ /** @type http.Server */
45
+ server
46
+
47
+ /**
48
+ * 启动应用
49
+ * @param {GuobaAppArgs} args 应用配置
50
+ * @returns {GuobaApplication}
51
+ */
52
+ static async run(args) {
53
+ const app = express()
54
+ const server = await getListenFn(args)(app, args.port);
55
+ const application = new GuobaApplication(args, app, server);
56
+
57
+ // 预加载
58
+ await usePreload(app, args);
59
+ // 辅助工具
60
+ useHelper(app, args.staticPath);
61
+ // 预装饰器配置
62
+ app.globalDecorators = await useDecorator(app, args);
63
+ // 加载全部组件
64
+ await useComponents(app, args);
65
+
66
+ return application
67
+ }
68
+
69
+ /**
70
+ * 启动应用
71
+ *
72
+ * @param {GuobaAppArgs} args 应用配置
73
+ * @param app express创建的app
74
+ * @param server app创建监听之后的server
75
+ * @returns {GuobaApplication}
76
+ */
77
+ constructor(args, app, server) {
78
+ this._args = args;
79
+ this.app = app
80
+ this.server = server
81
+ }
82
+
83
+ }
84
+
85
+ /** 获取实际的监听函数 */
86
+ function getListenFn(args) {
87
+ const listen = args?.overrides?.listen;
88
+ if (typeof listen === "function") {
89
+ return listen
90
+ }
91
+ return defaultListen
92
+ }
93
+
94
+ /** 默认的监听函数 */
95
+ function defaultListen(app, port) {
96
+ return app.listen(port)
97
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/components/GuobaError.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** 全局错误处理 */
2
+ export default class GuobaError extends Error {
3
+
4
+ constructor(message) {
5
+ // 允许返回特殊消息,需传递数组,例如 [segment.image()]
6
+ if (Array.isArray(message)) {
7
+ super()
8
+ this._message = message
9
+ } else {
10
+ super(message);
11
+ }
12
+ }
13
+
14
+ get message() {
15
+ return this._message ? this._message : super.message;
16
+ }
17
+
18
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/components/Pager.js ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** 分页器 */
2
+ export default class Pager {
3
+
4
+ constructor(list, pageNum, pageSize) {
5
+ this.$list = list
6
+ this.$pageNum = pageNum
7
+ this.$pageSize = pageSize
8
+ }
9
+
10
+ get pageNum() {
11
+ return this.$pageNum
12
+ }
13
+
14
+ set pageNum(pageNum) {
15
+ this.$pageNum = pageNum
16
+ }
17
+
18
+ get pageSize() {
19
+ return this.$pageSize
20
+ }
21
+
22
+ set pageSize(pageSize) {
23
+ this.$pageSize = pageSize
24
+ }
25
+
26
+ /** 根据当前分页条件,计算出的数据 */
27
+ get records() {
28
+ return [...this.$list].splice(this.offset, this.$pageSize)
29
+ }
30
+
31
+ /** 计算当前分页偏移量 */
32
+ get offset() {
33
+ let current = this.$pageNum
34
+ if (current <= 1) {
35
+ return 0
36
+ }
37
+ return Math.max((current - 1) * this.$pageSize, 0)
38
+ }
39
+
40
+ /** 最大页码 */
41
+ get maxNum() {
42
+ return Math.ceil(this.total / this.$pageSize)
43
+ }
44
+
45
+ /** 总行数 */
46
+ get total() {
47
+ return this.$list.length
48
+ }
49
+
50
+ toJSON() {
51
+ return {
52
+ pageNum: this.$pageNum,
53
+ pageSize: this.$pageSize,
54
+ total: this.total,
55
+ maxNum: this.maxNum,
56
+ records: this.records,
57
+ }
58
+ }
59
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/components/Result.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * 全局返回结果
3
+ *
4
+ * @class
5
+ * @property {Function} ok 成功
6
+ * @property {Function} error 失败
7
+ * @property noLogin 未登录
8
+ * @property noAuth 无权限
9
+ * @property notFound 未找到
10
+ * @property unrealized 尚未实现
11
+ */
12
+ export default class Result {
13
+ constructor(code, result, message, httpStatus = 200) {
14
+ this.code = code
15
+ this.result = result
16
+ this.message = message
17
+ this.httpStatus = httpStatus
18
+ }
19
+
20
+ /** 无返回值 */
21
+ static VOID = Symbol();
22
+ /** 尚未实现错误码 */
23
+ static ERR_CODE_501 = Symbol();
24
+
25
+ /**
26
+ * 成功
27
+ * @static
28
+ * @param result 返回结果
29
+ * @param message 返回消息
30
+ * @returns {Result}
31
+ */
32
+ static ok(result, message = 'ok') {
33
+ return new Result(0, result, message)
34
+ }
35
+
36
+ /**
37
+ * 错误
38
+ * @static
39
+ * @returns {Result}
40
+ */
41
+ static error(...args) {
42
+ switch (args.length) {
43
+ // Result.error(code)
44
+ // Result.error(reason)
45
+ case 1:
46
+ if (typeof args[0] === 'number') {
47
+ return new Result(args[0], {}, 'error')
48
+ } else {
49
+ return new Result(-1, {}, args[0])
50
+ }
51
+ // Result.error(code, reason)
52
+ // Result.error(reason, result)
53
+ // Result.error(reason, httpStatus)
54
+ case 2:
55
+ if (typeof args[0] === 'number') {
56
+ return new Result(args[0], {}, args[1] ?? 'error')
57
+ } else if (typeof args[1] === 'number') {
58
+ return new Result(-1, {}, args[0], args[1])
59
+ } else {
60
+ return new Result(-1, args[1], args[0])
61
+ }
62
+ // Result.error(code, reason, result)
63
+ // Result.error(reason, result, httpStatus)
64
+ case 3:
65
+ if (typeof args[0] === 'number') {
66
+ return new Result(args[0], args[1], args[2])
67
+ } else {
68
+ return new Result(-1, args[0], args[1], args[2])
69
+ }
70
+ // Result.error(code, reason, result, httpStatus)
71
+ case 4:
72
+ return new Result(args[0], args[1], args[2], args[3])
73
+ }
74
+ }
75
+
76
+ /**
77
+ * 尚未登录
78
+ *
79
+ * @returns {Result}
80
+ */
81
+ static noLogin() {
82
+ return new Result(401, null, 'Token失效或尚未登录', 401)
83
+ }
84
+
85
+ /**
86
+ * 尚未授权
87
+ *
88
+ * @returns {Result}
89
+ */
90
+ static noAuth() {
91
+ return new Result(403, null, '没有权限', 403)
92
+ }
93
+
94
+ /**
95
+ * 404未找到
96
+ *
97
+ * @returns {Result}
98
+ */
99
+ static notFound() {
100
+ return new Result(404, null, '404 Not Found', 404)
101
+ }
102
+
103
+ /**
104
+ * 功能尚未实现
105
+ *
106
+ * @returns {Result}
107
+ */
108
+ static unrealized() {
109
+ return new Result(501, null, '该功能在当前版本中尚未实现', 501)
110
+ }
111
+
112
+ get isOk() {
113
+ return this.code === 0
114
+ }
115
+
116
+ toJSON() {
117
+ return {
118
+ ok: this.isOk,
119
+ code: this.code,
120
+ result: this.result,
121
+ message: this.message,
122
+ }
123
+ }
124
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/components/YamlReader.js ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fs from 'fs'
2
+ import YAML from 'yaml'
3
+ import lodash from 'lodash'
4
+ import chokidar from 'chokidar'
5
+
6
+ export default class YamlReader {
7
+
8
+ // 配置文件数字key
9
+ static CONFIG_INTEGER_KEY = 'INTEGER__'
10
+
11
+ /**
12
+ * 读写yaml文件
13
+ *
14
+ * @param yamlPath yaml文件绝对路径
15
+ * @param isWatch 是否监听文件变化
16
+ */
17
+ constructor(yamlPath, isWatch = false) {
18
+ this.yamlPath = yamlPath
19
+ this.isWatch = isWatch
20
+ this.initYaml()
21
+ }
22
+
23
+ initYaml() {
24
+ try {
25
+ // parseDocument 将会保留注释
26
+ this.document = YAML.parseDocument(fs.readFileSync(this.yamlPath, 'utf8'))
27
+ } catch (error) {
28
+ throw error
29
+ }
30
+ if (this.isWatch && !this.watcher) {
31
+ this.watcher = chokidar.watch(this.yamlPath).on('change', () => {
32
+ if (this.isSave) {
33
+ this.isSave = false
34
+ return
35
+ }
36
+ this.initYaml()
37
+ })
38
+ }
39
+ }
40
+
41
+ get jsonData() {
42
+ if (!this.document) {
43
+ return null
44
+ }
45
+ return this.document.toJSON()
46
+ }
47
+
48
+ has(keyPath) {
49
+ return this.document.hasIn(keyPath.split('.'))
50
+ }
51
+
52
+ get(keyPath) {
53
+ return lodash.get(this.jsonData, keyPath)
54
+ }
55
+
56
+ set(keyPath, value) {
57
+ this.document.setIn(keyPath.split('.'), value)
58
+ this.save()
59
+ }
60
+
61
+ delete(keyPath) {
62
+ this.document.deleteIn(keyPath.split('.'))
63
+ this.save()
64
+ }
65
+
66
+ /**
67
+ * 设置 document 的数据并保存(递归式)
68
+ * @param data 要写入的数据
69
+ */
70
+ setData(data) {
71
+ this.setDataRecursion(data, [])
72
+ this.save()
73
+ }
74
+
75
+ /**
76
+ * 递归式设置数据,但不保存
77
+ * @param data
78
+ * @param parentKeys
79
+ */
80
+ setDataRecursion(data, parentKeys) {
81
+ if (Array.isArray(data)) {
82
+ this.document.setIn(this.mapParentKeys(parentKeys), data)
83
+ } else if (typeof data === 'object' && data !== null) {
84
+ for (const [key, value] of Object.entries(data)) {
85
+ this.setDataRecursion(value, parentKeys.concat([key]))
86
+ }
87
+ } else {
88
+ parentKeys = this.mapParentKeys(parentKeys)
89
+ this.document.setIn(parentKeys, data)
90
+ }
91
+ }
92
+
93
+ // 将数字key转为number类型,防止出现引号
94
+ mapParentKeys(parentKeys) {
95
+ return parentKeys.map((k) => {
96
+ if (k.startsWith(YamlReader.CONFIG_INTEGER_KEY)) {
97
+ return Number.parseInt(k.replace(YamlReader.CONFIG_INTEGER_KEY, ''))
98
+ }
99
+ return k
100
+ })
101
+ }
102
+
103
+ // 彻底删除某个key
104
+ deleteKey(keyPath) {
105
+ let keys = keyPath.split('.')
106
+ keys = this.mapParentKeys(keys)
107
+ this.document.deleteIn(keys)
108
+ this.save()
109
+ }
110
+
111
+ // 保存yaml文件,写入文件
112
+ save() {
113
+ this.isSave = true
114
+ let yaml = this.document.toString()
115
+ fs.writeFileSync(this.yamlPath, yaml, 'utf8')
116
+ }
117
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/core/Controller.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * 控制器基类
3
+ */
4
+ export default class Controller {
5
+ constructor(app) {
6
+ this.app = app
7
+ this.created()
8
+ }
9
+
10
+ created() {
11
+ }
12
+
13
+ /** 加载优先级 */
14
+ static priority = 1000
15
+
16
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/core/Decorator.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * 装饰器(伪)基类
3
+ */
4
+ export default class Decorator {
5
+
6
+ constructor(config) {
7
+ this.config = config
8
+ }
9
+
10
+ execute() {
11
+ }
12
+
13
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/core/Interceptor.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * 拦截器基类
3
+ */
4
+ export default class Interceptor {
5
+
6
+ constructor(app) {
7
+ this.app = app
8
+ this.app.use(this.handler.bind(this))
9
+ }
10
+
11
+ handler() {
12
+
13
+ }
14
+
15
+ /** 加载优先级 */
16
+ static priority = 1000
17
+
18
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/core/Preload.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * preload:预加载js
3
+ */
4
+ export default class Preload {
5
+ constructor(app, preloadName, scriptSrc) {
6
+ this.app = app
7
+ this.preloadName = preloadName
8
+ this.scriptSrc = scriptSrc
9
+ this.created()
10
+ }
11
+
12
+ created() {
13
+ }
14
+
15
+ contentCache = null
16
+
17
+ async getPreloadContent() {
18
+ if (this.contentCache) {
19
+ return this.contentCache
20
+ }
21
+ return await this.regenerateContent()
22
+ }
23
+
24
+ async regenerate() {
25
+ this.contentCache = this.regenerateContent();
26
+ }
27
+
28
+ async regenerateContent() {
29
+ this.contentCache = `(function(){try{${await this.generateContent()}}`
30
+ + `catch(e){console.warn('[Guoba] preload "${this.preloadName}" error',e)}})()`
31
+ return this.contentCache
32
+ }
33
+
34
+ createScriptTag() {
35
+ return `<script src="${this.scriptSrc}"></script>`
36
+ }
37
+
38
+ /**
39
+ * 生成预加载内容
40
+ *
41
+ * @returns {Promise<string> | string}
42
+ */
43
+ async generateContent() {
44
+ return '/* TODO: 请重写 generateContent 方法 */'
45
+ }
46
+
47
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/core/RestController.js ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import express from 'express'
2
+ import {Result, GuobaError, Controller} from "../../index.js";
3
+
4
+ const DEFAULT_OPTIONS = {}
5
+
6
+ /**
7
+ * restful控制器基类
8
+ */
9
+ export default class RestController extends Controller {
10
+ /**
11
+ *
12
+ * @param prefix
13
+ * @param app
14
+ * @param options
15
+ */
16
+ constructor(prefix = '/', app, options = {}) {
17
+ super(app)
18
+ this.options = Object.assign({}, DEFAULT_OPTIONS, options)
19
+ // 创建路由
20
+ this.router = express.Router()
21
+ // 注册路由
22
+ this.registerRouters()
23
+ this.app.use(`/api${prefix}`, this.router)
24
+ }
25
+
26
+ /** 注册路由 */
27
+ registerRouters() {
28
+ }
29
+
30
+ all(path, handler, decorators) {
31
+ this.http('all', path, handler, decorators)
32
+ }
33
+
34
+ get(path, handler, decorators) {
35
+ this.http('get', path, handler, decorators)
36
+ }
37
+
38
+ post(path, handler, decorators) {
39
+ this.http('post', path, handler, decorators)
40
+ }
41
+
42
+ put(path, handler, decorators) {
43
+ this.http('put', path, handler, decorators)
44
+ }
45
+
46
+ delete(path, handler, decorators) {
47
+ this.http('delete', path, handler, decorators)
48
+ }
49
+
50
+ /**
51
+ * 处理http请求
52
+ *
53
+ * @param methods 请求方法
54
+ * @param path 请求路径
55
+ * @param handler 请求处理函数
56
+ * @param decorators 伪装饰器(由于现版本node还不支持,所以暂时使用这种方式替代)
57
+ */
58
+ http(methods, path, handler, decorators = []) {
59
+ let isAll = methods === 'all'
60
+ if (!isAll) {
61
+ if (!methods) throw new Error('methods is required')
62
+ methods = Array.isArray(methods) ? methods : [methods]
63
+ methods = methods.map(method => method.toUpperCase())
64
+ }
65
+ this.router.all(path, async (req, res, next) => {
66
+ if (!isAll && !methods.includes(req.method)) {
67
+ return next()
68
+ }
69
+ let result = null
70
+ let isCalled = false
71
+ // ProceedingJoinPoint
72
+ let pjp = {
73
+ proceed: async () => {
74
+ if (!isCalled) {
75
+ try {
76
+ result = await handler.call(this, req, res)
77
+ } catch (e) {
78
+ if (e === Result.ERR_CODE_501) {
79
+ result = Result.unrealized()
80
+ } else if (e instanceof Result) {
81
+ result = e
82
+ } else if (e instanceof GuobaError) {
83
+ result = Result.error(e.message)
84
+ } else {
85
+ console.error(e)
86
+ result = Result.error(e.message || e.toString())
87
+ }
88
+ }
89
+ isCalled = true
90
+ }
91
+ return result
92
+ },
93
+ }
94
+ if (!Array.isArray(decorators)) {
95
+ decorators = []
96
+ }
97
+ if (!Array.isArray(this.app.globalDecorators)) {
98
+ this.app.globalDecorators = []
99
+ }
100
+ // 全局预装饰器
101
+ decorators = [...this.app.globalDecorators, ...decorators]
102
+ // 执行装饰器
103
+ for (const decorator of decorators) {
104
+ let ret = await decorator.execute(pjp, req, res)
105
+ if (ret instanceof Result) {
106
+ isCalled = true
107
+ result = ret
108
+ break
109
+ }
110
+ }
111
+ if (!isCalled) {
112
+ result = await pjp.proceed()
113
+ }
114
+ if (result != null) {
115
+ if (result instanceof Result) {
116
+ res.status(result.httpStatus)
117
+ res.json(result.toJSON())
118
+ } else if (result === Result.VOID) {
119
+ } else {
120
+ res.send(result)
121
+ }
122
+ } else {
123
+ res.send(result)
124
+ }
125
+ })
126
+ }
127
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/core/Service.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * 服务基类
3
+ */
4
+ export default class Service {
5
+ constructor(app) {
6
+ this.app = app
7
+ }
8
+
9
+ static priority = 1000
10
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/helper/injection.js ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export const instancesMap = new Map()
2
+
3
+ const proxyMap = new Map()
4
+
5
+ /**
6
+ * 自动注入
7
+ * @param instanceName
8
+ */
9
+ export function autowired(instanceName) {
10
+ if (!instanceName) {
11
+ throw new Error('instanceName is required')
12
+ }
13
+ if (!proxyMap.has(instanceName)) {
14
+ proxyMap.set(instanceName, createProxy(instanceName))
15
+ }
16
+ return proxyMap.get(instanceName)
17
+ }
18
+
19
+ /**
20
+ * 创建只读代理对象
21
+ * @param instanceName
22
+ */
23
+ function createProxy(instanceName) {
24
+ return new Proxy({}, {
25
+ get(target, propKey) {
26
+ let instance = instancesMap.get(instanceName)
27
+ if (instance) {
28
+ let prop = instance[propKey]
29
+ if (typeof prop === 'function') {
30
+ return prop.bind(instance)
31
+ }
32
+ return prop
33
+ }
34
+ throw new Error(`${instanceName} is not found`)
35
+ },
36
+ })
37
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/loader/loadComponents.js ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import lodash from 'lodash'
2
+ import {Interceptor, Service, Controller, instancesMap} from "../../index.js";
3
+ import {loadClasses, instanceOf} from "../utils/common.js";
4
+
5
+ /**
6
+ * 加载所有组件
7
+ * @param app
8
+ * @param {GuobaAppArgs} args
9
+ * @return {Promise<void>}
10
+ */
11
+ export async function useComponents(app, args) {
12
+ const {componentPaths} = args
13
+ if (!Array.isArray(componentPaths) && componentPaths.length === 0) {
14
+ return
15
+ }
16
+ // 加载所有class
17
+ const classes = {}
18
+ for (const componentPath of componentPaths) {
19
+ await loadClasses(componentPath, Object, classes);
20
+ }
21
+ const entries = Object.entries(classes).sort((a, b) => a[1].priority - b[1].priority)
22
+ // 数组顺序即为加载优先级
23
+ const componentsTypes = [
24
+ // 拦截器
25
+ Interceptor,
26
+ // 服务
27
+ Service,
28
+ // 控制器
29
+ Controller
30
+ ];
31
+ for (const type of componentsTypes) {
32
+ let i = 0
33
+ while (i < entries.length) {
34
+ const [name, clazz] = entries[i];
35
+ if (instanceOf(clazz, type)) {
36
+ instancesMap.set(lodash.camelCase(name), new clazz(app))
37
+ entries.splice(i, 1);
38
+ } else {
39
+ i++
40
+ }
41
+ }
42
+ }
43
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/loader/loadDecorator.js ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import path from "path";
2
+ import chalk from "chalk";
3
+ import Decorator from "../core/Decorator.js";
4
+ import {loadClass} from "../utils/common.js";
5
+
6
+ /**
7
+ * 加载全局装饰器
8
+ * @param app
9
+ * @param {GuobaAppArgs} args
10
+ * @return {Promise<*[]>}
11
+ */
12
+ export async function useDecorator(app, args) {
13
+ const {decorators} = args
14
+ if (!Array.isArray(decorators) || decorators.length === 0) {
15
+ return []
16
+ }
17
+ const instances = []
18
+ for (const item of decorators) {
19
+ const importItem = await loadClass(item.path, Decorator, true);
20
+ if (importItem == null) {
21
+ continue;
22
+ }
23
+ try {
24
+ instances.push(new importItem(...(item.args ?? [])));
25
+ } catch (e) {
26
+ logger.error(`[Guoba] load decorator error: ${chalk.red(path.basename(item.path))}`, e)
27
+ }
28
+ }
29
+ return instances;
30
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/loader/loadHelper.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import express from "express";
2
+ import multer from 'multer'
3
+ import bodyParser from 'body-parser'
4
+
5
+ /**
6
+ * 一些辅助工具
7
+ * @param app
8
+ * @param staticPath
9
+ */
10
+ export function useHelper(app, staticPath) {
11
+ // 静态资源
12
+ app.set('views', staticPath)
13
+ app.use(express.static(staticPath))
14
+ // parse application/json
15
+ app.use(bodyParser.json())
16
+ // 上传文件
17
+ const upload = multer({dest: 'data/upload_tmp/'})
18
+ app.post('*', upload.any(), function (req, res, next) {
19
+ next()
20
+ })
21
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/loader/loadPreload.js ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fs from "fs";
2
+ import path from 'path'
3
+ import chalk from 'chalk'
4
+ import {Preload} from "../../index.js";
5
+ import {loadClass} from "../utils/common.js";
6
+
7
+ /**
8
+ * 依次创建页面预加载
9
+ * @param app
10
+ * @param {GuobaAppArgs} args
11
+ */
12
+ export async function usePreload(app, args) {
13
+ const {preloads} = args
14
+ for (const item of preloads) {
15
+ await hookAppPreloads(app, item)
16
+ }
17
+ }
18
+
19
+ /**
20
+ * @param app
21
+ * @param {PreloadType} preload
22
+ */
23
+ async function hookAppPreloads(app, preload) {
24
+ const importItem = await loadClass(preload.path, Preload, true);
25
+ if (importItem == null) {
26
+ return
27
+ }
28
+ let instance = null
29
+ try {
30
+ // noinspection JSValidateTypes
31
+ instance = new importItem(app)
32
+ } catch (e) {
33
+ logger.error(`[Guoba] load preload error: ${chalk.red(path.basename(preload.path))}`, e)
34
+ return
35
+ }
36
+ const reg = new RegExp('<!--#GUO\\{' + preload.code + '}BA#-->');
37
+ app.use(async (req, res, next) => {
38
+ const flag = await preload.hook(req)
39
+ if (flag) {
40
+ // 替换tag
41
+ const tag = instance.createScriptTag()
42
+ const content = fs.readFileSync(preload.staticPath, 'utf8').replace(reg, tag)
43
+ res.send(content)
44
+ } else if (req.path === instance.scriptSrc) {
45
+ const content = await instance.getPreloadContent()
46
+ res.setHeader('Content-Type', 'text/javascript; charset=utf-8')
47
+ res.send(content)
48
+ } else {
49
+ next();
50
+ }
51
+ })
52
+ }
Yunzai/plugins/Guoba-Plugin/framework/src/utils/common.js ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import chalk from 'chalk'
4
+
5
+ /**
6
+ * 引入 class 资源
7
+ * @param rootPath
8
+ * @param clazz 筛选类
9
+ * @param classes
10
+ */
11
+ export async function loadClasses(rootPath, clazz, classes = {}) {
12
+ let files = readdirRecursiveSync(
13
+ rootPath,
14
+ file => /\.c?js$/.test(file),
15
+ files => files.includes('.ignored_loader')
16
+ );
17
+ for (let filePath of files) {
18
+ const tempClasses = await loadClass(filePath, clazz);
19
+ Object.assign(classes, tempClasses);
20
+ }
21
+ return classes
22
+ }
23
+
24
+ /**
25
+ *
26
+ * @param filePath
27
+ * @param clazz
28
+ * @param onlyDefault? 是否只处理 default
29
+ * @return Promise<*>
30
+ */
31
+ export async function loadClass(filePath, clazz, onlyDefault = false) {
32
+ const classes = {}
33
+ try {
34
+ let app = await import('file://' + filePath + '?' + Date.now())
35
+ // 可一次性导入多个类
36
+ for (const [key, value] of Object.entries(app)) {
37
+ if (instanceOf(value, clazz)) {
38
+ if (key === 'default' && onlyDefault) {
39
+ return value;
40
+ }
41
+ let name = key
42
+ if (name === 'default' && value?.name) {
43
+ name = value.name
44
+ }
45
+ classes[name] = value
46
+ }
47
+ }
48
+ } catch (e) {
49
+ logger.error(`[Guoba] loadClasses error: ${chalk.red(path.basename(filePath))}`, e)
50
+ }
51
+ if (onlyDefault) {
52
+ return null
53
+ }
54
+ return classes;
55
+ }
56
+
57
+ /**
58
+ * 获取某个目录下的所有文件(返回的是绝对路径)
59
+ *
60
+ * @param rootPath
61
+ * @param include 文件名过滤器
62
+ * @param exclude 排除器
63
+ */
64
+ export function readdirRecursiveSync(rootPath, include = () => true, exclude = () => false) {
65
+ let files = fs.readdirSync(rootPath)
66
+ if (exclude(files)) {
67
+ return []
68
+ }
69
+ let ret = []
70
+ for (let file of files) {
71
+ let filePath = path.join(rootPath, file)
72
+ let stat = fs.statSync(filePath)
73
+ if (stat.isDirectory()) {
74
+ ret = ret.concat(readdirRecursiveSync(filePath, include, exclude));
75
+ } else if (include(file)) {
76
+ ret.push(filePath)
77
+ }
78
+ }
79
+ return ret
80
+ }
81
+
82
+ /**
83
+ * 判断是否是某个类的实例或继承类
84
+ *
85
+ * @param obj
86
+ * @param clazz
87
+ */
88
+ export function instanceOf(obj, clazz) {
89
+ if (obj instanceof clazz) {
90
+ return true
91
+ } else if (obj?.prototype) {
92
+ return instanceOf(obj.prototype, clazz)
93
+ }
94
+ return false
95
+ }
Yunzai/plugins/Guoba-Plugin/guoba.support.js ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import path from 'path'
2
+ import lodash from 'lodash'
3
+ import {cfg, _paths} from "#guoba.platform";
4
+
5
+ // 支持锅巴
6
+ export function supportGuoba() {
7
+ return {
8
+ // 插件信息,将会显示在前端页面
9
+ // 如果你的插件没有在插件库里,那么需要填上补充信息
10
+ // 如果存在的话,那么填不填就无所谓了,填了就以你的信息为准
11
+ pluginInfo: {
12
+ name: 'guoba-plugin',
13
+ title: 'Guoba-Plugin',
14
+ author: '@zolay-poi',
15
+ authorLink: 'https://github.com/zolay-poi',
16
+ link: 'https://github.com/guoba-yunzai/guoba-plugin',
17
+ isV3: true,
18
+ isV2: false,
19
+ description: '主要提供后台管理界面',
20
+ // 显示图标,此为个性化配置
21
+ // 图标可在 https://icon-sets.iconify.design 这里进行搜索
22
+ icon: 'mdi:stove',
23
+ // 图标颜色,例:#FF0000 或 rgb(255, 0, 0)
24
+ iconColor: '#d19f56',
25
+ // 如果想要显示成图片,也可以填写图标路径(绝对路径)
26
+ iconPath: path.join(_paths.pluginRoot, 'resources/images/icon.png'),
27
+ },
28
+ // 配置项信息
29
+ configInfo: {
30
+ // 配置项 schemas
31
+ schemas: [
32
+ {
33
+ field: 'base.checkUpdate',
34
+ label: '检查更新',
35
+ helpMessage: '启动时和每天凌晨4点自动检查更新,并发送消息提醒(每个版本只提醒一次)',
36
+ bottomHelpMessage: '是否自动检查更新,并发送消息提醒',
37
+ component: 'Switch',
38
+ },
39
+ // {
40
+ // field: 'base.city',
41
+ // label: '天气城市',
42
+ // helpMessage: '修改后需要刷新页面才能生效',
43
+ // bottomHelpMessage: '配置首页天气显示的城市',
44
+ // // 组件类型,可参考 https://vvbin.cn/doc-next/components/introduction.html
45
+ // // https://antdv.com/components/overview-cn/
46
+ // component: 'Input',
47
+ // required: true,
48
+ // componentProps: {
49
+ // placeholder: '请输入天气城市',
50
+ // },
51
+ // },
52
+ {
53
+ field: 'server.host',
54
+ label: '服务器地址',
55
+ bottomHelpMessage: 'auto 为自动获取本机IP地址,仅用于“#锅巴登录”和控制台中',
56
+ component: 'Input',
57
+ required: true,
58
+ componentProps: {
59
+ placeholder: '请输入服务器地址',
60
+ },
61
+ },
62
+ {
63
+ field: 'server.port',
64
+ label: '监听端口号',
65
+ helpMessage: '修改后需要重启才能生效',
66
+ bottomHelpMessage: '如果不想要端口号,请输入 80',
67
+ component: 'InputNumber',
68
+ required: true,
69
+ componentProps: {
70
+ min: 1,
71
+ max: 65535,
72
+ placeholder: '请输入监听端口号',
73
+ },
74
+ },
75
+ {
76
+ field: 'server.splicePort',
77
+ label: '拼接端口号',
78
+ bottomHelpMessage: '是否需要在服务器地址后拼接端口号',
79
+ component: 'Switch',
80
+ },
81
+ // {
82
+ // field: 'server.showAllIp',
83
+ // label: '显示所有IP',
84
+ // bottomHelpMessage: '当host为auto时,是否在使用"#锅巴登录"时显示所有IP地址',
85
+ // component: 'Switch',
86
+ // },
87
+ {
88
+ field: 'server.ICPNo',
89
+ label: 'ICP备案号',
90
+ helpMessage: '如果要将网站放到公网上使用「域名」访问,则需要填写备案号,否则可能会面临被禁止访问的风险!',
91
+ bottomHelpMessage: '填写你的域名ICP备案号,会显示在页面底部',
92
+ component: 'Input',
93
+ componentProps: {
94
+ placeholder: '请输入ICP备案号',
95
+ },
96
+ },
97
+ ],
98
+ // 获取配置数据方法(用于前端填充显示数据)
99
+ getConfigData() {
100
+ let config = lodash.omit(cfg.merged, 'jwt')
101
+ let host = lodash.get(config, 'server.host')
102
+ if (Array.isArray(host)) {
103
+ lodash.set(config, 'server.host', host[0])
104
+ }
105
+ return config
106
+ },
107
+ // 设置配置的方法(前端点确定后调用的方法)
108
+ setConfigData(data, {Result}) {
109
+ let config = {}
110
+ for (let [keyPath, value] of Object.entries(data)) {
111
+ // 特殊处理 server.host
112
+ if (keyPath === 'server.host') {
113
+ let host = cfg.get('server.host')
114
+ if (Array.isArray(host)) {
115
+ host[0] = value
116
+ value = host
117
+ }
118
+ }
119
+ lodash.set(config, keyPath, value)
120
+ }
121
+ config = lodash.merge({}, cfg.merged, config)
122
+ cfg.config.reader.setData(config)
123
+ return Result.ok({}, '保存成功~')
124
+ },
125
+ },
126
+ }
127
+ }
Yunzai/plugins/Guoba-Plugin/index.js ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ if (!global.segment) {
2
+ global.segment = (await import("oicq")).segment
3
+ }
4
+ import {isV3} from '#guoba.utils'
5
+ import {checkPackage} from './utils/adapter/check.js'
6
+ import {createImport, GI, GID} from './utils/guobaImport.js'
7
+
8
+ let passed = await checkPackage()
9
+
10
+ if (!passed) {
11
+ throw 'Missing necessary dependencies'
12
+ }
13
+
14
+ global.Guoba = {GI, GID, createImport}
15
+
16
+ const apps = {}, rule = {}
17
+
18
+ let appRouter = null
19
+
20
+ if (isV3) {
21
+ await (await import('./utils/adapter/initV3.js')).init(apps)
22
+ } else {
23
+ appRouter = await (await import('./utils/adapter/initV2.js')).init(rule)
24
+ }
25
+
26
+ export {apps, rule, appRouter}
Yunzai/plugins/Guoba-Plugin/lib/compareVersions.js ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * 版本号对比器
3
+ * 仓库地址:https://github.com/omichelsen/compare-versions
4
+ *
5
+ * Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
6
+ * This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
7
+ * @param v1 - First version to compare
8
+ * @param v2 - Second version to compare
9
+ * @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
10
+ */
11
+ export function compareVersions(v1, v2) {
12
+ // validate input and split into segments
13
+ const n1 = validateAndParse(v1)
14
+ const n2 = validateAndParse(v2)
15
+
16
+ // pop off the patch
17
+ const p1 = n1.pop()
18
+ const p2 = n2.pop()
19
+
20
+ // validate numbers
21
+ const r = compareSegments(n1, n2)
22
+ if (r !== 0) return r
23
+
24
+ // validate pre-release
25
+ if (p1 && p2) {
26
+ return compareSegments(p1.split('.'), p2.split('.'))
27
+ } else if (p1 || p2) {
28
+ return p1 ? -1 : 1
29
+ }
30
+
31
+ return 0
32
+ }
33
+
34
+ const semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i
35
+
36
+ /**
37
+ * Validate [semver](https://semver.org/) version strings.
38
+ *
39
+ * @param version Version number to validate
40
+ * @returns `true` if the version number is a valid semver version number, `false` otherwise.
41
+ *
42
+ * @example
43
+ * ```
44
+ * validate('1.0.0-rc.1'); // return true
45
+ * validate('1.0-rc.1'); // return false
46
+ * validate('foo'); // return false
47
+ * ```
48
+ */
49
+ export const validate = (version) => typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version)
50
+
51
+ /**
52
+ * Allowed arithmetic operators
53
+ */
54
+ // export type CompareOperator = '>' | '>=' | '=' | '<' | '<='
55
+
56
+ /**
57
+ * Compare [semver](https://semver.org/) version strings using the specified operator.
58
+ *
59
+ * @param v1 First version to compare
60
+ * @param v2 Second version to compare
61
+ * @param operator Allowed arithmetic operator to use
62
+ * @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
63
+ *
64
+ * @example
65
+ * ```
66
+ * compare('10.1.8', '10.0.4', '>'); // return true
67
+ * compare('10.0.1', '10.0.1', '='); // return true
68
+ * compare('10.1.1', '10.2.2', '<'); // return true
69
+ * compare('10.1.1', '10.2.2', '<='); // return true
70
+ * compare('10.1.1', '10.2.2', '>='); // return false
71
+ * ```
72
+ */
73
+ export const compare = (v1, v2, operator) => {
74
+ // validate input operator
75
+ assertValidOperator(operator)
76
+
77
+ // since result of compareVersions can only be -1 or 0 or 1
78
+ // a simple map can be used to replace switch
79
+ const res = compareVersions(v1, v2)
80
+
81
+ return operatorResMap[operator].includes(res)
82
+ }
83
+
84
+ /**
85
+ * Match [npm semver](https://docs.npmjs.com/cli/v6/using-npm/semver) version range.
86
+ *
87
+ * @param version Version number to match
88
+ * @param range Range pattern for version
89
+ * @returns `true` if the version number is within the range, `false` otherwise.
90
+ *
91
+ * @example
92
+ * ```
93
+ * satisfies('1.1.0', '^1.0.0'); // return true
94
+ * satisfies('1.1.0', '~1.0.0'); // return false
95
+ * ```
96
+ */
97
+ export const satisfies = (version, range) => {
98
+ // if no range operator then "="
99
+ const m = range.match(/^([<>=~^]+)/)
100
+ const op = m ? m[1] : '='
101
+
102
+ // if gt/lt/eq then operator compare
103
+ if (op !== '^' && op !== '~')
104
+ return compare(version, range, op,
105
+ )
106
+
107
+ // else range of either "~" or "^" is assumed
108
+ const [v1, v2, v3] = validateAndParse(version)
109
+ const [r1, r2, r3] = validateAndParse(range)
110
+ if (compareStrings(v1, r1) !== 0) return false
111
+ if (op === '^') {
112
+ return compareSegments([v2, v3], [r2, r3]) >= 0
113
+ }
114
+ if (compareStrings(v2, r2) !== 0) return false
115
+ return compareStrings(v3, r3) >= 0
116
+ }
117
+
118
+ const validateAndParse = (version) => {
119
+ if (typeof version !== 'string') {
120
+ throw new TypeError('Invalid argument expected string')
121
+ }
122
+ const match = version.match(semver)
123
+ if (!match) {
124
+ throw new Error(
125
+ `Invalid argument not valid semver ('${version}' received)`,
126
+ )
127
+ }
128
+ match.shift()
129
+ return match
130
+ }
131
+
132
+ const isWildcard = (s) => s === '*' || s === 'x' || s === 'X'
133
+
134
+ const tryParse = (v) => {
135
+ const n = parseInt(v, 10)
136
+ return isNaN(n) ? v : n
137
+ }
138
+
139
+ const forceType = (a, b) => typeof a !== typeof b ? [String(a), String(b)] : [a, b]
140
+
141
+ const compareStrings = (a, b) => {
142
+ if (isWildcard(a) || isWildcard(b)) return 0
143
+ const [ap, bp] = forceType(tryParse(a), tryParse(b))
144
+ if (ap > bp) return 1
145
+ if (ap < bp) return -1
146
+ return 0
147
+ }
148
+
149
+ const compareSegments = (a, b) => {
150
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
151
+ const r = compareStrings(a[i] || '0', b[i] || '0')
152
+ if (r !== 0) return r
153
+ }
154
+ return 0
155
+ }
156
+
157
+ const operatorResMap = {
158
+ '>': [1],
159
+ '>=': [0, 1],
160
+ '=': [0],
161
+ '<=': [-1, 0],
162
+ '<': [-1],
163
+ }
164
+
165
+ const allowedOperators = Object.keys(operatorResMap)
166
+
167
+ const assertValidOperator = (op) => {
168
+ if (typeof op !== 'string') {
169
+ throw new TypeError(
170
+ `Invalid operator type, expected string but got ${typeof op}`,
171
+ )
172
+ }
173
+ if (allowedOperators.indexOf(op) === -1) {
174
+ throw new Error(
175
+ `Invalid operator, expected one of ${allowedOperators.join('|')}`,
176
+ )
177
+ }
178
+ }
Yunzai/plugins/Guoba-Plugin/lib/diskinfo.js ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * diskinfo
3
+ *
4
+ * Returns disk information array for linux and windows
5
+ * Tested on centos and windows vista
6
+ *
7
+ * @author Benoit Gauthier <[email protected]>
8
+ */
9
+
10
+ import os from 'os';
11
+ import util from 'util';
12
+ import {exec} from 'child_process';
13
+
14
+ /**
15
+ * Returns an array of drives or calls callback
16
+ *
17
+ * @param callback A callback function that will receive
18
+ * the array of drives, set null if no callback
19
+ */
20
+ export const getDrivesCallback = function(callback) {
21
+ var aDrives = [];
22
+
23
+ switch (os.platform().toLowerCase()) {
24
+ case 'win32':
25
+
26
+ // Windows 32
27
+ // Tested on Vista
28
+
29
+ // Run command to get list of drives
30
+ var oProcess = exec(
31
+ 'wmic logicaldisk get VolumeName,Caption,FreeSpace,Size,VolumeSerialNumber,Description /format:list',
32
+ {
33
+ encoding: 'buffer',
34
+ windowsHide: true,
35
+ },
36
+ function (err, stdout, stderr) {
37
+ if (err) return callback(err, null);
38
+ // windows下解决中文乱码问题
39
+ stdout = new TextDecoder('gbk').decode(stdout)
40
+ var aLines = stdout.split('\r\r\n');
41
+ var bNew = false;
42
+ var sCaption = '', sDescription = '', sFreeSpace = '', sSize = '', sVolume = '', sVolumeName = '';
43
+ // For each line get information
44
+ // Format is Key=Value
45
+ for(var i = 0; i < aLines.length; i++) {
46
+ if (aLines[i] != '') {
47
+ var aTokens = aLines[i].split('=');
48
+ switch (aTokens[0]) {
49
+ case 'Caption':
50
+ sCaption = aTokens[1];
51
+ bNew = true;
52
+ break;
53
+ case 'Description':
54
+ sDescription = aTokens[1];
55
+ break;
56
+ case 'FreeSpace':
57
+ sFreeSpace = aTokens[1];
58
+ break;
59
+ case 'Size':
60
+ sSize = aTokens[1];
61
+ break;
62
+ case 'VolumeSerialNumber':
63
+ sVolume = aTokens[1];
64
+ break;
65
+ // 新增卷名
66
+ case 'VolumeName':
67
+ sVolumeName = aTokens[1];
68
+ break;
69
+ }
70
+
71
+ } else {
72
+ // Empty line
73
+ // If we get an empty line and bNew is true then we have retrieved
74
+ // all information for one drive, add to array and reset variables
75
+ if (bNew) {
76
+ sSize = parseFloat(sSize);
77
+ if (isNaN(sSize)) {
78
+ sSize = 0;
79
+ }
80
+ sFreeSpace = parseFloat(sFreeSpace);
81
+ if (isNaN(sFreeSpace)) {
82
+ sFreeSpace = 0;
83
+ }
84
+
85
+ var sUsed = (sSize - sFreeSpace);
86
+ var sPercent = '0%';
87
+ if (sSize != '' && parseFloat(sSize) > 0) {
88
+ sPercent = Math.round((parseFloat(sUsed) / parseFloat(sSize)) * 100) + '%';
89
+ }
90
+ aDrives[aDrives.length] = {
91
+ filesystem: sDescription,
92
+ blocks: sSize,
93
+ used: sUsed,
94
+ available: sFreeSpace,
95
+ capacity: sPercent,
96
+ volumeName: sVolumeName,
97
+ mounted: sCaption
98
+ };
99
+ bNew = false;
100
+ sCaption = ''; sDescription = ''; sFreeSpace = ''; sSize = ''; sVolume = ''; sVolumeName = '';
101
+ }
102
+
103
+ }
104
+ }
105
+ // Check if we have callback
106
+ if (callback != null) {
107
+ callback(null, aDrives);
108
+ }
109
+ return aDrives;
110
+ }
111
+ );
112
+
113
+ break;
114
+
115
+ case 'linux':
116
+ // Linux
117
+ // Tested on CentOS
118
+ default:
119
+
120
+ // Run command to get list of drives
121
+ var oProcess = exec(
122
+ 'df -P | awk \'NR > 1\'',
123
+ function (err, stdout, stderr) {
124
+ if (err) return callback(err, null);
125
+ var aLines = stdout.split('\n');
126
+ // For each line get drive info and add to array
127
+ for(var i = 0; i < aLines.length; i++) {
128
+ var sLine = aLines[i];
129
+ if (sLine != '') {
130
+ sLine = sLine.replace(/ +(?= )/g,'');
131
+ var aTokens = sLine.split(' ');
132
+ aDrives[aDrives.length] = {
133
+ filesystem: aTokens[0],
134
+ blocks: aTokens[1],
135
+ used: aTokens[2],
136
+ available: aTokens[3],
137
+ capacity: aTokens[4],
138
+ mounted: aTokens[5]
139
+ };
140
+
141
+ }
142
+ }
143
+ // Check if we have a callback
144
+ if (callback != null) {
145
+ callback(null, aDrives);
146
+ }
147
+ return aDrives;
148
+ }
149
+ );
150
+
151
+ }
152
+
153
+ }
154
+
155
+ export const getDrives = util.promisify(getDrivesCallback)
Yunzai/plugins/Guoba-Plugin/lib/v2-js/目录说明.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ 1. 本目录用于兼容V2的插件(单JS)
2
+ 2. 将V2的插件放置到本目录下即可。
3
+ 3. 并不能保证完全兼容,有不兼容的写法将会拒绝执行。
4
+ 4. 不支持热部署,新增、修改或删除插件后需要重启。
Yunzai/plugins/Guoba-Plugin/models/libs.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export * as diskInfo from '../lib/diskinfo.js';
2
+ export * as compareVersions from '../lib/compareVersions.js';
Yunzai/plugins/Guoba-Plugin/models/platform.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ export {_paths} from '../utils/paths.js'
2
+ export {_version, pluginName, pluginPackage, yunzaiPackage} from '../utils/package.js';
3
+
4
+ export {default as cfg} from '../utils/cfg.js'
5
+ export {default as Constant} from '../server/constant/Constant.js'
6
+
7
+ /** 安装了哪些插件 */
8
+ export const PluginsMap = new Map()
9
+ /** 哪些插件支持Guoba */
10
+ export const GuobaSupportMap = new Map()
Yunzai/plugins/Guoba-Plugin/models/utils.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ export * from '../utils/common.js';
2
+ export * from '../utils/adapter.js'
3
+ export * from '../utils/package.js'
4
+
5
+ export * as AdapterCheck from '../utils/adapter/check.js';
Yunzai/plugins/Guoba-Plugin/package.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "guoba-plugin",
3
+ "version": "1.2.0-beta.1",
4
+ "description": "Yunzai-Bot插件",
5
+ "type": "module",
6
+ "module": "index.js",
7
+ "main": "index.js",
8
+ "scripts": {
9
+ },
10
+ "imports": {
11
+ "#guoba.platform": "./models/platform.js",
12
+ "#guoba.utils": "./models/utils.js",
13
+ "#guoba.libs": "./models/libs.js",
14
+ "#guoba.framework": "./framework/index.js",
15
+ "#guoba.framework.utils": "./framework/src/utils/common.js"
16
+ },
17
+ "dependencies": {
18
+ "express": "^4.18.1",
19
+ "multer": "^1.4.5-lts.1",
20
+ "body-parser": "^1.20.0",
21
+ "socket.io": "^4.5.1",
22
+ "jsonwebtoken": "^8.5.1"
23
+ },
24
+ "devDependencies": {},
25
+ "keywords": [
26
+ "云崽",
27
+ "原神",
28
+ "Yunzai-Bot",
29
+ "Genshin"
30
+ ],
31
+ "author": "zolay",
32
+ "license": "GPL-3.0-or-later"
33
+ }
Yunzai/plugins/Guoba-Plugin/resources/images/help.jpg ADDED
Yunzai/plugins/Guoba-Plugin/resources/images/icon.png ADDED
Yunzai/plugins/Guoba-Plugin/resources/images/no-miao.png ADDED
Yunzai/plugins/Guoba-Plugin/resources/images/readme/001.png ADDED
Yunzai/plugins/Guoba-Plugin/resources/images/readme/002.png ADDED
Yunzai/plugins/Guoba-Plugin/resources/images/readme/003.png ADDED
Yunzai/plugins/Guoba-Plugin/resources/images/readme/004.png ADDED
Yunzai/plugins/Guoba-Plugin/resources/images/readme/005.png ADDED
Yunzai/plugins/Guoba-Plugin/resources/json/city.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"北京":"101010100","海淀":"101010200","朝阳":"101010300","顺义":"101010400","怀柔":"101010500","通州":"101010600","昌平":"101010700","延庆":"101010800","丰台":"101010900","石景山":"101011000","大兴":"101011100","房山":"101011200","密云":"101011300","门头沟":"101011400","平谷":"101011500","八达岭":"101011600","佛爷顶":"101011700","汤河口":"101011800","密云上甸子":"101011900","斋堂":"101012000","霞云岭":"101012100","上海":"101020100","闵行":"101020200","宝山":"101020300","川沙":"101020400","嘉定":"101020500","南汇":"101020600","金山":"101020700","青浦":"101020800","松江":"101020900","奉贤":"101021000","崇明":"101021100","陈家镇":"101021101","引水船":"101021102","徐家汇":"101021200","浦东":"101021300","天津":"101030100","武清":"101030200","宝坻":"101030300","东丽":"101030400","西青":"101030500","北辰":"101030600","宁河":"101030700","汉沽":"101030800","静海":"101030900","津南":"101031000","塘沽":"101031100","大港":"101031200","平台":"101031300","蓟县":"101031400","重庆":"101040100","永川":"101040200","合川":"101040300","南川":"101040400","江津":"101040500","万盛":"101040600","渝北":"101040700","北碚":"101040800","巴南":"101040900","长寿":"101041000","黔江":"101041100","万州天城":"101041200","万州龙宝":"101041300","涪陵":"101041400","开县":"101041500","城口":"101041600","云阳":"101041700","巫溪":"101041800","奉节":"101041900","巫山":"101042000","潼南":"101042100","垫江":"101042200","梁平":"101042300","忠县":"101042400","石柱":"101042500","大足":"101042600","荣昌":"101042700","铜梁":"101042800","璧山":"101042900","丰都":"101043000","武隆":"101043100","彭水":"101043200","綦江":"101043300","酉阳":"101043400","金佛山":"101043500","秀山":"101043600","沙坪坝":"101043700","哈尔滨":"101050101","双城":"101050102","呼兰":"101050103","阿城":"101050104","宾县":"101050105","依兰":"101050106","巴彦":"101050107","通河":"101050108","方正":"101050109","延寿":"101050110","尚志":"101050111","五常":"101050112","木兰":"101050113","齐齐哈尔":"101050201","讷河":"101050202","龙江":"101050203","甘南":"101050204","富裕":"101050205","依安":"101050206","拜泉":"101050207","克山":"101050208","克东":"101050209","泰来":"101050210","牡丹江":"101050301","海林":"101050302","穆棱":"101050303","林口":"101050304","绥芬河":"101050305","宁安":"101050306","东宁":"101050307","佳木斯":"101050401","汤原":"101050402","抚远":"101050403","桦川":"101050404","桦南":"101050405","同江":"101050406","富锦":"101050407","绥化":"101050501","肇东":"101050502","安达":"101050503","海伦":"101050504","明水":"101050505","望奎":"101050506","兰西":"101050507","青冈":"101050508","庆安":"101050509","绥棱":"101050510","黑河":"101050601","嫩江":"101050602","孙吴":"101050603","逊克":"101050604","五大连池":"101050605","北安":"101050606","大兴安岭":"101050701","塔河":"101050702","漠河":"101050703","呼玛":"101050704","呼中":"101050705","新林":"101050706","阿木尔":"101050707","加格达奇":"101050708","伊春":"101050801","乌伊岭":"101050802","五营":"101050803","铁力":"101050804","嘉荫":"101050805","大庆":"101050901","林甸":"101050902","肇州":"101050903","肇源":"101050904","杜蒙":"101050905","七台河":"101051002","勃利":"101051003","鸡西":"101051101","虎林":"101051102","密山":"101051103","鸡东":"101051104","鹤岗":"101051201","绥滨":"101051202","萝北":"101051203","双鸭山":"101051301","集贤":"101051302","宝清":"101051303","饶河":"101051304","长春":"101060101","农安":"101060102","德惠":"101060103","九台":"101060104","榆树":"101060105","双阳":"101060106","吉林":"101060201","舒兰":"101060202","永吉":"101060203","蛟河":"101060204","磐石":"101060205","桦甸":"101060206","烟筒山":"101060207","延吉":"101060301","敦化":"101060302","安图":"101060303","汪清":"101060304","和龙":"101060305","天池":"101060306","龙井":"101060307","珲春":"101060308","图们":"101060309","罗子沟":"101060311","延边":"101060312","四平":"101060401","双辽":"101060402","梨树":"101060403","公主岭":"101060404","伊通":"101060405","孤家子":"101060406","通化":"101060501","梅河口":"101060502","柳河":"101060503","辉南":"101060504","集安":"101060505","通化县":"101060506","白城":"101060601","洮南":"101060602","大安":"101060603","镇赉":"101060604","通榆":"101060605","辽源":"101060701","东丰":"101060702","松原":"101060801","乾安":"101060802","前郭":"101060803","长岭":"101060804","扶余":"101060805","白山":"101060901","靖宇":"101060902","临江":"101060903","东岗":"101060904","长白":"101060905","沈阳":"101070101","苏家屯":"101070102","辽中":"101070103","康平":"101070104","法库":"101070105","新民":"101070106","于洪":"101070107","新城子":"101070108","大连":"101070201","瓦房店":"101070202","金州":"101070203","普兰店":"101070204","旅顺":"101070205","长海":"101070206","庄河":"101070207","皮口":"101070208","海洋岛":"101070209","鞍山":"101070301","台安":"101070302","岫岩":"101070303","海城":"101070304","抚顺":"101070401","清原":"101070403","章党":"101070404","本溪":"101070501","本溪县":"101070502","草河口":"101070503","桓仁":"101070504","丹东":"101070601","凤城":"101070602","宽甸":"101070603","东港":"101070604","东沟":"101070605","锦州":"101070701","凌海":"101070702","北宁":"101070703","义县":"101070704","黑山":"101070705","北镇":"101070706","营口":"101070801","大石桥":"101070802","盖州":"101070803","阜新":"101070901","彰武":"101070902","辽阳":"101071001","辽阳县":"101071002","灯塔":"101071003","铁岭":"101071101","开原":"101071102","昌图":"101071103","西丰":"101071104","建平":"101071202","凌源":"101071203","喀左":"101071204","北票":"101071205","羊山":"101071206","建平县":"101071207","盘锦":"101071301","大洼":"101071302","盘山":"101071303","葫芦岛":"101071401","建昌":"101071402","绥中":"101071403","兴城":"101071404","呼和浩特":"101080101","土默特左旗":"101080102","托克托":"101080103","和林格尔":"101080104","清水河":"101080105","呼和浩特市郊区":"101080106","武川":"101080107","包头":"101080201","白云鄂博":"101080202","满都拉":"101080203","土默特右旗":"101080204","固阳":"101080205","达尔罕茂明安联合旗":"101080206","石拐":"101080207","乌海":"101080301","集宁":"101080401","卓资":"101080402","化德":"101080403","商都":"101080404","希拉穆仁":"101080405","兴和":"101080406","凉城":"101080407","察哈尔右翼前旗":"101080408","察哈尔右翼中旗":"101080409","察哈尔右翼后旗":"101080410","四子王旗":"101080411","丰镇":"101080412","通辽":"101080501","舍伯吐":"101080502","科尔沁左翼中旗":"101080503","科尔沁左翼后旗":"101080504","青龙山":"101080505","开鲁":"101080506","库伦旗":"101080507","奈曼旗":"101080508","扎鲁特旗":"101080509","高力板":"101080510","巴雅尔吐胡硕":"101080511","通辽钱家店":"101080512","赤峰":"101080601","赤峰郊区站":"101080602","阿鲁科尔沁旗":"101080603","浩尔吐":"101080604","巴林左旗":"101080605","巴林右旗":"101080606","林西":"101080607","克什克腾旗":"101080608","翁牛特旗":"101080609","岗子":"101080610","喀喇沁旗":"101080611","八里罕":"101080612","宁城":"101080613","敖汉旗":"101080614","宝过图":"101080615","鄂尔多斯":"101080701","达拉特旗":"101080703","准格尔旗":"101080704","鄂托克前旗":"101080705","河南":"101080706","伊克乌素":"101080707","鄂托克旗":"101080708","杭锦旗":"101080709","乌审旗":"101080710","伊金霍洛旗":"101080711","乌审召":"101080712","东胜":"101080713","临河":"101080801","五原":"101080802","磴口":"101080803","乌拉特前旗":"101080804","大佘太":"101080805","乌拉特中旗":"101080806","乌拉特后旗":"101080807","海力素":"101080808","那仁宝力格":"101080809","杭锦后旗":"101080810","巴盟农试站":"101080811","锡林浩特":"101080901","朝克乌拉":"101080902","二连浩特":"101080903","阿巴嘎旗":"101080904","伊和郭勒":"101080905","苏尼特左旗":"101080906","苏尼特右旗":"101080907","朱日和":"101080908","东乌珠穆沁旗":"101080909","西乌珠穆沁旗":"101080910","太仆寺旗":"101080911","镶黄旗":"101080912","正镶白旗":"101080913","正兰旗":"101080914","多伦":"101080915","博克图":"101080916","乌拉盖":"101080917","白日乌拉":"101080918","那日图":"101080919","呼伦贝尔":"101081000","海拉尔":"101081001","小二沟":"101081002","阿荣旗":"101081003","莫力达瓦旗":"101081004","鄂伦春旗":"101081005","鄂温克旗":"101081006","陈巴尔虎旗":"101081007","新巴尔虎左旗":"101081008","新巴尔虎右旗":"101081009","满洲里":"101081010","牙克石":"101081011","扎兰屯":"101081012","额尔古纳":"101081014","根河":"101081015","图里河":"101081016","乌兰浩特":"101081101","阿尔山":"101081102","科尔沁右翼中旗":"101081103","胡尔勒":"101081104","扎赉特旗":"101081105","索伦":"101081106","突泉":"101081107","霍林郭勒":"101081108","阿拉善左旗":"101081201","阿拉善右旗":"101081202","额济纳旗":"101081203","拐子湖":"101081204","吉兰太":"101081205","锡林高勒":"101081206","头道湖":"101081207","中泉子":"101081208","巴彦诺尔贡":"101081209","雅布赖":"101081210","乌斯太":"101081211","孪井滩":"101081212","石家庄":"101090101","井陉":"101090102","正定":"101090103","栾城":"101090104","行唐":"101090105","灵寿":"101090106","高邑":"101090107","深泽":"101090108","赞皇":"101090109","无极":"101090110","平山":"101090111","元氏":"101090112","赵县":"101090113","辛集":"101090114","藁城":"101090115","晋洲":"101090116","新乐":"101090117","保定":"101090201","满城":"101090202","阜平":"101090203","徐水":"101090204","唐县":"101090205","高阳":"101090206","容城":"101090207","紫荆关":"101090208","涞源":"101090209","望都":"101090210","安新":"101090211","易县":"101090212","涞水":"101090213","曲阳":"101090214","蠡县":"101090215","顺平":"101090216","雄县":"101090217","涿州":"101090218","定州":"101090219","安国":"101090220","高碑店":"101090221","张家口":"101090301","宣化":"101090302","张北":"101090303","康保":"101090304","沽源":"101090305","尚义":"101090306","蔚县":"101090307","阳原":"101090308","怀安":"101090309","万全":"101090310","怀来":"101090311","涿鹿":"101090312","赤城":"101090313","崇礼":"101090314","承德":"101090402","承德县":"101090403","兴隆":"101090404","平泉":"101090405","滦平":"101090406","隆化":"101090407","丰宁":"101090408","宽城":"101090409","围场":"101090410","塞罕坎":"101090411","唐山":"101090501","丰南":"101090502","丰润":"101090503","滦县":"101090504","滦南":"101090505","乐亭":"101090506","迁西":"101090507","玉田":"101090508","唐海":"101090509","遵化":"101090510","迁安":"101090511","廊坊":"101090601","固安":"101090602","永清":"101090603","香河":"101090604","大城":"101090605","文安":"101090606","大厂":"101090607","霸州":"101090608","三河":"101090609","沧州":"101090701","青县":"101090702","东光":"101090703","海兴":"101090704","盐山":"101090705","肃宁":"101090706","南皮":"101090707","吴桥":"101090708","献县":"101090709","孟村":"101090710","泊头":"101090711","任丘":"101090712","黄骅":"101090713","河间":"101090714","曹妃甸":"101090715","衡水":"101090801","枣强":"101090802","武邑":"101090803","武强":"101090804","饶阳":"101090805","安平":"101090806","故城":"101090807","景县":"101090808","阜城":"101090809","冀州":"101090810","深州":"101090811","邢台":"101090901","临城":"101090902","邢台县浆水":"101090903","内邱":"101090904","柏乡":"101090905","隆尧":"101090906","南和":"101090907","宁晋":"101090908","巨鹿":"101090909","新河":"101090910","广宗":"101090911","平乡":"101090912","威县":"101090913","清河":"101090914","临西":"101090915","南宫":"101090916","沙河":"101090917","任县":"101090918","邯郸":"101091001","峰峰":"101091002","临漳":"101091003","成安":"101091004","大名":"101091005","涉县":"101091006","磁县":"101091007","肥乡":"101091008","永年":"101091009","邱县":"101091010","鸡泽":"101091011","广平":"101091012","馆陶":"101091013","魏县":"101091014","曲周":"101091015","武安":"101091016","秦皇岛":"101091101","青龙":"101091102","昌黎":"101091103","抚宁":"101091104","卢龙":"101091105","北戴河":"101091106","太原":"101100101","清徐":"101100102","阳曲":"101100103","娄烦":"101100104","太原古交区":"101100105","太原北郊":"101100106","太原南郊":"101100107","大同":"101100201","阳高":"101100202","大同县":"101100203","天镇":"101100204","广灵":"101100205","灵邱":"101100206","浑源":"101100207","左云":"101100208","阳泉":"101100301","盂县":"101100302","平定":"101100303","晋中":"101100401","榆次":"101100402","榆社":"101100403","左权":"101100404","和顺":"101100405","昔阳":"101100406","寿阳":"101100407","太谷":"101100408","祁县":"101100409","平遥":"101100410","灵石":"101100411","介休":"101100412","长治":"101100501","黎城":"101100502","屯留":"101100503","潞城":"101100504","襄垣":"101100505","平顺":"101100506","武乡":"101100507","沁县":"101100508","长子":"101100509","沁源":"101100510","壶关":"101100511","晋城":"101100601","沁水":"101100602","阳城":"101100603","陵川":"101100604","高平":"101100605","临汾":"101100701","曲沃":"101100702","永和":"101100703","隰县":"101100704","大宁":"101100705","吉县":"101100706","襄汾":"101100707","蒲县":"101100708","汾西":"101100709","洪洞":"101100710","霍州":"101100711","乡宁":"101100712","翼城":"101100713","侯马":"101100714","浮山":"101100715","安泽":"101100716","古县":"101100717","运城":"101100801","临猗":"101100802","稷山":"101100803","万荣":"101100804","河津":"101100805","新绛":"101100806","绛县":"101100807","闻喜":"101100808","垣曲":"101100809","永济":"101100810","芮城":"101100811","夏县":"101100812","平陆":"101100813","朔州":"101100901","平鲁":"101100902","山阴":"101100903","右玉":"101100904","应县":"101100905","怀仁":"101100906","忻州":"101101001","定襄":"101101002","五台县豆村":"101101003","河曲":"101101004","偏关":"101101005","神池":"101101006","宁武":"101101007","代县":"101101008","繁峙":"101101009","五台山":"101101010","保德":"101101011","静乐":"101101012","岢岚":"101101013","五寨":"101101014","原平":"101101015","吕梁":"101101100","离石":"101101101","临县":"101101102","兴县":"101101103","岚县":"101101104","柳林":"101101105","石楼":"101101106","方山":"101101107","交口":"101101108","中阳":"101101109","孝义":"101101110","汾阳":"101101111","文水":"101101112","交城":"101101113","西安":"101110101","长安":"101110102","临潼":"101110103","蓝田":"101110104","周至":"101110105","户县":"101110106","高陵":"101110107","杨凌":"101110108","咸阳":"101110200","三原":"101110201","礼泉":"101110202","永寿":"101110203","淳化":"101110204","泾阳":"101110205","武功":"101110206","乾县":"101110207","彬县":"101110208","长武":"101110209","旬邑":"101110210","兴平":"101110211","延安":"101110300","延长":"101110301","延川":"101110302","子长":"101110303","宜川":"101110304","富县":"101110305","志丹":"101110306","安塞":"101110307","甘泉":"101110308","洛川":"101110309","黄陵":"101110310","黄龙":"101110311","吴起":"101110312","榆林":"101110401","府谷":"101110402","神木":"101110403","佳县":"101110404","定边":"101110405","靖边":"101110406","横山":"101110407","米脂":"101110408","子洲":"101110409","绥德":"101110410","吴堡":"101110411","清涧":"101110412","渭南":"101110501","华县":"101110502","潼关":"101110503","大荔":"101110504","白水":"101110505","富平":"101110506","蒲城":"101110507","澄城":"101110508","合阳":"101110509","韩城":"101110510","华阴":"101110511","华山":"101110512","商洛":"101110601","洛南":"101110602","柞水":"101110603","镇安":"101110605","丹凤":"101110606","商南":"101110607","山阳":"101110608","安康":"101110701","紫阳":"101110702","石泉":"101110703","汉阴":"101110704","旬阳":"101110705","岚皋":"101110706","平利":"101110707","白河":"101110708","镇坪":"101110709","宁陕":"101110710","汉中":"101110801","略阳":"101110802","勉县":"101110803","留坝":"101110804","洋县":"101110805","城固":"101110806","西乡":"101110807","佛坪":"101110808","宁强":"101110809","南郑":"101110810","镇巴":"101110811","宝鸡":"101110901","宝鸡县":"101110902","千阳":"101110903","麟游":"101110904","岐山":"101110905","凤翔":"101110906","扶风":"101110907","眉县":"101110908","太白":"101110909","凤县":"101110910","陇县":"101110911","铜川":"101111001","耀县":"101111002","宜君":"101111003","济南":"101120101","长清":"101120102","商河":"101120103","章丘":"101120104","平阴":"101120105","济阳":"101120106","青岛":"101120201","崂山":"101120202","潮连岛":"101120203","即墨":"101120204","胶州":"101120205","胶南":"101120206","莱西":"101120207","平度":"101120208","淄博":"101120301","淄川":"101120302","博山":"101120303","高青":"101120304","周村":"101120305","沂源":"101120306","桓台":"101120307","临淄":"101120308","德州":"101120401","武城":"101120402","临邑":"101120403","陵县":"101120404","齐河":"101120405","乐陵":"101120406","庆云":"101120407","平原":"101120408","宁津":"101120409","夏津":"101120410","禹城":"101120411","烟台":"101120501","莱州":"101120502","长岛":"101120503","蓬莱":"101120504","龙口":"101120505","招远":"101120506","栖霞":"101120507","福山":"101120508","牟平":"101120509","莱阳":"101120510","海阳":"101120511","千里岩":"101120512","潍坊":"101120601","青州":"101120602","寿光":"101120603","临朐":"101120604","昌乐":"101120605","昌邑":"101120606","安丘":"101120607","高密":"101120608","诸城":"101120609","济宁":"101120701","嘉祥":"101120702","微山":"101120703","鱼台":"101120704","兖州":"101120705","金乡":"101120706","汶上":"101120707","泗水":"101120708","梁山":"101120709","曲阜":"101120710","邹城":"101120711","泰安":"101120801","新泰":"101120802","泰山":"101120803","肥城":"101120804","东平":"101120805","宁阳":"101120806","临沂":"101120901","莒南":"101120902","沂南":"101120903","苍山":"101120904","临沭":"101120905","郯城":"101120906","蒙阴":"101120907","平邑":"101120908","费县":"101120909","沂水":"101120910","马站":"101120911","菏泽":"101121001","鄄城":"101121002","郓城":"101121003","东明":"101121004","定陶":"101121005","巨野":"101121006","曹县":"101121007","成武":"101121008","单县":"101121009","滨州":"101121101","博兴":"101121102","无棣":"101121103","阳信":"101121104","惠民":"101121105","沾化":"101121106","邹平":"101121107","东营":"101121201","河口":"101121202","垦利":"101121203","利津":"101121204","广饶":"101121205","威海":"101121301","文登":"101121302","荣成":"101121303","乳山":"101121304","成山头":"101121305","石岛":"101121306","枣庄":"101121401","薛城":"101121402","峄城":"101121403","台儿庄":"101121404","滕州":"101121405","日照":"101121501","五莲":"101121502","莒县":"101121503","莱芜":"101121601","聊城":"101121701","冠县":"101121702","阳谷":"101121703","高唐":"101121704","茌平":"101121705","东阿":"101121706","临清":"101121707","朝城":"101121708","莘县":"101121709","乌鲁木齐":"101130101","蔡家湖":"101130102","小渠子":"101130103","巴仑台":"101130104","达坂城":"101130105","十三间房气象站":"101130106","天山大西沟":"101130107","乌鲁木齐牧试站":"101130108","白杨沟":"101130110","克拉玛依":"101130201","石河子":"101130301","炮台":"101130302","莫索湾":"101130303","乌兰乌苏":"101130304","昌吉":"101130401","呼图壁":"101130402","米泉":"101130403","阜康":"101130404","吉木萨尔":"101130405","奇台":"101130406","玛纳斯":"101130407","木垒":"101130408","北塔山":"101130409","吐鲁番":"101130501","托克逊":"101130502","吐鲁番东坎":"101130503","鄯善":"101130504","红柳河":"101130505","库尔勒":"101130601","轮台":"101130602","尉犁":"101130603","若羌":"101130604","且末":"101130605","和静":"101130606","焉耆":"101130607","和硕":"101130608","库米什":"101130609","巴音布鲁克":"101130610","铁干里克":"101130611","博湖":"101130612","塔中":"101130613","阿拉尔":"101130701","阿克苏":"101130801","乌什":"101130802","温宿":"101130803","拜城":"101130804","新和":"101130805","沙雅":"101130806","库车":"101130807","柯坪":"101130808","阿瓦提":"101130809","喀什":"101130901","英吉沙":"101130902","塔什库尔干":"101130903","麦盖提":"101130904","莎车":"101130905","叶城":"101130906","泽普":"101130907","巴楚":"101130908","岳普湖":"101130909","伽师":"101130910","伊宁":"101131001","察布查尔":"101131002","尼勒克":"101131003","伊宁县":"101131004","巩留":"101131005","新源":"101131006","昭苏":"101131007","特克斯":"101131008","霍城":"101131009","霍尔果斯":"101131010","塔城":"101131101","裕民":"101131102","额敏":"101131103","和布克赛尔":"101131104","托里":"101131105","乌苏":"101131106","沙湾":"101131107","和丰":"101131108","哈密":"101131201","沁城":"101131202","巴里坤":"101131203","伊吾":"101131204","淖毛湖":"101131205","和田":"101131301","皮山":"101131302","策勒":"101131303","墨玉":"101131304","洛浦":"101131305","民丰":"101131306","于田":"101131307","阿勒泰":"101131401","哈巴河":"101131402","一八五团":"101131403","黑山头":"101131404","吉木乃":"101131405","布尔津":"101131406","福海":"101131407","富蕴":"101131408","青河":"101131409","安德河":"101131410","阿图什":"101131501","乌恰":"101131502","阿克陶":"101131503","阿合奇":"101131504","吐尔尕特":"101131505","博乐":"101131601","温泉":"101131602","精河":"101131603","阿拉山口":"101131606","拉萨":"101140101","当雄":"101140102","尼木":"101140103","墨竹贡卡":"101140104","日喀则":"101140201","拉孜":"101140202","南木林":"101140203","聂拉木":"101140204","定日":"101140205","江孜":"101140206","帕里":"101140207","山南":"101140301","贡嘎":"101140302","琼结":"101140303","加查":"101140304","浪卡子":"101140305","错那":"101140306","隆子":"101140307","泽当":"101140308","林芝":"101140401","波密":"101140402","米林":"101140403","察隅":"101140404","昌都":"101140501","丁青":"101140502","类乌齐":"101140503","洛隆":"101140504","左贡":"101140505","芒康":"101140506","八宿":"101140507","那曲":"101140601","嘉黎":"101140603","班戈":"101140604","安多":"101140605","索县":"101140606","比如":"101140607","阿里":"101140701","改则":"101140702","申扎":"101140703","狮泉河":"101140704","普兰":"101140705","西宁":"101150101","大通":"101150102","湟源":"101150103","湟中":"101150104","铁卜加":"101150105","铁卜加寺":"101150106","中心站":"101150107","海东":"101150201","乐都":"101150202","民和":"101150203","互助":"101150204","化隆":"101150205","循化":"101150206","冷湖":"101150207","平安":"101150208","黄南":"101150301","尖扎":"101150302","泽库":"101150303","海南":"101150401","江西沟":"101150402","贵德":"101150404","河卡":"101150405","兴海":"101150406","贵南":"101150407","同德":"101150408","共和":"101150409","果洛":"101150501","班玛":"101150502","甘德":"101150503","达日":"101150504","久治":"101150505","玛多":"101150506","玛沁":"101150508","玉树":"101150601","托托河":"101150602","治多":"101150603","杂多":"101150604","囊谦":"101150605","曲麻莱":"101150606","海西":"101150701","格尔木":"101150702","察尔汉":"101150703","野牛沟":"101150704","五道梁":"101150705","小灶火":"101150706","天峻":"101150708","乌兰":"101150709","都兰":"101150710","诺木洪":"101150711","茫崖":"101150712","大柴旦":"101150713","茶卡":"101150714","香日德":"101150715","德令哈":"101150716","海北":"101150801","门源":"101150802","祁连":"101150803","海晏":"101150804","托勒":"101150805","刚察":"101150806","兰州":"101160101","皋兰":"101160102","永登":"101160103","榆中":"101160104","定西":"101160201","通渭":"101160202","陇西":"101160203","渭源":"101160204","临洮":"101160205","漳县":"101160206","岷县":"101160207","安定":"101160208","平凉":"101160301","泾川":"101160302","灵台":"101160303","崇信":"101160304","华亭":"101160305","庄浪":"101160306","静宁":"101160307","崆峒":"101160308","庆阳":"101160401","西峰":"101160402","环县":"101160403","华池":"101160404","合水":"101160405","正宁":"101160406","宁县":"101160407","镇原":"101160408","庆城":"101160409","武威":"101160501","民勤":"101160502","古浪":"101160503","乌鞘岭":"101160504","天祝":"101160505","金昌":"101160601","永昌":"101160602","张掖":"101160701","肃南":"101160702","民乐":"101160703","临泽":"101160704","高台":"101160705","山丹":"101160706","酒泉":"101160801","鼎��":"101160802","金塔":"101160803","马鬃山":"101160804","瓜州":"101160805","肃北":"101160806","玉门镇":"101160807","敦煌":"101160808","天水":"101160901","北道区":"101160902","清水":"101160903","秦安":"101160904","甘谷":"101160905","武山":"101160906","张家川":"101160907","麦积":"101160908","武都":"101161001","成县":"101161002","文县":"101161003","宕昌":"101161004","康县":"101161005","西和":"101161006","礼县":"101161007","徽县":"101161008","两当":"101161009","临夏":"101161101","康乐":"101161102","永靖":"101161103","广河":"101161104","和政":"101161105","东乡":"101161106","合作":"101161201","临潭":"101161202","卓尼":"101161203","舟曲":"101161204","迭部":"101161205","玛曲":"101161206","碌曲":"101161207","夏河":"101161208","白银":"101161301","靖远":"101161302","会宁":"101161303","华家岭":"101161304","景泰":"101161305","银川":"101170101","永宁":"101170102","灵武":"101170103","贺兰":"101170104","石嘴山":"101170201","惠农":"101170202","平罗":"101170203","陶乐":"101170204","石炭井":"101170205","大武口":"101170206","吴忠":"101170301","同心":"101170302","盐池":"101170303","韦州":"101170304","麻黄山":"101170305","青铜峡":"101170306","固原":"101170401","西吉":"101170402","隆德":"101170403","泾源":"101170404","六盘山":"101170405","彭阳":"101170406","中卫":"101170501","中宁":"101170502","兴仁堡":"101170503","海原":"101170504","郑州":"101180101","巩义":"101180102","荥阳":"101180103","登封":"101180104","新密":"101180105","新郑":"101180106","中牟":"101180107","郑州农试站":"101180108","安阳":"101180201","汤阴":"101180202","滑县":"101180203","内黄":"101180204","林州":"101180205","新乡":"101180301","获嘉":"101180302","原阳":"101180303","辉县":"101180304","卫辉":"101180305","延津":"101180306","封丘":"101180307","长垣":"101180308","许昌":"101180401","鄢陵":"101180402","襄城":"101180403","长葛":"101180404","禹州":"101180405","平顶山":"101180501","郏县":"101180502","宝丰":"101180503","汝州":"101180504","叶县":"101180505","舞钢":"101180506","鲁山":"101180507","信阳":"101180601","息县":"101180602","罗山":"101180603","光山":"101180604","新县":"101180605","淮滨":"101180606","潢川":"101180607","固始":"101180608","商城":"101180609","鸡公山":"101180610","信阳地区农试站":"101180611","南阳":"101180701","南召":"101180702","方城":"101180703","社旗":"101180704","西峡":"101180705","内乡":"101180706","镇平":"101180707","淅川":"101180708","新野":"101180709","唐河":"101180710","邓州":"101180711","桐柏":"101180712","开封":"101180801","杞县":"101180802","尉氏":"101180803","通许":"101180804","兰考":"101180805","洛阳":"101180901","新安":"101180902","孟津":"101180903","宜阳":"101180904","洛宁":"101180905","伊川":"101180906","嵩县":"101180907","偃师":"101180908","栾川":"101180909","汝阳":"101180910","商丘":"101181001","睢阳区":"101181002","睢县":"101181003","民权":"101181004","虞城":"101181005","柘城":"101181006","宁陵":"101181007","夏邑":"101181008","永城":"101181009","焦作":"101181101","修武":"101181102","武陟":"101181103","沁阳":"101181104","博爱":"101181106","温县":"101181107","孟州":"101181108","鹤壁":"101181201","浚县":"101181202","淇县":"101181203","濮阳":"101181301","台前":"101181302","南乐":"101181303","清丰":"101181304","范县":"101181305","周口":"101181401","扶沟":"101181402","太康":"101181403","淮阳":"101181404","西华":"101181405","商水":"101181406","项城":"101181407","郸城":"101181408","鹿邑":"101181409","沈丘":"101181410","黄泛区":"101181411","漯河":"101181501","临颍":"101181502","舞阳":"101181503","驻马店":"101181601","西平":"101181602","遂平":"101181603","上蔡":"101181604","汝南":"101181605","泌阳":"101181606","平舆":"101181607","新蔡":"101181608","确山":"101181609","正阳":"101181610","三门峡":"101181701","灵宝":"101181702","渑池":"101181703","卢氏":"101181704","济源":"101181801","南京":"101190101","溧水":"101190102","高淳":"101190103","江宁":"101190104","六合":"101190105","江浦":"101190106","浦口":"101190107","无锡":"101190201","江阴":"101190202","宜兴":"101190203","镇江":"101190301","丹阳":"101190302","扬中":"101190303","句容":"101190304","丹徒":"101190305","苏州":"101190401","常熟":"101190402","张家港":"101190403","昆山":"101190404","吴县东山":"101190405","吴县":"101190406","吴江":"101190407","太仓":"101190408","南通":"101190501","海安":"101190502","如皋":"101190503","如东":"101190504","吕泗":"101190505","吕泗渔场":"101190506","启东":"101190507","海门":"101190508","扬州":"101190601","宝应":"101190602","仪征":"101190603","高邮":"101190604","江都":"101190605","邗江":"101190606","盐城":"101190701","响水":"101190702","滨海":"101190703","阜宁":"101190704","射阳":"101190705","建湖":"101190706","东台":"101190707","大丰":"101190708","盐都":"101190709","徐州":"101190801","徐州农试站":"101190802","丰县":"101190803","沛县":"101190804","邳州":"101190805","睢宁":"101190806","新沂":"101190807","淮安":"101190901","金湖":"101190902","盱眙":"101190903","洪泽":"101190904","涟水":"101190905","淮阴县":"101190906","淮阴":"101190907","楚州":"101190908","连云港":"101191001","东海":"101191002","赣榆":"101191003","灌云":"101191004","灌南":"101191005","西连岛":"101191006","燕尾港":"101191007","常州":"101191101","溧阳":"101191102","金坛":"101191103","泰州":"101191201","兴化":"101191202","泰兴":"101191203","姜堰":"101191204","靖江":"101191205","宿迁":"101191301","沭阳":"101191302","泗阳":"101191303","泗洪":"101191304","武汉":"101200101","蔡甸":"101200102","黄陂":"101200103","新洲":"101200104","江夏":"101200105","襄樊":"101200201","襄阳":"101200202","保康":"101200203","南漳":"101200204","宜城":"101200205","老河口":"101200206","谷城":"101200207","枣阳":"101200208","鄂州":"101200301","孝感":"101200401","安陆":"101200402","云梦":"101200403","大悟":"101200404","应城":"101200405","汉川":"101200406","黄冈":"101200501","红安":"101200502","麻城":"101200503","罗田":"101200504","英山":"101200505","浠水":"101200506","蕲春":"101200507","黄梅":"101200508","武穴":"101200509","黄石":"101200601","大冶":"101200602","阳新":"101200603","咸宁":"101200701","赤壁":"101200702","嘉鱼":"101200703","崇阳":"101200704","通城":"101200705","通山":"101200706","荆州":"101200801","江陵":"101200802","公安":"101200803","石首":"101200804","监利":"101200805","洪湖":"101200806","松滋":"101200807","宜昌":"101200901","远安":"101200902","秭归":"101200903","兴山":"101200904","宜昌县":"101200905","五峰":"101200906","当阳":"101200907","长阳":"101200908","宜都":"101200909","枝江":"101200910","三峡":"101200911","夷陵":"101200912","恩施":"101201001","利川":"101201002","建始":"101201003","咸丰":"101201004","宣恩":"101201005","鹤峰":"101201006","来凤":"101201007","巴东":"101201008","绿葱坡":"101201009","十堰":"101201101","竹溪":"101201102","郧西":"101201103","郧县":"101201104","竹山":"101201105","房县":"101201106","丹江口":"101201107","神农架":"101201201","随州":"101201301","广水":"101201302","荆门":"101201401","钟祥":"101201402","京山":"101201403","天门":"101201501","仙桃":"101201601","潜江":"101201701","杭州":"101210101","萧山":"101210102","桐庐":"101210103","淳安":"101210104","建德":"101210105","余杭":"101210106","临安":"101210107","富阳":"101210108","湖州":"101210201","长兴":"101210202","安吉":"101210203","德清":"101210204","嘉兴":"101210301","嘉善":"101210302","海宁":"101210303","桐乡":"101210304","平湖":"101210305","海盐":"101210306","宁波":"101210401","慈溪":"101210403","余姚":"101210404","奉化":"101210405","象山":"101210406","石浦":"101210407","宁海":"101210408","鄞县":"101210409","北仑":"101210410","鄞州":"101210411","镇海":"101210412","绍兴":"101210501","诸暨":"101210502","上虞":"101210503","新昌":"101210504","嵊州":"101210505","台州":"101210601","括苍山":"101210602","玉环":"101210603","三门":"101210604","天台":"101210605","仙居":"101210606","温岭":"101210607","大陈":"101210608","洪家":"101210609","温州":"101210701","泰顺":"101210702","文成":"101210703","平阳":"101210704","瑞安":"101210705","洞头":"101210706","乐清":"101210707","永嘉":"101210708","苍南":"101210709","丽水":"101210801","遂昌":"101210802","龙泉":"101210803","缙云":"101210804","青田":"101210805","云和":"101210806","庆元":"101210807","金华":"101210901","浦江":"101210902","兰溪":"101210903","义乌":"101210904","东阳":"101210905","武义":"101210906","永康":"101210907","磐安":"101210908","衢州":"101211001","常山":"101211002","开化":"101211003","龙游":"101211004","江山":"101211005","舟山":"101211101","嵊泗":"101211102","嵊山":"101211103","岱山":"101211104","普陀":"101211105","定海":"101211106","合肥":"101220101","长丰":"101220102","肥东":"101220103","肥西":"101220104","蚌埠":"101220201","怀远":"101220202","固镇":"101220203","五河":"101220204","芜湖":"101220301","繁昌":"101220302","芜湖县":"101220303","南陵":"101220304","淮南":"101220401","凤台":"101220402","马鞍山":"101220501","当涂":"101220502","安庆":"101220601","枞阳":"101220602","太湖":"101220603","潜山":"101220604","怀宁":"101220605","宿松":"101220606","望江":"101220607","岳西":"101220608","桐城":"101220609","宿州":"101220701","砀山":"101220702","灵璧":"101220703","泗县":"101220704","萧县":"101220705","阜阳":"101220801","阜南":"101220802","颍上":"101220803","临泉":"101220804","界首":"101220805","太和":"101220806","亳州":"101220901","涡阳":"101220902","利辛":"101220903","蒙城":"101220904","黄山站":"101221001","黄山区":"101221002","屯溪":"101221003","祁门":"101221004","黟县":"101221005","歙县":"101221006","休宁":"101221007","黄山市":"101221008","滁州":"101221101","凤阳":"101221102","明光":"101221103","定远":"101221104","全椒":"101221105","来安":"101221106","天长":"101221107","淮北":"101221201","濉溪":"101221202","铜陵":"101221301","宣城":"101221401","泾县":"101221402","旌德":"101221403","宁国":"101221404","绩溪":"101221405","广德":"101221406","郎溪":"101221407","六安":"101221501","霍邱":"101221502","寿县":"101221503","南溪":"101221504","金寨":"101221505","霍山":"101221506","舒城":"101221507","巢湖":"101221601","庐江":"101221602","无为":"101221603","含山":"101221604","和县":"101221605","池州":"101221701","东至":"101221702","青阳":"101221703","九华山":"101221704","石台":"101221705","福州":"101230101","闽清":"101230102","闽侯":"101230103","罗源":"101230104","连江":"101230105","马祖":"101230106","永泰":"101230107","平潭":"101230108","福州郊区":"101230109","长乐":"101230110","福清":"101230111","平潭海峡大桥":"101230112","厦门":"101230201","同安":"101230202","宁德":"101230301","古田":"101230302","霞浦":"101230303","寿宁":"101230304","周宁":"101230305","福安":"101230306","柘荣":"101230307","福鼎":"101230308","屏南":"101230309","莆田":"101230401","仙游":"101230402","秀屿港":"101230403","泉州":"101230501","安溪":"101230502","九仙山":"101230503","永春":"101230504","德化":"101230505","南安":"101230506","崇武":"101230507","晋江":"101230509","漳州":"101230601","长泰":"101230602","南靖":"101230603","平和":"101230604","龙海":"101230605","漳浦":"101230606","诏安":"101230607","东山":"101230608","云霄":"101230609","华安":"101230610","龙岩":"101230701","长汀":"101230702","连城":"101230703","武平":"101230704","上杭":"101230705","永定":"101230706","漳平":"101230707","三明":"101230801","宁化":"101230802","清流":"101230803","泰宁":"101230804","将乐":"101230805","建宁":"101230806","明溪":"101230807","沙县":"101230808","尤溪":"101230809","永安":"101230810","大田":"101230811","南平":"101230901","顺昌":"101230902","光泽":"101230903","邵武":"101230904","武夷山":"101230905","浦城":"101230906","建阳":"101230907","松溪":"101230908","政和":"101230909","建瓯":"101230910","南昌":"101240101","新建":"101240102","南昌县":"101240103","安义":"101240104","进贤":"101240105","莲塘":"101240106","九江":"101240201","瑞昌":"101240202","庐山":"101240203","武宁":"101240204","德安":"101240205","永修":"101240206","湖口":"101240207","彭泽":"101240208","星子":"101240209","都昌":"101240210","棠荫":"101240211","修水":"101240212","上饶":"101240301","鄱阳":"101240302","婺源":"101240303","康山":"101240304","余干":"101240305","万年":"101240306","德兴":"101240307","上饶县":"101240308","弋阳":"101240309","横峰":"101240310","铅山":"101240311","玉山":"101240312","广丰":"101240313","波阳":"101240314","抚州":"101240401","广昌":"101240402","乐安":"101240403","崇仁":"101240404","金溪":"101240405","资溪":"101240406","宜黄":"101240407","南城":"101240408","南丰":"101240409","黎川":"101240410","宜春":"101240501","铜鼓":"101240502","宜丰":"101240503","万载":"101240504","上高":"101240505","靖安":"101240506","奉新":"101240507","高安":"101240508","樟树":"101240509","丰城":"101240510","吉安":"101240601","吉安县":"101240602","吉水":"101240603","新干":"101240604","峡江":"101240605","永丰":"101240606","永新":"101240607","井冈山":"101240608","万安":"101240609","遂川":"101240610","泰和":"101240611","安福":"101240612","宁冈":"101240613","赣州":"101240701","崇义":"101240702","上犹":"101240703","南康":"101240704","大余":"101240705","信丰":"101240706","宁都":"101240707","石城":"101240708","瑞金":"101240709","于都":"101240710","会昌":"101240711","安远":"101240712","全南":"101240713","龙南":"101240714","定南":"101240715","寻乌":"101240716","兴国":"101240717","景德镇":"101240801","乐平":"101240802","萍乡":"101240901","莲花":"101240902","新余":"101241001","分宜":"101241002","鹰潭":"101241101","余江":"101241102","贵溪":"101241103","长沙":"101250101","宁乡":"101250102","浏阳":"101250103","马坡岭":"101250104","湘潭":"101250201","韶山":"101250202","湘乡":"101250203","株洲":"101250301","攸县":"101250302","醴陵":"101250303","株洲县":"101250304","茶陵":"101250305","炎陵":"101250306","衡阳":"101250401","衡山":"101250402","衡东":"101250403","祁东":"101250404","衡阳县":"101250405","常宁":"101250406","衡南":"101250407","耒阳":"101250408","南岳":"101250409","郴州":"101250501","桂阳":"101250502","嘉禾":"101250503","宜章":"101250504","临武":"101250505","桥口":"101250506","资兴":"101250507","汝城":"101250508","安仁":"101250509","永兴":"101250510","桂东":"101250511","常德":"101250601","安乡":"101250602","桃源":"101250603","汉寿":"101250604","澧县":"101250605","临澧":"101250606","石门":"101250607","益阳":"101250700","赫山区":"101250701","南县":"101250702","桃江":"101250703","安化":"101250704","沅江":"101250705","娄底":"101250801","双峰":"101250802","冷水江":"101250803","冷水滩":"101250804","新化":"101250805","涟源":"101250806","邵阳":"101250901","隆回":"101250902","洞口":"101250903","新邵":"101250904","邵东":"101250905","绥宁":"101250906","新宁":"101250907","武冈":"101250908","城步":"101250909","邵阳县":"101250910","岳阳":"101251001","华容":"101251002","湘阴":"101251003","汨罗":"101251004","平江":"101251005","临湘":"101251006","张家界":"101251101","桑植":"101251102","慈利":"101251103","怀化":"101251201","鹤城区":"101251202","沅陵":"101251203","辰溪":"101251204","靖州":"101251205","会同":"101251206","通道":"101251207","麻阳":"101251208","新晃":"101251209","芷江":"101251210","溆浦":"101251211","黔阳":"101251301","洪江":"101251302","永州":"101251401","祁阳":"101251402","东安":"101251403","双牌":"101251404","道县":"101251405","宁远":"101251406","江永":"101251407","蓝山":"101251408","新田":"101251409","江华":"101251410","吉首":"101251501","保靖":"101251502","永顺":"101251503","古丈":"101251504","凤凰":"101251505","泸溪":"101251506","龙山":"101251507","花垣":"101251508","贵阳":"101260101","白云":"101260102","花溪":"101260103","乌当":"101260104","息烽":"101260105","开阳":"101260106","修文":"101260107","清镇":"101260108","遵义":"101260201","遵义县":"101260202","仁怀":"101260203","绥阳":"101260204","湄潭":"101260205","凤冈":"101260206","桐梓":"101260207","赤水":"101260208","习水":"101260209","道真":"101260210","正安":"101260211","务川":"101260212","余庆":"101260213","汇川":"101260214","安顺":"101260301","普定":"101260302","镇宁":"101260303","平坝":"101260304","紫云":"101260305","关岭":"101260306","都匀":"101260401","贵定":"101260402","瓮安":"101260403","长顺":"101260404","福泉":"101260405","惠水":"101260406","龙里":"101260407","罗甸":"101260408","平塘":"101260409","独山":"101260410","三都":"101260411","荔波":"101260412","凯里":"101260501","岑巩":"101260502","施秉":"101260503","镇远":"101260504","黄平":"101260505","黄平旧洲":"101260506","麻江":"101260507","丹寨":"101260508","三穗":"101260509","台江":"101260510","剑河":"101260511","雷山":"101260512","黎平":"101260513","天柱":"101260514","锦屏":"101260515","榕江":"101260516","从江":"101260517","炉山":"101260518","铜仁":"101260601","江口":"101260602","玉屏":"101260603","万山":"101260604","思南":"101260605","塘头":"101260606","印江":"101260607","石阡":"101260608","沿河":"101260609","德江":"101260610","松桃":"101260611","毕节":"101260701","赫章":"101260702","金沙":"101260703","威宁":"101260704","大方":"101260705","纳雍":"101260706","织金":"101260707","六盘水":"101260801","六枝":"101260802","水城":"101260803","盘县":"101260804","黔西":"101260901","晴隆":"101260902","兴仁":"101260903","贞丰":"101260904","望谟":"101260905","兴义":"101260906","安龙":"101260907","册亨":"101260908","普安":"101260909","成都":"101270101","龙泉驿":"101270102","新都":"101270103","温江":"101270104","金堂":"101270105","双流":"101270106","郫县":"101270107","大邑":"101270108","蒲江":"101270109","新津":"101270110","都江堰":"101270111","彭州":"101270112","邛崃":"101270113","崇州":"101270114","崇庆":"101270115","彭县":"101270116","攀枝花":"101270201","仁和":"101270202","米易":"101270203","盐边":"101270204","自贡":"101270301","富顺":"101270302","荣县":"101270303","绵阳":"101270401","三台":"101270402","盐亭":"101270403","安县":"101270404","梓潼":"101270405","北川":"101270406","平武":"101270407","江油":"101270408","南充":"101270501","南部":"101270502","营山":"101270503","蓬安":"101270504","仪陇":"101270505","西充":"101270506","阆中":"101270507","达州":"101270601","宣汉":"101270602","开江":"101270603","大竹":"101270604","渠县":"101270605","万源":"101270606","达川":"101270607","遂宁":"101270701","蓬溪":"101270702","射洪":"101270703","广安":"101270801","岳池":"101270802","武胜":"101270803","邻水":"101270804","华蓥山":"101270805","巴中":"101270901","通江":"101270902","南江":"101270903","平昌":"101270904","泸州":"101271001","泸县":"101271003","合江":"101271004","叙永":"101271005","古蔺":"101271006","纳溪":"101271007","宜宾":"101271101","宜宾农试站":"101271102","宜宾县":"101271103","江安":"101271105","长宁":"101271106","高县":"101271107","珙县":"101271108","筠连":"101271109","兴文":"101271110","屏山":"101271111","内江":"101271201","东兴":"101271202","威远":"101271203","资中":"101271204","隆昌":"101271205","资阳":"101271301","安岳":"101271302","乐至":"101271303","简阳":"101271304","乐山":"101271401","犍为":"101271402","井研":"101271403","夹江":"101271404","沐川":"101271405","峨边":"101271406","马边":"101271407","峨眉":"101271408","峨眉山":"101271409","眉山":"101271501","仁寿":"101271502","彭山":"101271503","洪���":"101271504","丹棱":"101271505","青神":"101271506","凉山":"101271601","木里":"101271603","盐源":"101271604","德昌":"101271605","会理":"101271606","会东":"101271607","宁南":"101271608","普格":"101271609","西昌":"101271610","金阳":"101271611","昭觉":"101271612","喜德":"101271613","冕宁":"101271614","越西":"101271615","甘洛":"101271616","雷波":"101271617","美姑":"101271618","布拖":"101271619","雅安":"101271701","名山":"101271702","荣经":"101271703","汉源":"101271704","石棉":"101271705","天全":"101271706","芦山":"101271707","宝兴":"101271708","甘孜":"101271801","康定":"101271802","泸定":"101271803","丹巴":"101271804","九龙":"101271805","雅江":"101271806","道孚":"101271807","炉霍":"101271808","新龙":"101271809","德格":"101271810","白玉":"101271811","石渠":"101271812","色达":"101271813","理塘":"101271814","巴塘":"101271815","乡城":"101271816","稻城":"101271817","得荣":"101271818","阿坝":"101271901","汶川":"101271902","理县":"101271903","茂县":"101271904","松潘":"101271905","九寨沟":"101271906","金川":"101271907","小金":"101271908","黑水":"101271909","马尔康":"101271910","壤塘":"101271911","若尔盖":"101271912","红原":"101271913","南坪":"101271914","德阳":"101272001","中江":"101272002","广汉":"101272003","什邡":"101272004","绵竹":"101272005","罗江":"101272006","广元":"101272101","旺苍":"101272102","青川":"101272103","剑阁":"101272104","苍溪":"101272105","广州":"101280101","番禺":"101280102","从化":"101280103","增城":"101280104","花都":"101280105","天河":"101280106","韶关":"101280201","乳源":"101280202","始兴":"101280203","翁源":"101280204","乐昌":"101280205","仁化":"101280206","南雄":"101280207","新丰":"101280208","曲江":"101280209","惠州":"101280301","博罗":"101280302","惠阳":"101280303","惠东":"101280304","龙门":"101280305","梅州":"101280401","兴宁":"101280402","蕉岭":"101280403","大埔":"101280404","丰顺":"101280406","平远":"101280407","五华":"101280408","梅县":"101280409","汕头":"101280501","潮阳":"101280502","澄海":"101280503","南澳":"101280504","云澳":"101280505","南澎岛":"101280506","深圳":"101280601","珠海":"101280701","斗门":"101280702","黄茅洲":"101280703","佛山":"101280800","顺德":"101280801","三水":"101280802","南海":"101280803","肇庆":"101280901","广宁":"101280902","四会":"101280903","德庆":"101280905","怀集":"101280906","封开":"101280907","高要":"101280908","湛江":"101281001","吴川":"101281002","雷州":"101281003","徐闻":"101281004","廉江":"101281005","硇洲":"101281006","遂溪":"101281007","江门":"101281101","开平":"101281103","新会":"101281104","恩平":"101281105","台山":"101281106","上川岛":"101281107","鹤山":"101281108","河源":"101281201","紫金":"101281202","连平":"101281203","和平":"101281204","龙川":"101281205","清远":"101281301","连南":"101281302","连州":"101281303","连山":"101281304","阳山":"101281305","佛冈":"101281306","英德":"101281307","云浮":"101281401","罗定":"101281402","新兴":"101281403","郁南":"101281404","潮州":"101281501","饶平":"101281502","东莞":"101281601","中山":"101281701","阳江":"101281801","阳春":"101281802","揭阳":"101281901","揭西":"101281902","普宁":"101281903","惠来":"101281904","茂名":"101282001","高州":"101282002","化州":"101282003","电白":"101282004","信宜":"101282005","汕尾":"101282101","海丰":"101282102","陆丰":"101282103","遮浪":"101282104","东沙岛":"101282105","昆明":"101290101","昆明农试站":"101290102","东川":"101290103","寻甸":"101290104","晋宁":"101290105","宜良":"101290106","石林":"101290107","呈贡":"101290108","富民":"101290109","嵩明":"101290110","禄劝":"101290111","安宁":"101290112","太华山":"101290113","大理":"101290201","云龙":"101290202","漾鼻":"101290203","永平":"101290204","宾川":"101290205","弥渡":"101290206","祥云":"101290207","魏山":"101290208","剑川":"101290209","洱源":"101290210","鹤庆":"101290211","南涧":"101290212","红河":"101290301","石屏":"101290302","建水":"101290303","弥勒":"101290304","元阳":"101290305","绿春":"101290306","开远":"101290307","个旧":"101290308","蒙自":"101290309","屏边":"101290310","泸西":"101290311","金平":"101290312","曲靖":"101290401","沾益":"101290402","陆良":"101290403","富源":"101290404","马龙":"101290405","师宗":"101290406","罗平":"101290407","会泽":"101290408","宣威":"101290409","保山":"101290501","富宁":"101290502","龙陵":"101290503","施甸":"101290504","昌宁":"101290505","腾冲":"101290506","文山":"101290601","西畴":"101290602","马关":"101290603","麻栗坡":"101290604","砚山":"101290605","邱北":"101290606","广南":"101290607","玉溪":"101290701","澄江":"101290702","江川":"101290703","通海":"101290704","华宁":"101290705","新平":"101290706","易门":"101290707","峨山":"101290708","元江":"101290709","楚雄":"101290801","大姚":"101290802","元谋":"101290803","姚安":"101290804","牟定":"101290805","南华":"101290806","武定":"101290807","禄丰":"101290808","双柏":"101290809","永仁":"101290810","普洱":"101290901","景谷":"101290902","景东":"101290903","澜沧":"101290904","墨江":"101290906","江城":"101290907","孟连":"101290908","西盟":"101290909","镇源":"101290910","镇沅":"101290911","宁洱":"101290912","昭通":"101291001","鲁甸":"101291002","彝良":"101291003","镇雄":"101291004","威信":"101291005","巧家":"101291006","绥江":"101291007","永善":"101291008","盐津":"101291009","大关":"101291010","临沧":"101291101","沧源":"101291102","耿马":"101291103","双江":"101291104","凤庆":"101291105","永德":"101291106","云县":"101291107","镇康":"101291108","怒江":"101291201","福贡":"101291203","兰坪":"101291204","泸水":"101291205","六库":"101291206","贡山":"101291207","香格里拉":"101291301","德钦":"101291302","维西":"101291303","中甸":"101291304","丽江":"101291401","永胜":"101291402","华坪":"101291403","宁蒗":"101291404","德宏":"101291501","潞江坝":"101291502","陇川":"101291503","盈江":"101291504","畹町镇":"101291505","瑞丽":"101291506","梁河":"101291507","潞西":"101291508","景洪":"101291601","大勐龙":"101291602","勐海":"101291603","景洪电站":"101291604","勐腊":"101291605","南宁":"101300101","南宁城区":"101300102","邕宁":"101300103","横县":"101300104","隆安":"101300105","马山":"101300106","上林":"101300107","武鸣":"101300108","宾阳":"101300109","硕龙":"101300110","崇左":"101300201","天等":"101300202","龙州":"101300203","凭祥":"101300204","大新":"101300205","扶绥":"101300206","宁明":"101300207","海渊":"101300208","柳州":"101300301","柳城":"101300302","沙塘":"101300303","鹿寨":"101300304","柳江":"101300305","融安":"101300306","融水":"101300307","三江":"101300308","来宾":"101300401","忻城":"101300402","金秀":"101300403","象州":"101300404","武宣":"101300405","桂林":"101300501","桂林农试站":"101300502","龙胜":"101300503","永福":"101300504","临桂":"101300505","兴安":"101300506","灵川":"101300507","全州":"101300508","灌阳":"101300509","阳朔":"101300510","恭城":"101300511","平乐":"101300512","荔浦":"101300513","资源":"101300514","梧州":"101300601","藤县":"101300602","太平":"101300603","苍梧":"101300604","蒙山":"101300605","岑溪":"101300606","贺州":"101300701","昭平":"101300702","富川":"101300703","钟山":"101300704","信都":"101300705","贵港":"101300801","桂平":"101300802","平南":"101300803","玉林":"101300901","博白":"101300902","北流":"101300903","容县":"101300904","陆川":"101300905","百色":"101301001","那坡":"101301002","田阳":"101301003","德保":"101301004","靖西":"101301005","田东":"101301006","平果":"101301007","隆林":"101301008","西林":"101301009","乐业":"101301010","凌云":"101301011","田林":"101301012","钦州":"101301101","浦北":"101301102","灵山":"101301103","河池":"101301201","天峨":"101301202","东兰":"101301203","巴马":"101301204","环江":"101301205","罗城":"101301206","宜州":"101301207","凤山":"101301208","南丹":"101301209","都安":"101301210","北海":"101301301","合浦":"101301302","涠洲岛":"101301303","防城港":"101301401","上思":"101301402","板栏":"101301404","防城":"101301405","海口":"101310101","琼山":"101310102","三亚":"101310201","东方":"101310202","临高":"101310203","澄迈":"101310204","儋州":"101310205","昌江":"101310206","白沙":"101310207","琼中":"101310208","定安":"101310209","屯昌":"101310210","琼海":"101310211","文昌":"101310212","清兰":"101310213","保亭":"101310214","万宁":"101310215","陵水":"101310216","西沙":"101310217","珊瑚岛":"101310218","永署礁":"101310219","南沙岛":"101310220","乐东":"101310221","五指山":"101310222","通什":"101310223","香港":"101320101","新界":"101320103","中环":"101320104","铜锣湾":"101320105","澳门":"101330101","台北县":"101340101","台北市":"101340102","高雄":"101340201","大武":"101340203","恒春":"101340204","兰屿":"101340205","台南":"101340301","台中":"101340401","桃园":"101340501","新竹县":"101340601","新竹市":"101340602","公馆":"101340603","宜兰":"101340701","马公":"101340801","东吉屿":"101340802","嘉义":"101340901","阿里山":"101340902","新港":"101340904"}
Yunzai/plugins/Guoba-Plugin/server/constant/Constant.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * 一些公用常量
3
+ */
4
+ export default {
5
+ // header中传递的TokenKey
6
+ TOKEN_KEY: 'guoba-access-token',
7
+
8
+ // redis前缀
9
+ REDIS_PREFIX: 'Yz:Guoba:',
10
+
11
+ }