コミットを比較
11
コミット
| 作成者 | SHA1 | 日付 | |
|---|---|---|---|
|
|
f78a08bea1 | ||
|
|
99ae691ba1 | ||
|
|
d63e0b95fa | ||
|
|
9c4d3285f3 | ||
|
|
6cd1fd43ee | ||
|
|
d5b5fc1646 | ||
|
|
6f2f56b7b4 | ||
|
|
593e867fdd | ||
|
|
93e2f48355 | ||
|
|
bf0a2977fc | ||
|
|
11eedc242d |
@@ -3,8 +3,8 @@ namespace :nico do
|
|||||||
task export: :environment do
|
task export: :environment do
|
||||||
require 'open3'
|
require 'open3'
|
||||||
|
|
||||||
mysql_user = ENV.fetch('NIZIKA_NICO_MYSQL_USER')
|
mysql_user = ENV.fetch('MYSQL_USER')
|
||||||
mysql_pass = ENV.fetch('NIZIKA_NICO_MYSQL_PASS')
|
mysql_pass = ENV.fetch('MYSQL_PASS')
|
||||||
nizika_nico_path = ENV.fetch('NIZIKA_NICO_PATH')
|
nizika_nico_path = ENV.fetch('NIZIKA_NICO_PATH')
|
||||||
|
|
||||||
videos = Post.where('url LIKE ?', '%nicovideo.jp/watch/%').pluck(:url).filter_map {
|
videos = Post.where('url LIKE ?', '%nicovideo.jp/watch/%').pluck(:url).filter_map {
|
||||||
@@ -14,7 +14,7 @@ namespace :nico do
|
|||||||
next if videos.empty?
|
next if videos.empty?
|
||||||
|
|
||||||
_, stderr, status = Open3.capture3(
|
_, stderr, status = Open3.capture3(
|
||||||
{ 'NIZIKA_NICO_MYSQL_USER' => mysql_user, 'NIZIKA_NICO_MYSQL_PASS' => mysql_pass },
|
{ 'MYSQL_USER' => mysql_user, 'MYSQL_PASS' => mysql_pass },
|
||||||
'python3', '-m', 'tracked_videos.put_bulk_upsert', *videos,
|
'python3', '-m', 'tracked_videos.put_bulk_upsert', *videos,
|
||||||
chdir: nizika_nico_path)
|
chdir: nizika_nico_path)
|
||||||
|
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
namespace :help do
|
|
||||||
desc 'ヘルプ移行'
|
|
||||||
task migrate: :environment do
|
|
||||||
help_path = ENV.fetch('BTRC_HUB_HELP_PATH')
|
|
||||||
abort if help_path.blank?
|
|
||||||
|
|
||||||
# 現状物理削除はなぃはず
|
|
||||||
pages =
|
|
||||||
WikiPage
|
|
||||||
.joins(:tag_name)
|
|
||||||
.where(tag_names: { tag_id: nil })
|
|
||||||
.where.not("tag_names.name LIKE 'タググループ:%'")
|
|
||||||
|
|
||||||
pages.find_each do |page|
|
|
||||||
puts page.body
|
|
||||||
puts page.title
|
|
||||||
|
|
||||||
puts 'この identifier は何にする?'
|
|
||||||
identifier = $stdin.gets.chomp
|
|
||||||
Dir.mkdir "#{ help_path }/#{ identifier }"
|
|
||||||
Dir.mkdir "#{ help_path }/#{ identifier }/editions"
|
|
||||||
Dir.mkdir "#{ help_path }/#{ identifier }/editions/ja"
|
|
||||||
|
|
||||||
last_file_name = ''
|
|
||||||
WikiVersion.where(wiki_page_id: page.id).order(:version_no).each do |ver|
|
|
||||||
last_file_name, last_file_name_no = last_file_name.split('.')
|
|
||||||
|
|
||||||
file_name = ver.created_at.strftime('%Y-%m-%d')
|
|
||||||
if file_name == last_file_name
|
|
||||||
file_name += ".#{ (last_file_name_no || 1).to_i + 1 }"
|
|
||||||
end
|
|
||||||
|
|
||||||
File.write "#{ help_path }/#{ identifier }/editions/ja/#{ file_name }.mdx", ver.body
|
|
||||||
|
|
||||||
last_file_name = file_name
|
|
||||||
end
|
|
||||||
|
|
||||||
article_meta = { 'identifier' => identifier,
|
|
||||||
'canonical_language' => 'ja',
|
|
||||||
'languages' => { 'ja' => { 'current_edition' => last_file_name } } }
|
|
||||||
File.write "#{ help_path }/#{ identifier }/article.yml", article_meta.to_yaml
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -54,11 +54,11 @@ namespace :nico do
|
|||||||
.find_each(&:destroy!)
|
.find_each(&:destroy!)
|
||||||
end
|
end
|
||||||
|
|
||||||
mysql_user = ENV['NIZIKA_NICO_MYSQL_USER']
|
mysql_user = ENV['MYSQL_USER']
|
||||||
mysql_pass = ENV['NIZIKA_NICO_MYSQL_PASS']
|
mysql_pass = ENV['MYSQL_PASS']
|
||||||
nizika_nico_path = ENV['NIZIKA_NICO_PATH']
|
nizika_nico_path = ENV['NIZIKA_NICO_PATH']
|
||||||
stdout, stderr, status = Open3.capture3(
|
stdout, stderr, status = Open3.capture3(
|
||||||
{ 'NIZIKA_NICO_MYSQL_USER' => mysql_user, 'NIZIKA_NICO_MYSQL_PASS' => mysql_pass },
|
{ 'MYSQL_USER' => mysql_user, 'MYSQL_PASS' => mysql_pass },
|
||||||
'python3', "#{ nizika_nico_path }/get_videos.py")
|
'python3', "#{ nizika_nico_path }/get_videos.py")
|
||||||
|
|
||||||
unless status.success?
|
unless status.success?
|
||||||
|
|||||||
@@ -22,5 +22,3 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
|
||||||
/help
|
|
||||||
|
|||||||
生成ファイル
+43
-4
@@ -38,7 +38,6 @@
|
|||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"tailwind-merge": "^3.3.0",
|
"tailwind-merge": "^3.3.0",
|
||||||
"unist-util-visit-parents": "^6.0.1",
|
"unist-util-visit-parents": "^6.0.1",
|
||||||
"yaml": "^2.9.1",
|
|
||||||
"zustand": "^5.0.8"
|
"zustand": "^5.0.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -2061,6 +2060,9 @@
|
|||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2075,6 +2077,9 @@
|
|||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2089,6 +2094,9 @@
|
|||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2103,6 +2111,9 @@
|
|||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2117,6 +2128,9 @@
|
|||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2131,6 +2145,9 @@
|
|||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2145,6 +2162,9 @@
|
|||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2159,6 +2179,9 @@
|
|||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2173,6 +2196,9 @@
|
|||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2187,6 +2213,9 @@
|
|||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2201,6 +2230,9 @@
|
|||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2215,6 +2247,9 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"glibc"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -2229,6 +2264,9 @@
|
|||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"libc": [
|
||||||
|
"musl"
|
||||||
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@@ -9076,9 +9114,10 @@
|
|||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
"node_modules/yaml": {
|
"node_modules/yaml": {
|
||||||
"version": "2.9.1",
|
"version": "2.8.3",
|
||||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
|
||||||
"integrity": "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==",
|
"integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
|
||||||
|
"dev": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"bin": {
|
"bin": {
|
||||||
"yaml": "bin.mjs"
|
"yaml": "bin.mjs"
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"tailwind-merge": "^3.3.0",
|
"tailwind-merge": "^3.3.0",
|
||||||
"unist-util-visit-parents": "^6.0.1",
|
"unist-util-visit-parents": "^6.0.1",
|
||||||
"yaml": "^2.9.1",
|
|
||||||
"zustand": "^5.0.8"
|
"zustand": "^5.0.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
import { parse } from 'yaml'
|
|
||||||
|
|
||||||
import type { ComponentType } from 'react'
|
|
||||||
|
|
||||||
type ArticleLanguage = {
|
|
||||||
title: string
|
|
||||||
currentEdition: string }
|
|
||||||
|
|
||||||
type ArticleMeta = {
|
|
||||||
identifier: string
|
|
||||||
canonicalLanguage: string
|
|
||||||
languages: Record<string, ArticleLanguage> }
|
|
||||||
|
|
||||||
type MdxModule = { default: ComponentType }
|
|
||||||
|
|
||||||
|
|
||||||
const articleFiles = import.meta.glob<string> (
|
|
||||||
'../../help/*/article.yml',
|
|
||||||
{ query: '?raw', import: 'default', eager: true, })
|
|
||||||
|
|
||||||
const editionFiles = import.meta.glob<MdxModule> ('../../help/*/editions/*/*.mdx')
|
|
||||||
|
|
||||||
|
|
||||||
const cameliseArticle = (value: {
|
|
||||||
identifier: string
|
|
||||||
canonical_language: string
|
|
||||||
languages: Record<string, {
|
|
||||||
title: string
|
|
||||||
current_edition: string }> }): ArticleMeta => (
|
|
||||||
{ identifier: value.identifier,
|
|
||||||
canonicalLanguage: value.canonical_language,
|
|
||||||
languages: Object.fromEntries (
|
|
||||||
Object.entries (value.languages).map (([language, data]) => [
|
|
||||||
language,
|
|
||||||
{ title: data.title,
|
|
||||||
currentEdition: data.current_edition, }])) })
|
|
||||||
|
|
||||||
|
|
||||||
export const getHelpArticle = (identifier: string): ArticleMeta | undefined => {
|
|
||||||
const path = `../../help/${identifier}/article.yml`
|
|
||||||
const source = articleFiles[path]
|
|
||||||
|
|
||||||
if (!(source))
|
|
||||||
return undefined
|
|
||||||
|
|
||||||
return cameliseArticle (parse (source))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const getHelpEditions = (
|
|
||||||
identifier: string,
|
|
||||||
language: string,
|
|
||||||
): string[] => {
|
|
||||||
const prefix = `../../help/${identifier}/editions/${language}/`
|
|
||||||
|
|
||||||
return (Object.keys (editionFiles)
|
|
||||||
.filter (path => path.startsWith (prefix))
|
|
||||||
.map (path => path.slice (prefix.length, -'.mdx'.length))
|
|
||||||
.sort ())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const getHelpEdition = async (
|
|
||||||
identifier: string,
|
|
||||||
language: string,
|
|
||||||
edition: string,
|
|
||||||
): Promise<ComponentType | undefined> => {
|
|
||||||
const path = `../../help/${identifier}/editions/${language}/${edition}.mdx`
|
|
||||||
const loader = editionFiles[path]
|
|
||||||
|
|
||||||
if (!(loader))
|
|
||||||
return undefined
|
|
||||||
|
|
||||||
return (await loader ()).default
|
|
||||||
}
|
|
||||||
新しいイシューから参照
ユーザーをブロックする