daily-question 1.0.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/exam-dates.js CHANGED
@@ -253,16 +253,17 @@ export function computeCountdown(year, examInfo, today = todayISO()) {
253
253
  return base
254
254
  }
255
255
 
256
- const diff = calendarDiff(today, examInfo.date) || { years: 0, months: 0, days: 0 }
257
- base.calendar = diff
256
+ base.calendar = calendarDiff(today, examInfo.date)
257
+ const years = Math.floor(remaining / 365)
258
+ const months = Math.floor((remaining % 365) / 30)
259
+ const days = (remaining % 365) % 30
258
260
  base.lines = {
259
261
  primary: `距离${year}考研还剩${approxPrefix}${remaining}天`,
260
- secondary: `距离${year}考研还剩${approxPrefix}${diff.years}年${diff.months}个月${diff.days}天`,
262
+ secondary: remaining <= 30 ? '' : `${approxPrefix}${years ? `${years}年` : ''}${months ? `${months}个月` : ''}${days ? `${days}天` : ''}`,
261
263
  target: targetText,
262
264
  }
263
265
  if (remaining === 0) {
264
266
  base.lines.primary = `距离${year}考研还剩${approxPrefix}0天(今日开考)`
265
- base.lines.secondary = `距离${year}考研还剩${approxPrefix}0年0个月0天`
266
267
  }
267
268
  return base
268
269
  }
