diff options
author | przemyslawpluta <przemekpluta@hotmail.com> | 2015-08-06 22:06:44 +0100 |
---|---|---|
committer | przemyslawpluta <przemekpluta@hotmail.com> | 2015-08-06 22:06:44 +0100 |
commit | 26d1a1af0a7ad4d8fef24be22bd579ed292fc2f3 (patch) | |
tree | eb05b13ed0eabffca6f57ab08d7821ecc20020f4 | |
parent | 6dfe97bfb474c53d91ee000f30ac8d5a4bcf0be9 (diff) | |
download | mongo-edu-26d1a1af0a7ad4d8fef24be22bd579ed292fc2f3.zip |
add video preferences check and control
-rw-r--r-- | lib/emoji.js | 859 | ||||
-rw-r--r-- | lib/initialize.js | 47 | ||||
-rw-r--r-- | lib/login.js | 59 | ||||
-rw-r--r-- | lib/prompts.js | 2 | ||||
-rw-r--r-- | package.json | 8 |
5 files changed, 957 insertions, 18 deletions
diff --git a/lib/emoji.js b/lib/emoji.js new file mode 100644 index 0000000..112b2cd --- /dev/null +++ b/lib/emoji.js @@ -0,0 +1,859 @@ +'use strict'; + +// via emoji-named-characters +module.exports = { + "100": "๐ฏ", + "1234": "๐ข", + "+1": "๐", + "-1": "๐", + "8ball": "๐ฑ", + "a": "๐
ฐ", + "ab": "๐", + "abc": "๐ค", + "abcd": "๐ก", + "accept": "๐", + "aerial_tramway": "๐ก", + "airplane": "โ๏ธ", + "alarm_clock": "โฐ", + "alien": "๐ฝ", + "ambulance": "๐", + "anchor": "โ๏ธ", + "angel": "๐ผ", + "anger": "๐ข", + "angry": "๐ ", + "anguished": "๐", + "ant": "๐", + "apple": "๐", + "aquarius": "โ๏ธ", + "aries": "โ๏ธ", + "arrow_backward": "โ๏ธ", + "arrow_double_down": "โฌ", + "arrow_double_up": "โซ", + "arrow_down": "โฌ๏ธ", + "arrow_down_small": "๐ฝ", + "arrow_forward": "โถ๏ธ", + "arrow_heading_down": "โคต๏ธ", + "arrow_heading_up": "โคด๏ธ", + "arrow_left": "โฌ
๏ธ", + "arrow_lower_left": "โ๏ธ", + "arrow_lower_right": "โ๏ธ", + "arrow_right": "โก๏ธ", + "arrow_right_hook": "โช๏ธ", + "arrow_up": "โฌ๏ธ", + "arrow_up_down": "โ๏ธ", + "arrow_up_small": "๐ผ", + "arrow_upper_left": "โ๏ธ", + "arrow_upper_right": "โ๏ธ", + "arrows_clockwise": "๐", + "arrows_counterclockwise": "๐", + "art": "๐จ", + "articulated_lorry": "๐", + "astonished": "๐ฒ", + "atm": "๐ง", + "b": "๐
ฑ", + "baby": "๐ถ", + "baby_bottle": "๐ผ", + "baby_chick": "๐ค", + "baby_symbol": "๐ผ", + "baggage_claim": "๐", + "balloon": "๐", + "ballot_box_with_check": "โ๏ธ", + "bamboo": "๐", + "banana": "๐", + "bangbang": "โผ๏ธ", + "bank": "๐ฆ", + "bar_chart": "๐", + "barber": "๐", + "baseball": "โพ๏ธ", + "basketball": "๐", + "bath": "๐", + "bathtub": "๐", + "battery": "๐", + "bear": "๐ป", + "bee": "๐", + "beer": "๐บ", + "beers": "๐ป", + "beetle": "๐", + "beginner": "๐ฐ", + "bell": "๐", + "bento": "๐ฑ", + "bicyclist": "๐ด", + "bike": "๐ฒ", + "bikini": "๐", + "bird": "๐ฆ", + "birthday": "๐", + "black_circle": "โซ", + "black_joker": "๐", + "black_nib": "โ๏ธ", + "black_square": "โฌ๏ธ", + "black_square_button": "๐ฒ", + "blossom": "๐ผ", + "blowfish": "๐ก", + "blue_book": "๐", + "blue_car": "๐", + "blue_heart": "๐", + "blush": "๐", + "boar": "๐", + "boat": "โต๏ธ", + "bomb": "๐ฃ", + "book": "๐", + "bookmark": "๐", + "bookmark_tabs": "๐", + "books": "๐", + "boom": "๐ฅ", + "boot": "๐ข", + "bouquet": "๐", + "bow": "๐", + "bowling": "๐ณ", + "boy": "๐ฆ", + "bread": "๐", + "bride_with_veil": "๐ฐ", + "bridge_at_night": "๐", + "briefcase": "๐ผ", + "broken_heart": "๐", + "bug": "๐", + "bulb": "๐ก", + "bullettrain_front": "๐", + "bullettrain_side": "๐
", + "bus": "๐", + "busstop": "๐", + "bust_in_silhouette": "๐ค", + "busts_in_silhouette": "๐ฅ", + "cactus": "๐ต", + "cake": "๐ฐ", + "calendar": "๐", + "calling": "๐ฒ", + "camel": "๐ซ", + "camera": "๐ท", + "cancer": "โ๏ธ", + "candy": "๐ฌ", + "capital_abcd": "๐ ", + "capricorn": "โ๏ธ", + "car": "๐", + "card_index": "๐", + "carousel_horse": "๐ ", + "cat": "๐ฑ", + "cat2": "๐", + "cd": "๐ฟ", + "chart": "๐น", + "chart_with_downwards_trend": "๐", + "chart_with_upwards_trend": "๐", + "checkered_flag": "๐", + "cherries": "๐", + "cherry_blossom": "๐ธ", + "chestnut": "๐ฐ", + "chicken": "๐", + "children_crossing": "๐ธ", + "chocolate_bar": "๐ซ", + "christmas_tree": "๐", + "church": "โช๏ธ", + "cinema": "๐ฆ", + "circus_tent": "๐ช", + "city_sunrise": "๐", + "city_sunset": "๐", + "cl": "๐", + "clap": "๐", + "clapper": "๐ฌ", + "clipboard": "๐", + "clock1": "๐", + "clock10": "๐", + "clock1030": "๐ฅ", + "clock11": "๐", + "clock1130": "๐ฆ", + "clock12": "๐", + "clock1230": "๐ง", + "clock130": "๐", + "clock2": "๐", + "clock230": "๐", + "clock3": "๐", + "clock330": "๐", + "clock4": "๐", + "clock430": "๐", + "clock5": "๐", + "clock530": "๐ ", + "clock6": "๐", + "clock630": "๐ก", + "clock7": "๐", + "clock730": "๐ข", + "clock8": "๐", + "clock830": "๐ฃ", + "clock9": "๐", + "clock930": "๐ค", + "closed_book": "๐", + "closed_lock_with_key": "๐", + "closed_umbrella": "๐", + "cloud": "โ๏ธ", + "clubs": "โฃ๏ธ", + "cn": "๐จ๐ณ", + "cocktail": "๐ธ", + "coffee": "โ๏ธ", + "cold_sweat": "๐ฐ", + "collision": "๐ฅ", + "computer": "๐ป", + "confetti_ball": "๐", + "confounded": "๐", + "confused": "๐", + "congratulations": "ใ๏ธ", + "construction": "๐ง", + "construction_worker": "๐ท", + "convenience_store": "๐ช", + "cookie": "๐ช", + "cool": "๐", + "cop": "๐ฎ", + "copyright": "ยฉ", + "corn": "๐ฝ", + "couple": "๐ซ", + "couple_with_heart": "๐", + "couplekiss": "๐", + "cow": "๐ฎ", + "cow2": "๐", + "credit_card": "๐ณ", + "crocodile": "๐", + "crossed_flags": "๐", + "crown": "๐", + "cry": "๐ข", + "crying_cat_face": "๐ฟ", + "crystal_ball": "๐ฎ", + "cupid": "๐", + "curly_loop": "โฐ", + "currency_exchange": "๐ฑ", + "curry": "๐", + "custard": "๐ฎ", + "customs": "๐", + "cyclone": "๐", + "dancer": "๐", + "dancers": "๐ฏ", + "dango": "๐ก", + "dart": "๐ฏ", + "dash": "๐จ", + "date": "๐
", + "de": "๐ฉ๐ช", + "deciduous_tree": "๐ณ", + "department_store": "๐ฌ", + "diamond_shape_with_a_dot_inside": "๐ ", + "diamonds": "โฆ๏ธ", + "disappointed": "๐", + "disappointed_relieved": "๐ฅ", + "dizzy": "๐ซ", + "dizzy_face": "๐ต", + "do_not_litter": "๐ฏ", + "dog": "๐ถ", + "dog2": "๐", + "dollar": "๐ต", + "dolls": "๐", + "dolphin": "๐ฌ", + "donut": "๐ฉ", + "door": "๐ช", + "doughnut": "๐ฉ", + "dragon": "๐", + "dragon_face": "๐ฒ", + "dress": "๐", + "dromedary_camel": "๐ช", + "droplet": "๐ง", + "dvd": "๐", + "e-mail": "๐ง", + "ear": "๐", + "ear_of_rice": "๐พ", + "earth_africa": "๐", + "earth_americas": "๐", + "earth_asia": "๐", + "egg": "๐ณ", + "eggplant": "๐", + "eight": "8๏ธโฃ", + "eight_pointed_black_star": "โด๏ธ", + "eight_spoked_asterisk": "โณ๏ธ", + "electric_plug": "๐", + "elephant": "๐", + "email": "๐ฉ", + "end": "๐", + "envelope": "โ๏ธ", + "es": "๐ช๐ธ", + "euro": "๐ถ", + "european_castle": "๐ฐ", + "european_post_office": "๐ค", + "evergreen_tree": "๐ฒ", + "exclamation": "โ๏ธ", + "expressionless": "๐", + "eyeglasses": "๐", + "eyes": "๐", + "facepunch": "๐", + "factory": "๐ญ", + "fallen_leaf": "๐", + "family": "๐ช", + "fast_forward": "โฉ", + "fax": "๐ ", + "fearful": "๐จ", + "feet": "๐ฃ", + "ferris_wheel": "๐ก", + "file_folder": "๐", + "fire": "๐ฅ", + "fire_engine": "๐", + "fireworks": "๐", + "first_quarter_moon": "๐", + "first_quarter_moon_with_face": "๐", + "fish": "๐", + "fish_cake": "๐ฅ", + "fishing_pole_and_fish": "๐ฃ", + "fist": "โ", + "five": "5๏ธโฃ", + "flags": "๐", + "flashlight": "๐ฆ", + "floppy_disk": "๐พ", + "flower_playing_cards": "๐ด", + "flushed": "๐ณ", + "foggy": "๐", + "football": "๐", + "fork_and_knife": "๐ด", + "fountain": "โฒ๏ธ", + "four": "4๏ธโฃ", + "four_leaf_clover": "๐", + "fr": "๐ซ๐ท", + "free": "๐", + "fried_shrimp": "๐ค", + "fries": "๐", + "frog": "๐ธ", + "frowning": "๐ฆ", + "fuelpump": "โฝ๏ธ", + "full_moon": "๐", + "full_moon_with_face": "๐", + "game_die": "๐ฒ", + "gb": "๐ฌ๐ง", + "gem": "๐", + "gemini": "โ๏ธ", + "ghost": "๐ป", + "gift": "๐", + "gift_heart": "๐", + "girl": "๐ง", + "globe_with_meridians": "๐", + "goat": "๐", + "golf": "โณ๏ธ", + "grapes": "๐", + "green_apple": "๐", + "green_book": "๐", + "green_heart": "๐", + "grey_exclamation": "โ", + "grey_question": "โ", + "grimacing": "๐ฌ", + "grin": "๐", + "grinning": "๐", + "guardsman": "๐", + "guitar": "๐ธ", + "gun": "๐ซ", + "haircut": "๐", + "hamburger": "๐", + "hammer": "๐จ", + "hamster": "๐น", + "hand": "โ", + "handbag": "๐", + "hankey": "๐ฉ", + "hash": "#๏ธโฃ", + "hatched_chick": "๐ฅ", + "hatching_chick": "๐ฃ", + "headphones": "๐ง", + "hear_no_evil": "๐", + "heart": "โค๏ธ", + "heart_decoration": "๐", + "heart_eyes": "๐", + "heart_eyes_cat": "๐ป", + "heartbeat": "๐", + "heartpulse": "๐", + "hearts": "โฅ๏ธ", + "heavy_check_mark": "โ๏ธ", + "heavy_division_sign": "โ", + "heavy_dollar_sign": "๐ฒ", + "heavy_exclamation_mark": "โ๏ธ", + "heavy_minus_sign": "โ", + "heavy_multiplication_x": "โ๏ธ", + "heavy_plus_sign": "โ", + "helicopter": "๐", + "herb": "๐ฟ", + "hibiscus": "๐บ", + "high_brightness": "๐", + "high_heel": "๐ ", + "hocho": "๐ช", + "honey_pot": "๐ฏ", + "honeybee": "๐", + "horse": "๐ด", + "horse_racing": "๐", + "hospital": "๐ฅ", + "hotel": "๐จ", + "hotsprings": "โจ๏ธ", + "hourglass": "โ๏ธ", + "hourglass_flowing_sand": "โณ", + "house": "๐ ", + "house_with_garden": "๐ก", + "hushed": "๐ง", + "ice_cream": "๐จ", + "icecream": "๐ฆ", + "id": "๐", + "ideograph_advantage": "๐", + "imp": "๐ฟ", + "inbox_tray": "๐ฅ", + "incoming_envelope": "๐จ", + "information_desk_person": "๐", + "information_source": "โน๏ธ", + "innocent": "๐", + "interrobang": "โ๏ธ", + "iphone": "๐ฑ", + "it": "๐ฎ๐น", + "izakaya_lantern": "๐ฎ", + "jack_o_lantern": "๐", + "japan": "๐พ", + "japanese_castle": "๐ฏ", + "japanese_goblin": "๐บ", + "japanese_ogre": "๐น", + "jeans": "๐", + "joy": "๐", + "joy_cat": "๐น", + "jp": "๐ฏ๐ต", + "key": "๐", + "keycap_ten": "๐", + "kimono": "๐", + "kiss": "๐", + "kissing": "๐", + "kissing_cat": "๐ฝ", + "kissing_closed_eyes": "๐", + "kissing_face": "๐", + "kissing_heart": "๐", + "kissing_smiling_eyes": "๐", + "koala": "๐จ", + "koko": "๐", + "kr": "๐ฐ๐ท", + "large_blue_circle": "๐ต", + "large_blue_diamond": "๐ท", + "large_orange_diamond": "๐ถ", + "last_quarter_moon": "๐", + "last_quarter_moon_with_face": "๐", + "laughing": "๐", + "leaves": "๐", + "ledger": "๐", + "left_luggage": "๐
", + "left_right_arrow": "โ๏ธ", + "leftwards_arrow_with_hook": "โฉ๏ธ", + "lemon": "๐", + "leo": "โ๏ธ", + "leopard": "๐", + "libra": "โ๏ธ", + "light_rail": "๐", + "link": "๐", + "lips": "๐", + "lipstick": "๐", + "lock": "๐", + "lock_with_ink_pen": "๐", + "lollipop": "๐ญ", + "loop": "โฟ", + "loudspeaker": "๐ข", + "love_hotel": "๐ฉ", + "love_letter": "๐", + "low_brightness": "๐
", + "m": "โ", + "mag": "๐", + "mag_right": "๐", + "mahjong": "๐๏ธ", + "mailbox": "๐ซ", + "mailbox_closed": "๐ช", + "mailbox_with_mail": "๐ฌ", + "mailbox_with_no_mail": "๐ญ", + "man": "๐จ", + "man_with_gua_pi_mao": "๐ฒ", + "man_with_turban": "๐ณ", + "mans_shoe": "๐", + "maple_leaf": "๐", + "mask": "๐ท", + "massage": "๐", + "meat_on_bone": "๐", + "mega": "๐ฃ", + "melon": "๐", + "memo": "๐", + "mens": "๐น", + "metro": "๐", + "microphone": "๐ค", + "microscope": "๐ฌ", + "milky_way": "๐", + "minibus": "๐", + "minidisc": "๐ฝ", + "mobile_phone_off": "๐ด", + "money_with_wings": "๐ธ", + "moneybag": "๐ฐ", + "monkey": "๐", + "monkey_face": "๐ต", + "monorail": "๐", + "moon": "๐", + "mortar_board": "๐", + "mount_fuji": "๐ป", + "mountain_bicyclist": "๐ต", + "mountain_cableway": "๐ ", + "mountain_railway": "๐", + "mouse": "๐ญ", + "mouse2": "๐", + "movie_camera": "๐ฅ", + "moyai": "๐ฟ", + "muscle": "๐ช", + "mushroom": "๐", + "musical_keyboard": "๐น", + "musical_note": "๐ต", + "musical_score": "๐ผ", + "mute": "๐", + "nail_care": "๐
", + "name_badge": "๐", + "necktie": "๐", + "negative_squared_cross_mark": "โ", + "neutral_face": "๐", + "new": "๐", + "new_moon": "๐", + "new_moon_with_face": "๐", + "newspaper": "๐ฐ", + "ng": "๐", + "nine": "9๏ธโฃ", + "no_bell": "๐", + "no_bicycles": "๐ณ", + "no_entry": "โ๏ธ", + "no_entry_sign": "๐ซ", + "no_good": "๐
", + "no_mobile_phones": "๐ต", + "no_mouth": "๐ถ", + "no_pedestrians": "๐ท", + "no_smoking": "๐ญ", + "non-potable_water": "๐ฑ", + "nose": "๐", + "notebook": "๐", + "notebook_with_decorative_cover": "๐", + "notes": "๐ถ", + "nut_and_bolt": "๐ฉ", + "o": "โญ๏ธ", + "o2": "๐
พ", + "ocean": "๐", + "octopus": "๐", + "oden": "๐ข", + "office": "๐ข", + "ok": "๐", + "ok_hand": "๐", + "ok_woman": "๐", + "older_man": "๐ด", + "older_woman": "๐ต", + "on": "๐", + "oncoming_automobile": "๐", + "oncoming_bus": "๐", + "oncoming_police_car": "๐", + "oncoming_taxi": "๐", + "one": "1๏ธโฃ", + "open_file_folder": "๐", + "open_hands": "๐", + "open_mouth": "๐ฎ", + "ophiuchus": "โ", + "orange_book": "๐", + "outbox_tray": "๐ค", + "ox": "๐", + "page_facing_up": "๐", + "page_with_curl": "๐", + "pager": "๐", + "palm_tree": "๐ด", + "panda_face": "๐ผ", + "paperclip": "๐", + "parking": "๐
ฟ๏ธ", + "part_alternation_mark": "ใฝ๏ธ", + "partly_sunny": "โ
๏ธ", + "passport_control": "๐", + "paw_prints": "๐พ", + "peach": "๐", + "pear": "๐", + "pencil": "๐", + "pencil2": "โ๏ธ", + "penguin": "๐ง", + "pensive": "๐", + "performing_arts": "๐ญ", + "persevere": "๐ฃ", + "person_frowning": "๐", + "person_with_blond_hair": "๐ฑ", + "person_with_pouting_face": "๐", + "phone": "โ๏ธ", + "pig": "๐ท", + "pig2": "๐", + "pig_nose": "๐ฝ", + "pill": "๐", + "pineapple": "๐", + "pisces": "โ๏ธ", + "pizza": "๐", + "plus1": "๐", + "point_down": "๐", + "point_left": "๐", + "point_right": "๐", + "point_up": "โ๏ธ", + "point_up_2": "๐", + "police_car": "๐", + "poodle": "๐ฉ", + "poop": "๐ฉ", + "post_office": "๐ฃ", + "postal_horn": "๐ฏ", + "postbox": "๐ฎ", + "potable_water": "๐ฐ", + "pouch": "๐", + "poultry_leg": "๐", + "pound": "๐ท", + "pouting_cat": "๐พ", + "pray": "๐", + "princess": "๐ธ", + "punch": "๐", + "purple_heart": "๐", + "purse": "๐", + "pushpin": "๐", + "put_litter_in_its_place": "๐ฎ", + "question": "โ", + "rabbit": "๐ฐ", + "rabbit2": "๐", + "racehorse": "๐", + "radio": "๐ป", + "radio_button": "๐", + "rage": "๐ก", + "railway_car": "๐", + "rainbow": "๐", + "raised_hand": "โ", + "raised_hands": "๐", + "raising_hand": "๐", + "ram": "๐", + "ramen": "๐", + "rat": "๐", + "recycle": "โป๏ธ", + "red_car": "๐", + "red_circle": "๐ด", + "registered": "ยฎ", + "relaxed": "โบ๏ธ", + "relieved": "๐", + "repeat": "๐", + "repeat_one": "๐", + "restroom": "๐ป", + "revolving_hearts": "๐", + "rewind": "โช", + "ribbon": "๐", + "rice": "๐", + "rice_ball": "๐", + "rice_cracker": "๐", + "rice_scene": "๐", + "ring": "๐", + "rocket": "๐", + "roller_coaster": "๐ข", + "rooster": "๐", + "rose": "๐น", + "rotating_light": "๐จ", + "round_pushpin": "๐", + "rowboat": "๐ฃ", + "ru": "๐ท๐บ", + "rugby_football": "๐", + "runner": "๐", + "running": "๐", + "running_shirt_with_sash": "๐ฝ", + "sa": "๐", + "sagittarius": "โ๏ธ", + "sailboat": "โต๏ธ", + "sake": "๐ถ", + "sandal": "๐ก", + "santa": "๐
", + "satellite": "๐ก", + "satisfied": "๐", + "saxophone": "๐ท", + "school": "๐ซ", + "school_satchel": "๐", + "scissors": "โ๏ธ", + "scorpius": "โ๏ธ", + "scream": "๐ฑ", + "scream_cat": "๐", + "scroll": "๐", + "seat": "๐บ", + "secret": "ใ๏ธ", + "see_no_evil": "๐", + "seedling": "๐ฑ", + "seven": "7๏ธโฃ", + "shaved_ice": "๐ง", + "sheep": "๐", + "shell": "๐", + "ship": "๐ข", + "shirt": "๐", + "shit": "๐ฉ", + "shoe": "๐", + "shower": "๐ฟ", + "signal_strength": "๐ถ", + "six": "6๏ธโฃ", + "six_pointed_star": "๐ฏ", + "ski": "๐ฟ", + "skull": "๐", + "sleeping": "๐ด", + "sleepy": "๐ช", + "slot_machine": "๐ฐ", + "small_blue_diamond": "๐น", + "small_orange_diamond": "๐ธ", + "small_red_triangle": "๐บ", + "small_red_triangle_down": "๐ป", + "smile": "๐", + "smile_cat": "๐ธ", + "smiley": "๐", + "smiley_cat": "๐บ", + "smiling_imp": "๐", + "smirk": "๐", + "smirk_cat": "๐ผ", + "smoking": "๐ฌ", + "snail": "๐", + "snake": "๐", + "snowboarder": "๐", + "snowflake": "โ๏ธ", + "snowman": "โ๏ธ", + "sob": "๐ญ", + "soccer": "โฝ๏ธ", + "soon": "๐", + "sos": "๐", + "sound": "๐", + "space_invader": "๐พ", + "spades": "โ ๏ธ", + "spaghetti": "๐", + "sparkler": "๐", + "sparkles": "โจ", + "sparkling_heart": "๐", + "speak_no_evil": "๐", + "speaker": "๐", + "speech_balloon": "๐ฌ", + "speedboat": "๐ค", + "star": "โญ๏ธ", + "star2": "๐", + "stars": "๐ ", + "station": "๐", + "statue_of_liberty": "๐ฝ", + "steam_locomotive": "๐", + "stew": "๐ฒ", + "straight_ruler": "๐", + "strawberry": "๐", + "stuck_out_tongue": "๐", + "stuck_out_tongue_closed_eyes": "๐", + "stuck_out_tongue_winking_eye": "๐", + "sun_with_face": "๐", + "sunflower": "๐ป", + "sunglasses": "๐", + "sunny": "โ๏ธ", + "sunrise": "๐
", + "sunrise_over_mountains": "๐", + "surfer": "๐", + "sushi": "๐ฃ", + "suspension_railway": "๐", + "sweat": "๐", + "sweat_drops": "๐ฆ", + "sweat_smile": "๐
", + "sweet_potato": "๐ ", + "swimmer": "๐", + "symbols": "๐ฃ", + "syringe": "๐", + "tada": "๐", + "tanabata_tree": "๐", + "tangerine": "๐", + "taurus": "โ๏ธ", + "taxi": "๐", + "tea": "๐ต", + "telephone": "โ๏ธ", + "telephone_receiver": "๐", + "telescope": "๐ญ", + "tennis": "๐พ", + "tent": "โบ๏ธ", + "thought_balloon": "๐ญ", + "three": "3๏ธโฃ", + "thumbsdown": "๐", + "thumbsup": "๐", + "ticket": "๐ซ", + "tiger": "๐ฏ", + "tiger2": "๐
", + "tired_face": "๐ซ", + "tm": "โข", + "toilet": "๐ฝ", + "tokyo_tower": "๐ผ", + "tomato": "๐
", + "tongue": "๐
", + "top": "๐", + "tophat": "๐ฉ", + "tractor": "๐", + "traffic_light": "๐ฅ", + "train": "๐", + "train2": "๐", + "tram": "๐", + "triangular_flag_on_post": "๐ฉ", + "triangular_ruler": "๐", + "trident": "๐ฑ", + "triumph": "๐ค", + "trolleybus": "๐", + "trophy": "๐", + "tropical_drink": "๐น", + "tropical_fish": "๐ ", + "truck": "๐", + "trumpet": "๐บ", + "tshirt": "๐", + "tulip": "๐ท", + "turtle": "๐ข", + "tv": "๐บ", + "twisted_rightwards_arrows": "๐", + "two": "2๏ธโฃ", + "two_hearts": "๐", + "two_men_holding_hands": "๐ฌ", + "two_women_holding_hands": "๐ญ", + "u5272": "๐น", + "u5408": "๐ด", + "u55b6": "๐บ", + "u6307": "๐ฏ๏ธ", + "u6708": "๐ท", + "u6709": "๐ถ", + "u6e80": "๐ต", + "u7121": "๐๏ธ", + "u7533": "๐ธ", + "u7981": "๐ฒ", + "u7a7a": "๐ณ", + "uk": "๐ฌ๐ง", + "umbrella": "โ๏ธ", + "unamused": "๐", + "underage": "๐", + "unlock": "๐", + "up": "๐", + "us": "๐บ๐ธ", + "v": "โ๏ธ", + "vertical_traffic_light": "๐ฆ", + "vhs": "๐ผ", + "vibration_mode": "๐ณ", + "video_camera": "๐น", + "video_game": "๐ฎ", + "violin": "๐ป", + "virgo": "โ๏ธ", + "volcano": "๐", + "vs": "๐", + "walking": "๐ถ", + "waning_crescent_moon": "๐", + "waning_gibbous_moon": "๐", + "warning": "โ ๏ธ", + "watch": "โ๏ธ", + "water_buffalo": "๐", + "watermelon": "๐", + "wave": "๐", + "wavy_dash": "ใฐ", + "waxing_crescent_moon": "๐", + "waxing_gibbous_moon": "๐", + "wc": "๐พ", + "weary": "๐ฉ", + "wedding": "๐", + "whale": "๐ณ", + "whale2": "๐", + "wheelchair": "โฟ๏ธ", + "white_check_mark": "โ
", + "white_circle": "โช", + "white_flower": "๐ฎ", + "white_large_square": "โป๏ธ", + "white_square_button": "๐ณ", + "wind_chime": "๐", + "wine_glass": "๐ท", + "wink": "๐", + "wolf": "๐บ", + "woman": "๐ฉ", + "womans_clothes": "๐", + "womans_hat": "๐", + "womens": "๐บ", + "worried": "๐", + "wrench": "๐ง", + "x": "โ", + "yellow_heart": "๐", + "yen": "๐ด", + "yum": "๐", + "zap": "โก๏ธ", + "zero": "0๏ธโฃ", + "zzz": "๐ค" +};
\ No newline at end of file diff --git a/lib/initialize.js b/lib/initialize.js index ae94f85..6adb6cd 100644 --- a/lib/initialize.js +++ b/lib/initialize.js @@ -9,31 +9,62 @@ var mdbvideos = require('./login'), videoHandler = require('./videos'), prompts = require('./prompts'), + pkg = require('../package'), + emoji = require('./emoji'), colors = require('colors'), inquirer = require('inquirer'); +function checkName(profile) { + + 'use strict'; + + var greetings = 'Hi '; + return ((profile.firstName !== '') ? greetings + profile.firstName : greetings + profile.userName) + ' ' + emoji.smile; +} + module.exports = function run(profile, argv) { 'use strict'; - var lookFor = ((!argv.h)? 'Videos' : 'Handouts'); + var lookFor = ((!argv.h)? 'Videos' : 'Handouts'), videoPreference = 'youtube'; inquirer.prompt(profile, function prompt(answers) { - var list = prompts.list, classes = list, check = prompts.check; + var list = prompts.list, classes = list, check = prompts.check, confirm = prompts.confirm; + + mdbvideos.init(answers, argv, function get(err, data, profile) { - mdbvideos.init(answers, argv, function get(err, data) { if (err !== null) { throw err; } + if (profile.preset.video[1] === videoPreference || argv.h) { return processList(data, profile); } + + confirm[0].message = 'Your current video preference is set to ' + profile.preset.video[1].underline + '. Switch to: ' + videoPreference.green; + + return inquirer.prompt(confirm, function prompt(answers) { + if (!answers.confirm) { return console.log('i'.red + ' ' + pkg.name + ' requires video preferences set to ' + videoPreference + '.\n'); } + + mdbvideos.updateProfile({ + provider: videoPreference, + language: profile.preset.language[1] + }, function status(err, resp) { + if (err !== null) { throw err; } + if (resp.success) { processList(data, profile); } + }); + + }); + + }); + + function processList(data, profile) { + if (data.length) { - classes[0].message = 'Found ' + data.length + ' Course'+ ((data.length > 1)? 's' : '') + '. Select:'; + classes[0].message = checkName(profile) + ' . Found ' + data.length + ' Course'+ ((data.length > 1)? 's' : '') + '. Select:'; classes[0].choices = data; return currentList(); } - - }); + } function currentList() { inquirer.prompt(classes, function prompt(answers) { @@ -56,8 +87,8 @@ module.exports = function run(profile, argv) { } return console.log('i'.red + ' Unable to locate any ' + lookFor.toLowerCase() + ' lists in the wiki. Are ' + - lookFor.toLowerCase() + ' list present in the wiki?' + - ((lookFor === 'Videos') ? '\n\nTry to add ' + '--cw'.green + ' to switch and search on courseware instead; make sure your mongodb user profile video preferences are set to youtube.\n' : '')); + lookFor.toLowerCase() + ' list present?' + + ((lookFor === 'Videos') ? '\n\n' + ((!argv.cw) ? 'Try to add ' + '--cw'.green + ' to switch and search on courseware instead.\n' : '') : '')); }); }); diff --git a/lib/login.js b/lib/login.js index 88b97f0..4715bc3 100644 --- a/lib/login.js +++ b/lib/login.js @@ -13,7 +13,7 @@ var request = require('request'), videoHandler = require('./videos'), coursewareHandler = require('./courseware'); -var jar = request.jar(), host = 'https://university.mongodb.com'; +var jar = request.jar(), host = 'https://university.mongodb.com', xcsrftoken = {}; function addCookies(cookies, url) { @@ -29,16 +29,18 @@ module.exports = { 'use strict'; var url = host, - bar = new ProgressBar('>'.magenta + ' Searching [:bar] :percent', { complete: '=', incomplete: ' ', width: 20, total: 5 }), + bar = new ProgressBar('>'.magenta + ' Searching [:bar] :percent', { complete: '=', incomplete: ' ', width: 20, total: 7 }), CSRFTokenCookie = '', login = function login(token) { + xcsrftoken = { 'X-CSRFToken': token[0].split('=')[1] }; + request({ uri: url + '/login', method: 'POST', jar: jar, - headers: { 'X-CSRFToken': token[0].split('=')[1] }, + headers: xcsrftoken, form: { 'email': opt.user, 'password': opt.password } }, function post(err, res, body) { @@ -50,7 +52,7 @@ module.exports = { bar.tick(); - return checkCourses(bar); + return checkProfile(bar); } @@ -59,7 +61,34 @@ module.exports = { }); }, - checkCourses = function checkCourses(bar) { + checkProfile = function checkProfile(bar) { + request({ url: url + '/edit_profile', jar: jar }, function get(err, res, body) { + if (err !== null) { return callback(err, null); } + bar.tick(); + if (res.statusCode === 200) { + + bar.tick(); + + var $ = cheerio.load(body), + provider = $('select[name="provider"] option:selected'), + language = $('select[name="language"] option:selected'), + currentProfile = { + preset: { + video: [provider.text(), provider.val()], + language: [language.text(), language.val()] + }, + firstName: $('input[name="first_name"]').attr('value'), + lastName: $('input[name="last_name"]').attr('value'), + username: $('input[name="username"]').attr('value') + }; + + return checkCourses(bar, currentProfile); + } + }); + + }, + + checkCourses = function checkCourses(bar, currentProfile) { bar.tick(); @@ -82,7 +111,7 @@ module.exports = { bar.tick(); - callback(null, list); + callback(null, list, currentProfile); } }); @@ -211,5 +240,23 @@ module.exports = { } callback(new Error('Server Response: '.red + response.statusCode)); }); + }, + + updateProfile: function updateProfile(options, callback) { + + 'use strict'; + + request.post({ + uri: host + '/save_video_preferences', + method: 'POST', + jar: jar, + headers: xcsrftoken, + form: { csrfmiddlewaretoken: xcsrftoken, provider: options.provider, language: options.language } + }, function post(err, res, body) { + + if (err !== null) { return callback(err, null); } + if (res.statusCode === 200) { callback(null, JSON.parse(body)); } + + }); } }; diff --git a/lib/prompts.js b/lib/prompts.js index 7e90cc5..e29716d 100644 --- a/lib/prompts.js +++ b/lib/prompts.js @@ -22,6 +22,8 @@ module.exports = (function build() { list: [{ type: 'list', name: 'url', message: '', choices: [] }], + confirm: [{ type: 'confirm', name: 'confirm', message: '' }], + check: [{ type: 'checkbox', message: '', name: 'videos', choices: [], validate: function validate(answer) { if ( answer.length < 1 ) { return 'You must choose at least one option.'; } diff --git a/package.json b/package.json index 381cae7..6266e9c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mongo-edu", "preferGlobal": true, - "version": "0.2.15", + "version": "0.2.16", "author": "Przemyslaw Pluta <przemyslawplutadev@gmail.com> (http://przemyslawpluta.com)", "description": "Select and download videos and handouts from university.mongodb.com courses", "main": "./mongo-edu", @@ -33,10 +33,10 @@ "cheerio": "~0.19.0", "colors": "~1.1.2", "easy-table": "~1.0.0", - "filesize": "~3.1.2", + "filesize": "~3.1.3", "glob": "~5.0.14", "inquirer": "~0.9.0", - "lodash": "~3.10.0", + "lodash": "~3.10.1", "mkdirp": "~0.5.1", "mv": "~2.1.1", "path-extra": "~1.0.3", @@ -46,7 +46,7 @@ "rimraf": "~2.4.2", "unzip": "~0.1.11", "which": "~1.1.1", - "yargs": "~3.15.0", + "yargs": "~3.17.1", "youtube-dl": "~1.10.5" }, "engines": { |