在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):nytimes/library开源软件地址(OpenSource Url):https://github.com/nytimes/library开源编程语言(OpenSource Language):JavaScript 68.1%开源软件介绍(OpenSource Introduction):LibraryA collaborative newsroom documentation site, powered by Google Docs. Table of Contents
Demo Site & User GuideDocumentation about how to get started with Library is hosted as a working (read only) demo on Heroku. Consult the site for more detailed instructions than this readme about how to get the most out of Library: https://nyt-library-demo.herokuapp.com. Contacting usLove Library? Let us know by joining our Google Group and dropping us a line. You'll also stay up to date with the latest Library features via our release notes, which get sent to this list. CommunityHere are some of the organizations using Library so far. Northwestern University Knight Lab The Los Angeles Times Data and Graphics Department ContributingSee CONTRIBUTING.md for information on how to contribute code and/or documentation on GitHub or on the demo site. QuestionsIf you have questions about how to get your copy of Library up and running, join our Google Group, and let us know what you're running into. We also keep an eye on the #proj-library channel in the News Nerdery Slack. We'll do our best to answer your questions. Development Workflow
# node environment (development or production)
NODE_ENV=development
# Google oAuth credentials
GOOGLE_CLIENT_ID=123456-abcdefg.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=abcxyz12345
GCP_PROJECT_ID=library-demo-1234
# comma separated list of approved access domains or email addresses (regex is supported).
APPROVED_DOMAINS="nytimes.com,dailypennsylvanian.com,(.*)?ar.org,[email protected]"
SESSION_SECRET=supersecretvalue
# Google drive Configuration
# team or folder ("folder" if using a folder instead of a team drive)
DRIVE_TYPE=team
# the ID of your team's drive or shared folder. The string of random numbers and letters at the end of your team drive or folder url.
DRIVE_ID=0123456ABCDEF Make sure to not put any comments in the same line as Ensure you share your base drive or folder with the email address associated with the service account created in step 2. Be careful! Setting NODE_ENV to
The app should now be running at TestsYou can run functional and unit tests, which test HTML parsing and routing logic, with The HTML parsing tests are based on the Supported Formats doc. To download a fresh copy of the HTML after making edits, run CustomizationStyles, text, caching logic, and middleware can be customized to match the branding of your organization. This is covered in the customization readme. A sample customization repo is provided at nytimes/library-customization-example. Deploying the appWherever you deploy Library, you'll likely want to set up a Google service account and OAuth 2.0 client Set up your service account with API access to Drive and Cloud Datastore. If you wish to deploy Library with customizations, create a git repo with the files you would like to include. Set the For more detailed instructions, consult the Getting Started section of the demo site: https://nyt-library-demo.herokuapp.com/get-started Using HerokuThis button can quickly deploy to Heroku: Set your app's Using Google App EngineYou can also deploy Library to GAE, using the included Using DockerLibrary can be used as a base image for deployment using Docker. This allows you
to automate building and deploying a custom version of Library during Docker's
build phase. If you create a repo with the contents of your FROM nytimes/library
# copy custom files to library's custom repo
COPY . ./custom/
# move to a temporary folder install custom npm packages
WORKDIR /usr/src/tmp
COPY package*.json .npmrc ./
RUN npm i
# copy node modules required by custom node modules
RUN yes | cp -rf ./node_modules/* /usr/src/app/node_modules
# return to app directory and build
WORKDIR /usr/src/app
RUN npm run build
# start app
CMD [ "npm", "start" ] Standard DeploymentLibrary is a standard node app, so it can be deployed just about anywhere. If you are looking to deploy to a standard VPS, Digital Ocean's tutorials are a great resource. App structureServerThe main entry point to the app is This file contains the express server which will respond to requests for docs in the configured team drive or shared folder. Additionally, it contains logic about issuing 404s and selecting the template to use based on the path. ViewsViews (layouts) are located in the Base styles for the views are in the Doc parsingDoc HTML fetch and parsing is handled by Listing the driveTraversing the contents of the NYT Docs folder is handled by
The tree and file metadata are repopulated into memory on an interval (currently 60s). Calling getTree multiple times will not return fresher data. AuthAuthentication with the Google Drive v3 api is handled by the auth.js file, which exposes a single method User AuthenticationLibrary currently supports both Slack and Google Oauth methods. As Library sites are usually intended to be internal to a set of limited users, Oauth with your organization is strongly encouraged. To use Slack Oauth, specify your Oauth strategy in your
You will need to provide Slack credentials, which you can do by creating a Library Oauth app in your Slack workspace. After creating the app, save the app's
You will need to add a callback URL to your Slack app to allow Slack to redirect back to your Library instance after the user is authenticated. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论