Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Tistory Skin API for Javascript

Unofficial Tistory Skin API for Javascript

Installation

npm install --save tistory-skin

Getting Started

const TistorySkin = require('tistory-skin');

(async function (TistorySkin) {
  /**
   * WARNING: TSSESSION is Tistory Session Cookie
   */
  const tistorySkin = new TistorySkin('__BLOG_URL__', '__TSSESSION__')

  const { skin, home, skinSettings } = await tistorySkin.settings()

  // { name: ...., }
  console.log(skin)

  /**
   * MUST call 'prepare' before Changing
   */
  const { html, css, files } = await tistorySkin.prepare()

  // { list: [ ... ]}
  console.log(files)

  const previewURL = await tistorySkin.change(
    '<html><head></head><body><h1>Hello, World!</h1></body></html>', // html
    'html{margin:0px;padding:0px;}', // css
    true // isPreview
  )

  // __BLOG_URL__/manage/previewSkin.php?skin=...
  console.log(previewURL)

  /**
   * 'mode' is able to be
   * 'index', 'entry', 'category', 'tag', 'location', 'media', 'guestbook'
   */
  const previewHTML = await tistorySkin.preview('index')

  // <html> ... </html>
  console.log(previewHTML)
})(TistorySkin)

Methods

TistorySkin(BLOG_URL: string, TSSESSION: string)

Create TistorySkin Instance

  • BLOG_URL: Tistory Blog URL
  • TESSESSION: WARNING: Tistory Login Session Cookie
new TistorySkin('https://appwriter.tistory.com', '__TSSESSION__');

TistorySkin.prepare(void)

Prepare TISTORY SKIN

skin.prepare();

TistorySkin.settings(void)

Get TISTORY SKIN settings

skin.settings();

TistorySkin.config(settings: object)

Set TISTORY SKIN settings

  • settings: Tistory Skin settings
skin.config({ homeType: 'NONE' });

TistorySkin.change(html: string, css: string, isPreview)

Change Tistory Skin

  • html: HTML String
  • css: CSS String,
  • isPreview: ture is preview mode, false is deploy mode
skin.change(
  '<html><head></head><body><h1>Hello, World!</h1></body></html>', // html
  'html{margin:0px;padding:0px;}', // css
  true // isPreview
);

TistorySkin.upload(path: string)

Upload a File on file storage of Current Tistory Skin

  • path: local file path
skin.upload('./README.md');

TistorySkin.unlink(path: string)

Delete a File on file storage of Current Tistory Skin

  • path: tistory file path.
skin.unlink('images/README.md');

TistorySkin.clear(void)

Delete all files on files storage of Current Tistory Skin

skin.clear();

TistorySkin.set(skinname: string)

set Tistory Skin

  • skinname: Tistory Skin Name
skin.set('pg_Poster');

TistorySkin.deploy(dist: string)

Deploy Tistory Skin

  • dist: dist Directory
skin.deploy('./dist');

TistorySkin.preview(settings: object)

Get preview

  • settings: Tistory Skin preview settings
skin.preview({ mode: 'index' });

TistorySkin.storage.upload(path: string)

Upload a File on Skin Storage

  • path: local file path
skin.storage.upload('./README.md');

TistorySkin.storage.unlink(filename: string)

Delete a File on Skin Storage

  • filename: DON'T USE FULL FILE PATH
// images/README.md => incorrect
skin.storage.unlink('README.md');

TistorySkin.storage.uploaded(void)

Get uploaded files on Skin Storage

skin.storage.uploaded();

TistorySkin.storage.clear(void)

Delete all files on Skin Storage

skin.storage.clear();

TistorySkin.storage.remove(skinname: string)

Delete a Skin on Skin Storage

  • skinname: Tistory Skin Name
skin.storage.remove('2710108_1549285067');

TistorySkin.storage.save(skinname: string)

Save a Tistory Skin on Skin Storage

  • skinname: Tistory Skin Name
skin.storage.save('TISTORY_SKIN');

TistorySkin.storage.store(dist: string, skinname: string)

Store a Tistory Skin on Skin Storage

  • dist: dist Directory
  • skinname: Tistory Skin Name
/**
 * - dist
 *  skin.html
 *  style.css
 *  index.xml
 *  preview*.jpg
 *  - images
 *    script.js
 *    ...
 */
skin.storage.store('./dist', 'TISTORY_SKIN');

TistorySkin.storage.archive(void)

Get stored Tistory Skins on Skin Storage

skin.storage.archive();

License

MIT

Copyright 2019-2020. SangWoo Jeong. All rights reserved.

About

티스토리 스킨을 미리보기, 배포, 파일 삭제 등의 조작할 수 있는 비공식 API

Topics

Resources

License