@@ -372,14 +373,15 @@ export function addDays(iso, days) {
372
373
  * 今年 12 月那场考试对应的入学年份是 year + 1。一旦这场初试结束,窗口整体
373
374
  * 后移一年:
374
375
  * 2026-11-04(初试前)→ 2027 / 2028 / 2029
375
- * 2026-12-20(初试后)→ 2028 / 2029 / 2030
376
+ * 2026-12-21(初试后)→ 2028 / 2029 / 2030
376
377
  */
377
- export function yearOptions(today = todayISO()) {
378
+ export function yearOptions(today = todayISO(), overrides = {}) {
378
379
  const parts = parseISODate(today)
379
380
  const year = parts?.year ?? new Date().getFullYear()
380
381
  const session = year + 1
381
- const sessionExamDate = resolveExamDate(session).date
382
- const finished = Boolean(sessionExamDate) && daysBetween(sessionExamDate, today) > 0
382
+ const exam = resolveExamDate(session, overrides)
383
+ const endDate = exam.endDate || exam.date
384
+ const finished = Boolean(endDate) && daysBetween(endDate, today) > 0
383
385
  const first = finished ? session + 1 : session
384
386
  return [first, first + 1, first + 2]
385
387
  }
package/lib/generate.js CHANGED
@@ -1,4 +1,4 @@
1
- import { describeSubjectForPrompt, QUESTION_TYPE_LABEL, CHOICE_TYPES, subjectTypes } from './subjects.js'
1
+ import { describeSubjectForPrompt, QUESTION_TYPE_LABEL, CHOICE_TYPES } from './subjects.js'
2
2
  import { asString, asStringArray, generateText, parseJsonLoose, resolveModel } from './llm-json.js'
3
3
 
4
4
  /**
@@ -55,7 +55,7 @@ const VERIFIER_SYSTEM = `你是一位独立于命题人的审题与答案校验
55
55
  * @returns {{question: object, verification: object}}
56
56
  */
57
57
  export async function createVerifiedQuestion({ ctx, subject, examInfo, signal, preferredType }) {
58
- const allowed = subjectTypes(subject.id, [])
58
+ const allowed = subject.types
59
59
  const allowedLabels = allowed.map((type) => QUESTION_TYPE_LABEL[type] || type)
60
60
  const typeHint = preferredType && allowed.includes(preferredType) ? preferredType : allowed[Math.floor(Math.random() * allowed.length)]
61
61
  const trail = []
@@ -348,7 +348,7 @@ const REVISER_SYSTEM = `你是一位考研命题组的答案复核老师。你
348
348
  * 只有校验通过的候选才允许替换正式版本。
349
349
  */
350
350
  export async function reviseAnswer({ ctx, subject, examInfo, question, currentAnswer, reason, signal }) {
351
- const allowed = subjectTypes(question.subjectId, [])
351
+ const allowed = subject?.types || [question.type]
352
352
  let feedback = ''
353
353
  let lastReview = null
354
354
  let modelIdentity = ''
package/lib/routes.js CHANGED
@@ -5,12 +5,12 @@ import { fileURLToPath } from 'node:url'
5
5
 
6
6
  const RPC_PATH = '/api/daily-question/rpc'
7
7
  const PING_PATH = '/api/daily-question/ping'
8
- const FONT_PATH = '/api/daily-question/font/latinmodern-math.otf'
8
+ const MATHJAX_PATH = '/api/daily-question/vendor/tex-svg.js'
9
9
  const MAX_BODY_BYTES = 60 * 1024 * 1024
10
10
 
11
- /** Latin Modern Math(GUST Font License / LPPL),随包分发,见 assets 内的许可文件。 */
12
- const FONT_FILE = fileURLToPath(new URL('../assets/latinmodern-math.otf', import.meta.url))
13
- let fontBytes = null
11
+ /** MathJax 3.2.2 的单文件 bundle(Apache-2.0),见 vendor/mathjax 内的许可文件。 */
12
+ const MATHJAX_FILE = fileURLToPath(new URL('../vendor/mathjax/tex-svg.js', import.meta.url))
13
+ let mathjaxBytes = null
14
14
 
15
15
  /** 最小 CSRF 防护:带 Origin 的请求必须与 Host 同源。 */
16
16
  function trusted(req) {
@@ -69,6 +69,7 @@ export function registerRoutes(webServer, service, logger = console) {
69
69
  judge: (args) => service.judge(args),
70
70
  favorite: (args) => service.favorite(args),
71
71
  removeFromWrongBook: (args) => service.removeFromWrongBook(args),
72
+ bulkQuestions: (args) => service.bulkQuestions(args),
72
73
  revise: (args) => service.revise(args),
73
74
  confirmRevision: (args) => service.confirmRevision(args),
74
75
  discardRevision: (args) => service.discardRevision(args),
@@ -140,10 +141,10 @@ export function registerRoutes(webServer, service, logger = console) {
140
141
  },
141
142
  })
142
143
 
143
- // 公式字体:同源提供,@font-face 的 url() 指向这里。
144
- const disposeFont = webServer.register({
144
+ // 公式引擎:MathJax 3 的单文件 bundle(SVG 输出,自带字形路径,不需要字体文件)。
145
+ const disposeVendor = webServer.register({
145
146
  kind: 'exact',
146
- path: FONT_PATH,
147
+ path: MATHJAX_PATH,
147
148
  handler: async (req, res) => {
148
149
  if (req.method !== 'GET' && req.method !== 'HEAD') {
149
150
  res.writeHead(405, { allow: 'GET, HEAD' })
@@ -151,18 +152,18 @@ export function registerRoutes(webServer, service, logger = console) {
151
152
  return
152
153
  }
153
154
  try {
154
- if (!fontBytes) fontBytes = await readFile(FONT_FILE)
155
+ if (!mathjaxBytes) mathjaxBytes = await readFile(MATHJAX_FILE)
155
156
  res.writeHead(200, {
156
- 'content-type': 'font/otf',
157
- 'content-length': String(fontBytes.length),
157
+ 'content-type': 'text/javascript; charset=utf-8',
158
+ 'content-length': String(mathjaxBytes.length),
158
159
  'cache-control': 'public, max-age=31536000, immutable',
159
160
  })
160
161
  if (req.method === 'HEAD') res.end()
161
- else res.end(fontBytes)
162
+ else res.end(mathjaxBytes)
162
163
  } catch (error) {
163
- logger.warn?.(`daily-question: 公式字体不可用(${error.message})`)
164
+ logger.warn?.(`daily-question: 公式引擎不可用(${error.message})`)
164
165
  res.writeHead(404, { 'content-type': 'text/plain; charset=utf-8' })
165
- res.end('Latin Modern Math not bundled')
166
+ res.end('MathJax not bundled')
166
167
  }
167
168
  },
168
169
  })
@@ -171,6 +172,6 @@ export function registerRoutes(webServer, service, logger = console) {
171
172
  return () => {
172
173
  disposeRpc()
173
174
  disposePing()
174
- disposeFont()
175
+ disposeVendor()
175
176
  }
176
177
  }
package/lib/service.js CHANGED
@@ -90,8 +90,8 @@ export class DailyQuestionService {
90
90
 
91
91
  async bootstrap() {
92
92
  const today = todayISO()
93
- const options = yearOptions(today)
94
93
  let data = await this.data()
94
+ const options = yearOptions(today, data.examDates)
95
95
  // 旧设置可能落在窗口外(它的初试早已结束):自动收敛到可选的最早一年
96
96
  if (!options.includes(data.settings.targetYear)) {
97
97
  await this.store.update((draft) => {
@@ -179,6 +179,7 @@ export class DailyQuestionService {
179
179
 
180
180
  isWrong(question, attempts) {
181
181
  if (question.wrongBookRemoved) return false
182
+ if (question.wrongBookAdded) return true
182
183
  const own = attempts.filter((attempt) => attempt.questionId === question.id)
183
184
  return own.some((attempt) => attempt.result === 'wrong')
184
185
  }
@@ -206,7 +207,7 @@ export class DailyQuestionService {
206
207
  }
207
208
  if (patch.targetYear !== undefined) {
208
209
  const year = Math.trunc(Number(patch.targetYear))
209
- const allowed = yearOptions()
210
+ const allowed = yearOptions(todayISO(), draft.examDates)
210
211
  if (!Number.isFinite(year) || !allowed.includes(year)) {
211
212
  throw new Error(`考研年份只能选 ${allowed[0]}、${allowed[1]}、${allowed[2]}(初试已结束的年份不再提供)`)
212
213
  }
@@ -371,8 +372,7 @@ export class DailyQuestionService {
371
372
  }
372
373
  if (!candidates.length) return null
373
374
  candidates.sort((a, b) => String(a.lastAssignedDate).localeCompare(String(b.lastAssignedDate)))
374
- const fresh = candidates.filter((candidate) => candidate.lastAssignedDate !== date)
375
- const pool = fresh.length ? fresh : candidates
375
+ const pool = candidates.filter((candidate) => candidate.lastAssignedDate === candidates[0].lastAssignedDate)
376
376
  const chosen = pool[Math.floor(Math.random() * pool.length)]
377
377
  const repeated = Boolean(chosen.lastAssignedDate)
378
378
  return { ...chosen, repeated }
@@ -540,6 +540,7 @@ export class DailyQuestionService {
540
540
  type: question.type,
541
541
  typeLabel: QUESTION_TYPE_LABEL[question.type] || question.type,
542
542
  summary: summariseStem(question.stem),
543
+ stem: question.stem,
543
544
  assignedDate: question.assignedDate,
544
545
  attemptCount: attempts.length,
545
546
  favorite: Boolean(question.favoriteAt),
@@ -581,7 +582,8 @@ export class DailyQuestionService {
581
582
  const question = data.questions[qid]
582
583
  if (!question) throw new Error('题目不存在(可能已随题库删除而失效)')
583
584
  const thread = this.threadView(data, qid)
584
- return { ok: true, question: this.questionView(data, question), thread }
585
+ const isToday = data.daily[`${todayISO()}|${question.subjectId}`]?.questionId === qid
586
+ return { ok: true, question: this.questionView(data, question), thread, isToday }
585
587
  }
586
588
 
587
589
  threadView(data, qid) {
@@ -600,12 +602,6 @@ export class DailyQuestionService {
600
602
  const data = await this.data()
601
603
  const question = data.questions[qid]
602
604
  if (!question) throw new Error('题目不存在')
603
- if (attemptId) {
604
- const existing = data.attempts.find((attempt) => attempt.id === attemptId)
605
- if (existing) {
606
- return { ok: true, question: this.questionView(await this.data(), question), duplicated: true }
607
- }
608
- }
609
605
  const isChoice = CHOICE_TYPES.has(question.type)
610
606
  let result = 'pending'
611
607
  let normalizedChoice = ''
@@ -635,18 +631,23 @@ export class DailyQuestionService {
635
631
  judgedAt: mode === 'done' ? null : stamp,
636
632
  }
637
633
 
638
- await this.store.update((draft) => {
634
+ const duplicated = await this.store.update((draft) => {
639
635
  const target = draft.questions[qid]
640
636
  if (!target) throw new Error('题目不存在')
637
+ const existing = draft.attempts.find((item) => item.id === attempt.id)
638
+ if (existing) {
639
+ if (existing.questionId !== qid) throw new Error('作答 ID 已用于其他题目')
640
+ return true
641
+ }
641
642
  draft.attempts.push(attempt)
642
643
  if (target.currentAnswer && !target.currentAnswer.firstShownAt) {
643
644
  target.currentAnswer.firstShownAt = stamp
644
645
  }
645
646
  target.updatedAt = stamp
646
- return draft
647
+ return false
647
648
  })
648
649
  const fresh = await this.data()
649
- return { ok: true, question: this.questionView(fresh, fresh.questions[qid] || question) }
650
+ return { ok: true, question: this.questionView(fresh, fresh.questions[qid] || question), duplicated }
650
651
  }
651
652
 
652
653
  async judge({ qid, verdict }) {
@@ -689,6 +690,47 @@ export class DailyQuestionService {
689
690
  return { ok: true, question: this.questionView(data, data.questions[qid]), counts: this.counts(data) }
690
691
  }
691
692
 
693
+ async bulkQuestions({ qids, action, confirmProtected = false }) {
694
+ if (!Array.isArray(qids) || !qids.length || qids.some((id) => typeof id !== 'string' || !id)) {
695
+ throw new Error('请选择需要管理的题目')
696
+ }
697
+ if (!['delete', 'favorite', 'unfavorite', 'wrong', 'unwrong'].includes(action)) throw new Error('未知的批量操作')
698
+ const ids = new Set(qids)
699
+ const result = await this.store.update((draft) => {
700
+ const questions = [...ids].map((id) => {
701
+ if (!Object.hasOwn(draft.questions, id)) throw new Error('部分题目已不存在,请刷新列表后重试')
702
+ return draft.questions[id]
703
+ })
704
+ const protectedCount = questions.filter((q) => q.favoriteAt || this.isWrong(q, draft.attempts)).length
705
+ if (action === 'delete' && protectedCount && confirmProtected !== true) {
706
+ return { requiresConfirmation: true, protectedCount }
707
+ }
708
+ const stamp = nowISO()
709
+ for (const q of questions) {
710
+ if (action === 'delete') {
711
+ delete draft.questions[q.id]
712
+ delete draft.threads[q.id]
713
+ } else {
714
+ if (action === 'favorite') q.favoriteAt = stamp
715
+ if (action === 'unfavorite') q.favoriteAt = null
716
+ if (action === 'wrong' || action === 'unwrong') {
717
+ q.wrongBookAdded = action === 'wrong'
718
+ q.wrongBookRemoved = action === 'unwrong'
719
+ }
720
+ q.updatedAt = stamp
721
+ }
722
+ }
723
+ if (action === 'delete') {
724
+ draft.attempts = draft.attempts.filter((attempt) => !ids.has(attempt.questionId))
725
+ for (const [key, record] of Object.entries(draft.daily)) {
726
+ if (ids.has(record.questionId)) delete draft.daily[key]
727
+ }
728
+ }
729
+ return { affected: ids.size }
730
+ })
731
+ return { ok: true, ...result, counts: this.counts(await this.data()) }
732
+ }
733
+
692
734
  /* ------------------------------ 答案修订 ------------------------------ */
693
735
 
694
736
  async revise({ qid, reason = '' }) {
@@ -797,6 +839,7 @@ export class DailyQuestionService {
797
839
 
798
840
  // 先落盘用户消息:即使回复失败,用户输入也不会丢,并且可以按同一 id 重试。
799
841
  await this.store.update((draft) => {
842
+ if (!draft.questions[qid]) throw new Error('题目已删除')
800
843
  if (!draft.threads[qid]) {
801
844
  draft.threads[qid] = { threadId: qid, questionId: qid, messages: [], updatedAt: stamp }
802
845
  }
@@ -847,6 +890,7 @@ export class DailyQuestionService {
847
890
  status: 'sent',
848
891
  }
849
892
  await this.store.update((draft) => {
893
+ if (!draft.questions[qid]) throw new Error('题目已删除')
850
894
  if (!draft.threads[qid]) draft.threads[qid] = { threadId: qid, questionId: qid, messages: [], updatedAt: nowISO() }
851
895
  const thread = draft.threads[qid]
852
896
  const target = thread.messages.find((item) => item.id === messageId)
package/lib/store.js CHANGED
@@ -147,18 +147,18 @@ export class Store {
147
147
  const draft = structuredClone(data)
148
148
  const result = await mutate(draft)
149
149
  draft.updatedAt = new Date().toISOString()
150
+ await this.write(draft)
150
151
  this.data = draft
151
- await this.write()
152
152
  return result
153
153
  }
154
154
  this.queue = this.queue.then(run, run)
155
155
  return this.queue
156
156
  }
157
157
 
158
- async write() {
158
+ async write(data = this.data) {
159
159
  await mkdir(this.dir, { recursive: true })
160
160
  const tmp = `${this.file}.${process.pid}.${Date.now()}.tmp`
161
- await writeFile(tmp, JSON.stringify(this.data, null, 2), 'utf8')
161
+ await writeFile(tmp, JSON.stringify(data, null, 2), 'utf8')
162
162
  await rename(tmp, this.file)
163
163
  }
164
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daily-question",
3
- "version": "1.0.6",
3
+ "version": "2.0.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "考研每日一题 — DSH 插件:每科每天一道独立校验过的考研题,含倒计时、错题本、收藏与按题隔离的追问。",
@@ -46,7 +46,7 @@
46
46
  "locale/*.json",
47
47
  "icon.svg",
48
48
  "lib/*.js",
49
- "assets/*"
49
+ "vendor/mathjax/*"
50
50
  ],
51
51
  "dsh": {
52
52
  "bundle": {
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.