dcin

0.0.4-1 • Public • Published

중요안내

이 라이브러리는 더이상 작동하지 않으며 관리하지도 않습니다. 디씨 측에서 XSS 공격 방어가 제대로 이루어지지 않아 클라이언트 상에서 보안 취약점이 발생할 가능성이 커 개발을 중단하였습니다.

본 라이브러리는 MIT 라이센스를 따르므로 자유로이 수정/재배포가 가능합니다. NPM의 항목은 기록을 위해 남겨두지만, 새로 관리/개발하시는 분에게 관리권한을 드릴 의향이 있습니다.

디씨인(dcin)

node.js용 비공식 디씨인사이드 API

설치

디씨인은 npm을 통해 설치가 가능합니다.

npm install dcin

그리고 다음의 코드는 디씨인 모듈을 dcin 변수에 불러들입니다.

var dcin = require('dcin');

사용방법

글 목록

dcin.list(gall, page, function(err, lst){ ... });

gall: (String) 갤러리 아이디
page: (Number) 원하는 페이지 번호
lst : 결과값 (Array) 각 글에 대한 정보

lst의 각 항목은 다음과 같은 멤버를 가지고 있습니다.

{
    no     : (Number) 글 번호,
    reply  : (Number) 댓글 갯수,
    picture: (Boolean) 첨부그림 유무 여부,
    author : (String) 작성자 닉네임,
    member : (Number) 회원 분류 (0=비회원, 1=유동닉, 2=고정닉),
    title  : (String) 글 제목,
    date   : (Date) 작성일자,
}

글 보기

dcin.view(gall, no, function(err, content){ ... });

gall : (String) 갤러리 아이디
no : (Number) 글 번호
content: 결과값 (Object) 글 정보

content 객체는 다음과 같은 구조를 가지고 있습니다.

{
    title  : (String) 제목,
    content: (String) 글 내용,
    images : (Array) 첨부 이미지 주소,
    date   : (Date) 작성일자,
    author : {
        name: (String) 작성자,
        id  : (String) 작성자 아이디,
        ip  : (String) 작성자 아이피 (부분노출)
    }
}

댓글 보기

dcin.comments(gall, no, function(err, comments){ ... });
dcin.comments(gall, no, compage, function(err, comments){ ... });

gall : (String) 갤러리 아이디
no : (Number) 글 번호
compage : (Number) 댓글 페이지
comments: 결과값 (Array) 댓글들

{
    author: {
        name: (String) 작성자,
        id  : (String) 작성자 아이디,
        ip  : (String) 작성자 아이피 (부분노출)
    },
    comment: (String) 댓글 내용
    date: (Date) 작성일자
}

세션 생성

글이나 댓글을 쓰기 위해서는 먼저 세션을 생성해야합니다.

// 회원 세션
dcin.login(id, password, function(err, session){ ... });

// 익명 세션
dcin.guest(nickname, password, function(err, session){ ... });

id : (String) 회원 아이디
nickname: (String) 익명 닉네임
password: (String) 회원 암호 / 익명 사용자 암호
session : 결과값 (Object) 사용자 세션

글쓰기

session.write(gall, title, content, function(err, no){ ... });

gall : (String) 갤러리 아이디
title : (String) 글 제목
content: (String) 글 내용
no : 결과값 (Number) 작성된 글의 번호

댓글달기

session.writeComment(gall, no, comment, function(err, good){ ... });

gall : (String) 갤러리 아이디
no : (String) 글 번호
comment: (String) 댓글 내용
good : 결과값 (Boolean) 성공 여부

로그아웃

session.logout(function(err){ ... });

라이센스

이 라이브러리는 MIT 라이센스를 따릅니다.

Copyright (c) 2013 Eon S. Jeon

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

Package Sidebar

Install

npm i dcin

Weekly Downloads

1

Version

0.0.4-1

License

MIT

Last publish

Collaborators

  • esjeon